From f978b04633ea369ff509e39f7102cec211419c61 Mon Sep 17 00:00:00 2001 From: ebanks Date: Fri, 17 Jul 2009 14:03:34 +0000 Subject: [PATCH] A very simple walker to print out (using the ROD's toString method) all of the RODs it sees. This is the easiest solution to get around the (temporary) bug of reads being seen multiple times by reads walkers when close intervals are passed to them (i.e. process full contigs and then use a ref walker to filter the ones within your intervals of choice) git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1273 348d0f76-0448-11de-a6fe-93d51630548a --- .../gatk/walkers/PrintRODsWalker.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 java/src/org/broadinstitute/sting/playground/gatk/walkers/PrintRODsWalker.java diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/PrintRODsWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/PrintRODsWalker.java new file mode 100755 index 000000000..cbeb2e1dc --- /dev/null +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/PrintRODsWalker.java @@ -0,0 +1,47 @@ +package org.broadinstitute.sting.playground.gatk.walkers; + +import org.broadinstitute.sting.gatk.LocusContext; +import org.broadinstitute.sting.gatk.refdata.*; +import org.broadinstitute.sting.gatk.walkers.*; + +/** + * PrintRODsWalker prints out all of the RODs that it sees (using the ROD's toString method) + */ +@Requires(value={DataSource.REFERENCE},referenceMetaData=@RMD(name="variant",type=ReferenceOrderedDatum.class)) +public class PrintRODsWalker extends RefWalker { + + /** + * Initialize the number of loci processed to zero. + * + * @return 0 + */ + public Integer reduceInit() { return 0; } + + /** + * For each site of interest, rescore the genotype likelihoods by applying the specified feature set. + * + * @param tracker the meta-data tracker + * @param ref the reference base + * @param context the context for the given locus + * @return 1 if the locus was successfully processed, 0 if otherwise + */ + public Integer map(RefMetaDataTracker tracker, char ref, LocusContext context) { + ReferenceOrderedDatum variant = tracker.lookup("variant", null); + + if (variant != null ) + out.println(variant); + + return 1; + } + + /** + * Increment the number of rods processed. + * + * @param value result of the map. + * @param sum accumulator for the reduce. + * @return the new number of rods processed. + */ + public Integer reduce(Integer value, Integer sum) { + return sum + value; + } +} \ No newline at end of file