44 strncpy(fname, file_name,
sizeof(fname));
46 mate_number = strstr(fname,
"#");
57 fp_opposite_mate =
gzopen(fname,
"wb");
59 fp_opposite_mate = fp;
62 fp =
gzopen(file_name,
"wb");
63 fp_opposite_mate = NULL;
74 if (fp_opposite_mate && fp != fp_opposite_mate)
80 fp_opposite_mate = NULL;
91 process_one_alignment(mate_1, mate_2);
102 process_one_alignment(mate_1, mate_2);
113 if (fp_opposite_mate && fp != fp_opposite_mate)
119 fp_opposite_mate = NULL;
122 void DebugOutput::output_alignment(
gzFile& fp,
const struct DbgAlignment& al,
const struct DbgInfo& info)
125 if (al.alignment_pos)
127 gzwrite(fp, &info,
sizeof(info));
131 void DebugOutput::process_one_alignment(
const AlignmentData& mate_1,
const AlignmentData& mate_2)
136 const uint32 mapq = mate_1.mapq;
139 process_one_mate(al, info, mate_1, mate_2, mapq);
140 output_alignment(fp, al, info);
145 process_one_mate(al, info, mate_2, mate_1, mapq);
146 output_alignment(fp_opposite_mate, al, info);
152 void DebugOutput::process_one_mate(DbgAlignment& al,
154 const AlignmentData& alignment,
155 const AlignmentData& mate,
159 al.read_id =
crcCalc(alignment.read_name, strlen(alignment.read_name));
160 al.read_len = alignment.read_len;
162 if (alignment.aln->is_aligned())
176 if (alignment.aln->is_paired())
179 if (mate.aln->is_aligned() ==
false)
196 info.ref_id = seq_index;
197 info.mate = alignment.aln->mate();
198 info.score = alignment.aln->score();
200 info.ed = alignment.aln->ed();
223 al.alignment_pos = 0;