@@ -128,11 +128,13 @@ void calculate_likelihood_CNV(bam_info *in_bam, parameters *params, svs arr[], i
128
128
expected_rd_unfiltered += in_bam -> expected_rd_unfiltered [gc_val ];
129
129
observed_rd_unfiltered += in_bam -> rd_unfiltered [i ];
130
130
131
- mappability_score += in_bam -> mappability [i ];
131
+ if (params -> mappability_file != NULL )
132
+ mappability_score += in_bam -> mappability [i ];
132
133
}
133
134
//fprintf(stderr,"%d - %f ----- %d - %f\n", observed_rd_filtered, expected_rd_filtered, observed_rd_unfiltered, expected_rd_unfiltered);
134
135
135
- arr [count ].mappability = mappability_score / (double ) (arr [count ].end - arr [count ].start );
136
+ if (params -> mappability_file != NULL )
137
+ arr [count ].mappability = mappability_score / (double ) (arr [count ].end - arr [count ].start );
136
138
137
139
if (!params -> no_kmer )
138
140
{
@@ -248,11 +250,23 @@ void output_SVs( parameters *params, FILE* fpSVs, FILE* fp_del, FILE* fp_dup)
248
250
fprintf (fp_del ,"%s\t%d\t%d\t%.1f\t%.2f\t%.2f\t%d\t%.2lf\n" , all_svs_del [count ].chr_name , all_svs_del [count ].start , all_svs_del [count ].end , all_svs_del [count ].copy_number , all_svs_del [count ].likelihood_unfiltered , all_svs_del [count ].likelihood_kmer , all_svs_del [count ].rp , all_svs_del [count ].mappability );
249
251
//fprintf(fp_del,"%s\t%d\t%d\t%.2lf\t%.2f\t%.2lf\t%d\t%f\t%d\t%f\t%d\t%f\n", all_svs_del[count].chr_name, all_svs_del[count].start, all_svs_del[count].end, all_svs_del[count].likelihood_filtered, all_svs_del[count].copy_number, all_svs_del[count].likelihood_unfiltered, all_svs_del[count].border_rp, all_svs_del[count].mappability, all_svs_del[count].observed_rd_filtered, all_svs_del[count].expected_rd_filtered, all_svs_del[count].observed_rd_all, all_svs_del[count].expected_rd_all);
250
252
251
- if (all_svs_del [ count ]. likelihood_unfiltered < 0.5 && all_svs_del [ count ]. mappability > 0.5 && all_svs_del [ count ]. likelihood_kmer < 10 )
253
+ if (params -> mappability_file != NULL )
252
254
{
253
- fprintf (fpSVs ,"%s\t%d\t%d\tDEL\t%.1f\t%.2f\t%.2f\t%d\t%.2lf\n" , all_svs_del [count ].chr_name , all_svs_del [count ].start , all_svs_del [count ].end , all_svs_del [count ].copy_number , all_svs_del [count ].likelihood_unfiltered , all_svs_del [count ].likelihood_kmer , all_svs_del [count ].rp , all_svs_del [count ].mappability );
254
- //fprintf(fpSVs,"%s\t%d\t%d\tDEL\t%.2lf\t%.2f\t%.2lf\t%d\t%f\t%d\t%f\t%d\t%f\n", all_svs_del[count].chr_name, all_svs_del[count].start, all_svs_del[count].end, all_svs_del[count].likelihood_filtered, all_svs_del[count].copy_number, all_svs_del[count].likelihood_unfiltered, all_svs_del[count].border_rp, all_svs_del[count].mappability, all_svs_del[count].observed_rd_filtered, all_svs_del[count].expected_rd_filtered, all_svs_del[count].observed_rd_all, all_svs_del[count].expected_rd_all);
255
- sv_cnt_del ++ ;
255
+ if (all_svs_del [count ].likelihood_unfiltered < 0.5 && all_svs_del [count ].mappability > 0.5 && all_svs_del [count ].likelihood_kmer < 10 )
256
+ {
257
+ fprintf (fpSVs ,"%s\t%d\t%d\tDEL\t%.1f\t%.2f\t%.2f\t%d\t%.2lf\n" , all_svs_del [count ].chr_name , all_svs_del [count ].start , all_svs_del [count ].end , all_svs_del [count ].copy_number , all_svs_del [count ].likelihood_unfiltered , all_svs_del [count ].likelihood_kmer , all_svs_del [count ].rp , all_svs_del [count ].mappability );
258
+ //fprintf(fpSVs,"%s\t%d\t%d\tDEL\t%.2lf\t%.2f\t%.2lf\t%d\t%f\t%d\t%f\t%d\t%f\n", all_svs_del[count].chr_name, all_svs_del[count].start, all_svs_del[count].end, all_svs_del[count].likelihood_filtered, all_svs_del[count].copy_number, all_svs_del[count].likelihood_unfiltered, all_svs_del[count].border_rp, all_svs_del[count].mappability, all_svs_del[count].observed_rd_filtered, all_svs_del[count].expected_rd_filtered, all_svs_del[count].observed_rd_all, all_svs_del[count].expected_rd_all);
259
+ sv_cnt_del ++ ;
260
+ }
261
+ }
262
+ else
263
+ {
264
+ if (all_svs_del [count ].likelihood_unfiltered < 0.5 && all_svs_del [count ].likelihood_kmer < 10 )
265
+ {
266
+ fprintf (fpSVs ,"%s\t%d\t%d\tDEL\t%.1f\t%.2f\t%.2f\t%d\n" , all_svs_del [count ].chr_name , all_svs_del [count ].start , all_svs_del [count ].end , all_svs_del [count ].copy_number , all_svs_del [count ].likelihood_unfiltered , all_svs_del [count ].likelihood_kmer , all_svs_del [count ].rp );
267
+ //fprintf(fpSVs,"%s\t%d\t%d\tDEL\t%.2lf\t%.2f\t%.2lf\t%d\t%f\t%d\t%f\t%d\t%f\n", all_svs_del[count].chr_name, all_svs_del[count].start, all_svs_del[count].end, all_svs_del[count].likelihood_filtered, all_svs_del[count].copy_number, all_svs_del[count].likelihood_unfiltered, all_svs_del[count].border_rp, all_svs_del[count].mappability, all_svs_del[count].observed_rd_filtered, all_svs_del[count].expected_rd_filtered, all_svs_del[count].observed_rd_all, all_svs_del[count].expected_rd_all);
268
+ sv_cnt_del ++ ;
269
+ }
256
270
}
257
271
}
258
272
@@ -358,16 +372,20 @@ void find_SVs( bam_info *in_bam, parameters *params, FILE* fp_del, FILE* fp_dup,
358
372
359
373
//Check mappability
360
374
//fprintf(stderr,"Finding mappability for each region\n");
361
- init_mappability_per_chr ( in_bam , params , chr_index );
362
- load_mappability_regions ( in_bam , params , chr_name );
375
+ if (params -> mappability_file != NULL )
376
+ {
377
+ init_mappability_per_chr ( in_bam , params , chr_index );
378
+ load_mappability_regions ( in_bam , params , chr_name );
379
+ }
363
380
364
381
365
382
fprintf (stderr ,"\nCalculating Likelihoods\n" );
366
383
find_depths (in_bam , params , chr_name , chr_index );
367
384
368
- //free( in_bam->rd_filtered);
369
385
free ( in_bam -> rd_unfiltered );
370
- free ( in_bam -> mappability );
386
+
387
+ if (params -> mappability_file != NULL )
388
+ free ( in_bam -> mappability );
371
389
372
390
if (!params -> no_kmer )
373
391
{
0 commit comments