Skip to content

Commit

Permalink
Add --no-unal option to stop reporting of unaligned reads
Browse files Browse the repository at this point in the history
  • Loading branch information
ch4rr0 committed Jun 5, 2017
1 parent 5ce9329 commit f053cb6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ebwt_search.cpp
Expand Up @@ -147,6 +147,7 @@ static vector<string> qualities2;
static string wrapper; // Type of wrapper script
bool gAllowMateContainment;
bool gReportColorPrimer;
bool noUnal; // don't print unaligned reads
MUTEX_T gLock;

static void resetOptions() {
Expand Down Expand Up @@ -255,6 +256,7 @@ static void resetOptions() {
wrapper.clear();
gAllowMateContainment = false; // true -> alignments where one mate lies inside the other are valid
gReportColorPrimer = false; // true -> print flag with trimmed color primer and downstream color
noUnal = false; // true -> do not report unaligned reads
}

// mating constraints
Expand Down Expand Up @@ -340,6 +342,7 @@ enum {
ARG_COLOR_PRIMER,
ARG_WRAPPER,
ARG_INTERLEAVED_FASTQ,
ARG_SAM_NO_UNAL,
};

static struct option long_options[] = {
Expand Down Expand Up @@ -446,6 +449,7 @@ static struct option long_options[] = {
{(char*)"col-primer", no_argument, 0, ARG_COLOR_PRIMER},
{(char*)"wrapper", required_argument, 0, ARG_WRAPPER},
{(char*)"interleaved", required_argument, 0, ARG_INTERLEAVED_FASTQ},
{(char*)"no-unal", no_argument, 0, ARG_SAM_NO_UNAL},
{(char*)0, 0, 0, 0} // terminator
};

Expand Down Expand Up @@ -526,6 +530,7 @@ static void printUsage(ostream& out) {
<< " --refidx refer to ref. seqs by 0-based index rather than name" << endl
<< " --al <fname> write aligned reads/pairs to file(s) <fname>" << endl
<< " --un <fname> write unaligned reads/pairs to file(s) <fname>" << endl
<< " --no-unal suppress SAM records for unaligned reads" << endl
<< " --max <fname> write reads/pairs over -m limit to file(s) <fname>" << endl
<< " --suppress <cols> suppresses given columns (comma-delim'ed) in default output" << endl
<< " --fullref write entire ref name (default: only up to 1st space)" << endl
Expand Down Expand Up @@ -828,6 +833,7 @@ static void parseOptions(int argc, const char **argv) {
case ARG_SAM_NO_QNAME_TRUNC: samNoQnameTrunc = true; break;
case ARG_SAM_NOHEAD: samNoHead = true; break;
case ARG_SAM_NOSQ: samNoSQ = true; break;
case ARG_SAM_NO_UNAL: noUnal = true; break;
case ARG_SAM_RG: {
if(!rgs.empty()) rgs += '\t';
rgs += optarg;
Expand Down
4 changes: 4 additions & 0 deletions sam.cpp
Expand Up @@ -11,6 +11,7 @@
#include "pat.h"
#include "hit.h"
#include "sam.h"
#include "search_globals.h"

using namespace std;

Expand Down Expand Up @@ -66,6 +67,9 @@ void SAMHitSink::reportUnOrMax(
{
if(un) {
HitSink::reportUnaligned(threadId, p);
if (noUnal) {
return;
}
} else {
HitSink::reportMaxed(*hs, threadId, p);
}
Expand Down
1 change: 1 addition & 0 deletions search_globals.h
Expand Up @@ -20,6 +20,7 @@ extern bool showSeed;
extern bool quiet;
extern bool gAllowMateContainment;
extern bool gReportColorPrimer;
extern bool noUnal;

extern MUTEX_T gLock;

Expand Down

0 comments on commit f053cb6

Please sign in to comment.