added a quick option to print the first n reads.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5912 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
a79967d9af
commit
8f3e8f934d
|
|
@ -51,8 +51,9 @@ public class PrintReadsWalker extends ReadWalker<SAMRecord, SAMFileWriter> {
|
||||||
@Argument(fullName = "readGroup", shortName = "readGroup", doc="Discard reads not belonging to the specified read group", required = false)
|
@Argument(fullName = "readGroup", shortName = "readGroup", doc="Discard reads not belonging to the specified read group", required = false)
|
||||||
String readGroup = null;
|
String readGroup = null;
|
||||||
@Argument(fullName = "platform", shortName = "platform", doc="Discard reads not generated by the specified platform", required = false)
|
@Argument(fullName = "platform", shortName = "platform", doc="Discard reads not generated by the specified platform", required = false)
|
||||||
String platform = null;
|
String platform = null; // E.g. ILLUMINA, 454
|
||||||
// E.g. ILLUMINA, 454
|
@Argument(fullName = "number", shortName = "n", doc="Outputs only the first n reads, discarding the rest", required = false)
|
||||||
|
int nReadsToPrint = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The initialize function.
|
* The initialize function.
|
||||||
|
|
@ -87,6 +88,14 @@ public class PrintReadsWalker extends ReadWalker<SAMRecord, SAMFileWriter> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if we've reached the output limit
|
||||||
|
if ( nReadsToPrint == 0 ) {
|
||||||
|
return false; // n == 0 means we've printed all we needed.
|
||||||
|
}
|
||||||
|
else if (nReadsToPrint > 0) {
|
||||||
|
nReadsToPrint--; // n > 0 means there are still reads to be printed.
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue