Skip to content

Commit

Permalink
Added an initial implementation of the PAF format output for overlaps.
Browse files Browse the repository at this point in the history
  • Loading branch information
isovic committed Nov 14, 2015
1 parent e8f6a03 commit 6146f48
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
27 changes: 25 additions & 2 deletions src/owler/owler.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ class OverlapResult {
// int64_t B_start = seed_hits[hits_start + back_id].ref_pos;
// int64_t B_end = seed_hits[hits_start + front_id].ref_pos + 12;
//
// std::string adj = (ref_reversed == false) ? OVERLAP_NORMAL : OVERLAP_INNIE;
// int64_t read1_id = read_id + 1;
// int64_t read2_id = ref_id + 1;
// int64_t score = std::min((A_end - A_start), (B_end - B_start));
Expand All @@ -110,9 +109,11 @@ class OverlapResult {
// int64_t ahang = 0; // - (alignment_start - clip_count_front);
// int64_t bhang = 0; // reference_length - (alignment_end + clip_count_back);
//

// std::string adj = (ref_is_reverse == false) ? OVERLAP_NORMAL : OVERLAP_INNIE;
// ret << "{OVL" << "\n";
// ret << "adj:" << adj << "\n";
// ret << "rds:" << read1_id << "," << read2_id << "\n";
// ret << "rds:" << (read_id + 1) << "," << (ref_id + 1) << "\n";
// ret << "scr:" << score << "\n";
// ret << "ahg:" << ahang << "\n";
// ret << "bhg:" << bhang << "\n";
Expand All @@ -121,6 +122,28 @@ class OverlapResult {
return ret.str();
}

std::string GeneratePAFLine() {
std::stringstream ret;
// ret << ref_header << "\t";
if (read_header == "") { ret << (read_id + 1) << "\t"; } else { ret << TrimToFirstSpace(read_header) << "\t"; }
ret << read_length << "\t";
ret << read_start << "\t";
ret << read_end << "\t";

ret << (ref_is_reverse ? "-" : "+") << "\t"; /// Or maybe this should be (read_is_reverse)? In this case, upper and lower parts need to be switched (ref and read).
if (ref_header == "") { ret << (ref_id + 1) << "\t"; } else { ret << TrimToFirstSpace(ref_header) << "\t"; }
ret << ref_length << "\t";
ret << ref_start << "\t";
ret << ref_end << "\t";

ret << std::min(cov_bases_read, cov_bases_ref) << "\t";
ret << (((read_end - read_start) > (ref_end - ref_start)) ? (read_end - read_start) : (ref_end - ref_start)) << "\t";
ret << "255" << "\t";
ret << "cm:i:" << shared_minmers;

return ret.str();
}

};

struct overlapresult_sort_key
Expand Down
6 changes: 4 additions & 2 deletions src/owler/process_read.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1355,8 +1355,10 @@ int Owler::ApplyLCS2(OwlerData* owler_data, std::vector<Index*> &indexes, const
/// Generate output lines.
if (parameters->outfmt == "mhap") {
owler_data->overlap_lines += found_overlaps[i].GenerateMHAPLine();
// } else if (parameters->outfmt == "afg") {
// owler_data->overlap_lines += found_overlaps[i].GenerateAFGLine();
} else if (parameters->outfmt == "paf") {
owler_data->overlap_lines += found_overlaps[i].GeneratePAFLine();
} else if (parameters->outfmt == "afg") {
owler_data->overlap_lines += found_overlaps[i].GenerateAFGLine();
} else {
owler_data->overlap_lines += found_overlaps[i].GenerateMHAPLine();
}
Expand Down
7 changes: 4 additions & 3 deletions src/utility/program_parameters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -591,10 +591,11 @@ void VerboseUsageAndExit(FILE *fp) {
ss << "\t-i STR\tPath to the index of the reference sequence. If not specified, index is generated\n\t\tin the same path as the reference file, with .gmidx extension.\n\t\tFor non-parsimonious mode, secondary index .gmidxsec is also generated.\n";
ss << "\t-d STR\tPath to the reads file (fastq or fasta).\n";
ss << "\t-o STR\tPath to the output file that will be generated.\n";
// ss << "\t-L STR\tFormat in which to output alignments [" << (DEFAULT_OUTPUT_FORMAT) << "]. Options are: \n";
// ss << "\t sam - Standard SAM output (in normal and '-w overlap' modes).\n";
ss << "\t-L STR\tFormat in which to output results [" << (DEFAULT_OUTPUT_FORMAT) << "]. Options are: \n";
ss << "\t sam - Standard SAM output (in normal and '-w overlap' modes).\n";
// ss << "\t afg - AMOS overlap format (use with '-w overlapper').\n";
// ss << "\t mhap - MHAP overlap format (use with '-w owler').\n";
ss << "\t mhap - MHAP overlap format (use with '-w owler').\n";
ss << "\t paf - MHAP overlap format (use with '-w owler').\n";

ss << "\n";
ss << "\t-D STR\tPath to a folder containing read files (in fastq or fasta format) to process.\n\t\tCannot be used in combination with '-d' or '-o'.\n";
Expand Down

0 comments on commit 6146f48

Please sign in to comment.