From 8f3e8f934ddafed700729755c70d648873f9164a Mon Sep 17 00:00:00 2001 From: carneiro Date: Wed, 1 Jun 2011 16:16:50 +0000 Subject: [PATCH] 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 --- .../sting/gatk/walkers/PrintReadsWalker.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/PrintReadsWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/PrintReadsWalker.java index fd2d53827..e20e96dee 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/PrintReadsWalker.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/PrintReadsWalker.java @@ -51,8 +51,9 @@ public class PrintReadsWalker extends ReadWalker { @Argument(fullName = "readGroup", shortName = "readGroup", doc="Discard reads not belonging to the specified read group", required = false) String readGroup = null; @Argument(fullName = "platform", shortName = "platform", doc="Discard reads not generated by the specified platform", required = false) - String platform = null; - // E.g. ILLUMINA, 454 + String platform = null; // 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. @@ -87,6 +88,14 @@ public class PrintReadsWalker extends ReadWalker { 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; }