37 m_id_check( id_check )
47 if ((
m_id_check && alnL[0].read_id != alnR[0].read_id) ||
48 (
m_id_check && alnL[1].read_id != alnR[1].read_id) ||
49 alnL[0].read_len != alnR[0].read_len ||
50 alnL[1].read_len != alnR[1].read_len)
82 if ((alnL[0].ref_id != alnR[0].ref_id) &&
83 (alnL[1].ref_id != alnR[1].ref_id))
106 else if (alnL[0].ref_id != alnR[0].ref_id)
129 else if (alnL[1].ref_id != alnR[1].ref_id)
195 if ((alnL[0].is_rc() != alnR[0].is_rc()) &&
196 (alnL[1].is_rc() != alnR[1].is_rc()))
210 if (alnL[0].is_rc() != alnR[0].is_rc())
224 else if (alnL[1].is_rc() != alnR[1].is_rc())
314 void generate_summary_header(FILE* html_output)
321 template <
typename StatsType>
322 void generate_summary_cell(FILE* html_output,
const std::string file_name,
const char* type,
const StatsType&
stats,
const uint32 n,
const char* cls)
324 char link_name[1024];
325 sprintf( link_name,
"<a href=\"%s\">%s</a>",
local_file( file_name ), type );
348 const std::string distant_mapped_bps_name =
generate_file_name( report,
"distant_stats.mapped-bps" );
350 const std::string distant_mapQ_name =
generate_file_name( report,
"distant_stats.mapQ" );
351 const std::string distant_mms_name =
generate_file_name( report,
"distant_stats.mms" );
352 const std::string distant_ins_name =
generate_file_name( report,
"distant_stats.ins" );
353 const std::string distant_dels_name =
generate_file_name( report,
"distant_stats.dels" );
354 const std::string distant_pos_name =
generate_file_name( report,
"distant_stats.pos" );
356 const std::string discordant_mapped_bps_name =
generate_file_name( report,
"discordant_stats.mapped-bps" );
357 const std::string discordant_ed_name =
generate_file_name( report,
"discordant_stats.ed" );
358 const std::string discordant_mapQ_name =
generate_file_name( report,
"discordant_stats.mapQ" );
359 const std::string discordant_mms_name =
generate_file_name( report,
"discordant_stats.mms" );
360 const std::string discordant_ins_name =
generate_file_name( report,
"discordant_stats.ins" );
361 const std::string discordant_dels_name =
generate_file_name( report,
"discordant_stats.dels" );
362 const std::string discordant_pos_name =
generate_file_name( report,
"discordant_stats.pos" );
389 FILE* html_output = fopen( report,
"w" );
390 if (html_output == NULL)
392 log_warning( stderr,
"unable to write HTML report \"%s\"\n", report );
396 std::vector<std::string> log_bins;
397 for (
uint32 y = 0; y < 11; ++y)
400 log_bins.push_back(
"0" );
402 log_bins.push_back(
"1" );
404 log_bins.push_back(
"2" );
408 sprintf(buffer,
"2^%u", y-1);
409 log_bins.push_back( buffer );
412 log_bins.push_back(
"inf" );
414 std::vector<std::string> ed_bins;
415 ed_bins.push_back(
"-");
416 for (
uint32 y = 0; y < 16; ++y)
419 sprintf(buffer,
"%u", y);
420 ed_bins.push_back( buffer );
444 const uint32 HI_MAPQ_BIN = 6;
448 const char* meta_list =
"<meta http-equiv=\"refresh\" content=\"5\" />";
458 html::table_object table( html_output,
"alignment-stats",
"stats",
"alignment stats" );
509 html::table_object table( html_output,
"discordance-stats",
"stats",
"discordance stats" );
524 html::td_object( html_output,
html::FORMATTED, NULL,
"%.2f M (%.2f M)",
float(cum_different_ref[0]) * 1.0e-6f,
float(cum_different_ref[HI_MAPQ_BIN]) * 1.0e-6f );
525 html::td_object( html_output,
html::FORMATTED, NULL,
"%5.2f %% (%.3f %%)", 100.0f *
float(cum_different_ref[0]) /
float(n), 100.0f *
float(cum_different_ref[HI_MAPQ_BIN]) /
float(n) );
526 html::td_object( html_output,
html::FORMATTED, NULL,
"%5.2f %% (%.3f %%)", 100.0f *
float(cum_different_ref1[0]) /
float(n), 100.0f *
float(cum_different_ref1[HI_MAPQ_BIN]) /
float(n) );
527 html::td_object( html_output,
html::FORMATTED, NULL,
"%5.2f %% (%.3f %%)", 100.0f *
float(cum_different_ref2[0]) /
float(n), 100.0f *
float(cum_different_ref2[HI_MAPQ_BIN]) /
float(n) );
528 html::td_object( html_output,
html::FORMATTED, NULL,
"%5.2f %% (%.3f %%)", 100.0f *
float(cum_different_ref12[0]) /
float(n), 100.0f *
float(cum_different_ref12[HI_MAPQ_BIN]) /
float(n) );
529 html::td_object( html_output,
html::FORMATTED, NULL,
"%5.2f %% (%.3f %%)", 100.0f *
float(cum_different_ref_unique[0]) /
float(n), 100.0f *
float(cum_different_ref_unique[HI_MAPQ_BIN]) /
float(n) );
530 html::td_object( html_output,
html::FORMATTED, NULL,
"%5.2f %% (%.3f %%)", 100.0f *
float(cum_different_ref_not_ambiguous[0]) /
float(n), 100.0f *
float(cum_different_ref_not_ambiguous[HI_MAPQ_BIN]) /
float(n) );
535 html::td_object( html_output,
html::FORMATTED, NULL,
"%.2f M (%.2f M)",
float(cum_distant[0]) * 1.0e-6f,
float(cum_distant[HI_MAPQ_BIN]) * 1.0e-6f );
536 html::td_object( html_output,
html::FORMATTED, NULL,
"%5.2f %% (%.3f %%)", 100.0f *
float(cum_distant[0]) /
float(n), 100.0f *
float(cum_distant[HI_MAPQ_BIN]) /
float(n) );
537 html::td_object( html_output,
html::FORMATTED, NULL,
"%5.2f %% (%.3f %%)", 100.0f *
float(cum_distant1[0]) /
float(n), 100.0f *
float(cum_distant1[HI_MAPQ_BIN]) /
float(n) );
538 html::td_object( html_output,
html::FORMATTED, NULL,
"%5.2f %% (%.3f %%)", 100.0f *
float(cum_distant2[0]) /
float(n), 100.0f *
float(cum_distant2[HI_MAPQ_BIN]) /
float(n) );
539 html::td_object( html_output,
html::FORMATTED, NULL,
"%5.2f %% (%.3f %%)", 100.0f *
float(cum_distant12[0]) /
float(n), 100.0f *
float(cum_distant12[HI_MAPQ_BIN]) /
float(n) );
540 html::td_object( html_output,
html::FORMATTED, NULL,
"%5.2f %% (%.3f %%)", 100.0f *
float(cum_distant_unique[0]) /
float(n), 100.0f *
float(cum_distant_unique[HI_MAPQ_BIN]) /
float(n) );
541 html::td_object( html_output,
html::FORMATTED, NULL,
"%5.2f %% (%.3f %%)", 100.0f *
float(cum_distant_not_ambiguous[0]) /
float(n), 100.0f *
float(cum_distant_not_ambiguous[HI_MAPQ_BIN]) /
float(n) );
546 html::td_object( html_output,
html::FORMATTED, NULL,
"%.2f M (%.2f M)",
float(cum_discordant[0]) * 1.0e-6f,
float(cum_discordant[HI_MAPQ_BIN]) * 1.0e-6f );
547 html::td_object( html_output,
html::FORMATTED, NULL,
"%5.2f %% (%.3f %%)", 100.0f *
float(cum_discordant[0]) /
float(n), 100.0f *
float(cum_discordant[HI_MAPQ_BIN]) /
float(n) );
548 html::td_object( html_output,
html::FORMATTED, NULL,
"%5.2f %% (%.3f %%)", 100.0f *
float(cum_discordant1[0]) /
float(n), 100.0f *
float(cum_discordant1[HI_MAPQ_BIN]) /
float(n) );
549 html::td_object( html_output,
html::FORMATTED, NULL,
"%5.2f %% (%.3f %%)", 100.0f *
float(cum_discordant2[0]) /
float(n), 100.0f *
float(cum_discordant2[HI_MAPQ_BIN]) /
float(n) );
550 html::td_object( html_output,
html::FORMATTED, NULL,
"%5.2f %% (%.3f %%)", 100.0f *
float(cum_discordant12[0]) /
float(n), 100.0f *
float(cum_discordant12[HI_MAPQ_BIN]) /
float(n) );
551 html::td_object( html_output,
html::FORMATTED, NULL,
"%5.2f %% (%.3f %%)", 100.0f *
float(cum_discordant_unique[0]) /
float(n), 100.0f *
float(cum_discordant_unique[HI_MAPQ_BIN]) /
float(n) );
552 html::td_object( html_output,
html::FORMATTED, NULL,
"%5.2f %% (%.3f %%)", 100.0f *
float(cum_discordant_not_ambiguous[0]) /
float(n), 100.0f *
float(cum_discordant_not_ambiguous[HI_MAPQ_BIN]) /
float(n) );
561 generate_summary_header( html_output );
562 generate_summary_cell( html_output, mapped_bps_name,
"mapped bases",
al_stats.
longer_mapping, n,
"none" );
564 generate_summary_cell( html_output, ed_name,
"edit distance",
al_stats.
lower_ed, n,
"none" );
566 generate_summary_cell( html_output, mms_name,
"mismatches",
al_stats.
lower_mms, n,
"none" );
567 generate_summary_cell( html_output, ins_name,
"insertions",
al_stats.
lower_ins, n,
"alt" );
568 generate_summary_cell( html_output, dels_name,
"deletions",
al_stats.
lower_dels, n,
"none" );
569 generate_summary_cell( html_output, pos_name,
"distance",
al_stats.
higher_pos, n,
"alt" );
571 generate_summary_header( html_output );
573 generate_summary_cell( html_output, distant_ed_name,
"edit distance [distant]",
distant_stats.
lower_ed, n,
"alt" );
575 generate_summary_cell( html_output, distant_mms_name,
"mismatches [distant]",
distant_stats.
lower_mms, n,
"alt" );
576 generate_summary_cell( html_output, distant_ins_name,
"insertions [distant]",
distant_stats.
lower_ins, n,
"none" );
577 generate_summary_cell( html_output, distant_dels_name,
"deletions [distant]",
distant_stats.
lower_dels, n,
"alt" );
578 generate_summary_cell( html_output, distant_pos_name,
"distance [distant]",
distant_stats.
higher_pos, n,
"none" );
580 generate_summary_header( html_output );
582 generate_summary_cell( html_output, discordant_ed_name,
"edit distance [discordant]",
discordant_stats.
lower_ed, n,
"none" );
584 generate_summary_cell( html_output, discordant_mms_name,
"mismatches [discordant]",
discordant_stats.
lower_mms, n,
"none" );
585 generate_summary_cell( html_output, discordant_ins_name,
"insertions [discordant]",
discordant_stats.
lower_ins, n,
"alt" );
594 "paired (L \\ R) vs (R \\ L)",
605 "unique (L \\ R) vs (R \\ L)",
616 "ambiguous (L \\ R) vs (R \\ L)",
627 "different reference by mapQ",
645 "discordant by mapQ",
680 fclose( html_output );