Skip to content

Commit

Permalink
Bug fixes and update to debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
asylvz committed Apr 12, 2019
1 parent 89b4c07 commit e2e2e31
Show file tree
Hide file tree
Showing 5 changed files with 264 additions and 235 deletions.
15 changes: 7 additions & 8 deletions bamonly.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ int read_bam( bam_info* in_bam, parameters* params)
for( i = 0; i < in_bam->bam_header->n_targets; i++)
bamToRefIndex[i] = sonic_refind_chromosome_index( params->this_sonic, in_bam->bam_header->target_name[i]);

//while( bam_itr_next( in_bam->bam_file, in_bam->iter, bam_alignment) > 0)

while( sam_itr_next( in_bam->bam_file, in_bam->iter, bam_alignment) > 0)
{
bam_alignment_core = bam_alignment->core;
Expand Down Expand Up @@ -607,8 +607,8 @@ void bamonly_vh_clustering( bam_info** in_bams, parameters *params)
FILE *fpVcf = NULL;
int skip_chromosome = 0;

sprintf( outputread, "%s%s.name", params->outdir, params->outprefix);
sprintf( outputfile, "%s%s.clusters", params->outdir, params->outprefix);
sprintf( outputread, "%s%s_name.log", params->outdir, params->outprefix);
sprintf( outputfile, "%s%s_clusters.log", params->outdir, params->outprefix);

/* Print all structural variations in .vcf format */
sprintf( svfile, "%s%s.vcf", params->outdir, params->outprefix);
Expand All @@ -617,6 +617,10 @@ void bamonly_vh_clustering( bam_info** in_bams, parameters *params)

print_vcf_header( fpVcf, in_bams, params);

/* Open the .clusters file if running in debug mode */
if( debug_mode)
fileOutput = safe_fopen( outputfile, "w");

for( chr_index = params->first_chr; chr_index <= params->last_chr; chr_index++)
{
if( strstr( params->this_sonic->chromosome_names[chr_index], "GL000220") != NULL)
Expand Down Expand Up @@ -724,12 +728,8 @@ void bamonly_vh_clustering( bam_info** in_bams, parameters *params)
if( not_in_bam == 1 || total_read_count == 0)
continue;


divet_row_count = load_Divet_bam( in_bams, params, chr_index);

/* Open the .clusters file if running in debug mode */
if( debug_mode)
fileOutput = safe_fopen( outputfile, "w");

/* Make all clusters NULL */
for( i = 0; i < MaxClusterCount; i++)
Expand Down Expand Up @@ -864,7 +864,6 @@ void bamonly_vh_clustering( bam_info** in_bams, parameters *params)
free_hash_table( params);
}


free_the_rest( in_bams, params);
}
fprintf( stderr, "\n");
Expand Down
Loading

0 comments on commit e2e2e31

Please sign in to comment.