From dd46d843fb186b4b9bd377cba0374b326865f460 Mon Sep 17 00:00:00 2001 From: Eric Banks Date: Wed, 6 Jun 2012 11:04:55 -0400 Subject: [PATCH 1/4] IR should skip Ion reads just like it does with 454 reads; Tim has confirmed that official platform name for Ion. --- .../gatk/walkers/indels/IndelRealigner.java | 5 +++-- .../sting/utils/sam/ReadUtils.java | 21 ++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java index 8f939fc49..e12f26fcc 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java @@ -532,8 +532,9 @@ public class IndelRealigner extends ReadWalker { read.getMappingQuality() == 0 || read.getAlignmentStart() == SAMRecord.NO_ALIGNMENT_START || ConstrainedMateFixingManager.iSizeTooBigToMove(read, MAX_ISIZE_FOR_MOVEMENT) || - ReadUtils.is454Read(read); - // TODO -- it would be nice if we could use indels from 454 reads as alternate consenses + ReadUtils.is454Read(read) || + ReadUtils.isIonRead(read); + // TODO -- it would be nice if we could use indels from 454/Ion reads as alternate consenses } private void cleanAndCallMap(ReferenceContext ref, GATKSAMRecord read, ReadMetaDataTracker metaDataTracker, GenomeLoc readLoc) { diff --git a/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java b/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java index 4e2fd1446..d2d5e6bc5 100755 --- a/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java +++ b/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java @@ -211,7 +211,7 @@ public class ReadUtils { } /** - * is the read a 454 read ? + * is the read a 454 read? * * @param read the read to test * @return checks the read group tag PL for the default 454 tag @@ -221,7 +221,17 @@ public class ReadUtils { } /** - * is the read a SOLiD read ? + * is the read an IonTorrent read? + * + * @param read the read to test + * @return checks the read group tag PL for the default ion tag + */ + public static boolean isIonRead(SAMRecord read) { + return isPlatformRead(read, "IONTORRENT"); + } + + /** + * is the read a SOLiD read? * * @param read the read to test * @return checks the read group tag PL for the default SOLiD tag @@ -231,7 +241,7 @@ public class ReadUtils { } /** - * is the read a SLX read ? + * is the read a SLX read? * * @param read the read to test * @return checks the read group tag PL for the default SLX tag @@ -241,10 +251,11 @@ public class ReadUtils { } /** - * checks if the read has a platform tag in the readgroup equal to 'name' ? + * checks if the read has a platform tag in the readgroup equal to 'name'. + * Assumes that 'name' is upper-cased. * * @param read the read to test - * @param name the platform name to test + * @param name the upper-cased platform name to test * @return whether or not name == PL tag in the read group of read */ public static boolean isPlatformRead(SAMRecord read, String name) { From 54f682a99c60a20ca10d4772d68a3562d9920dc6 Mon Sep 17 00:00:00 2001 From: Eric Banks Date: Wed, 6 Jun 2012 11:44:37 -0400 Subject: [PATCH 2/4] Unify to NGSPlatform framework. TechnologyComposition annotation now generalizes to Illumina and not just SLX. --- .../walkers/annotator/TechnologyComposition.java | 12 ++++++------ .../broadinstitute/sting/utils/sam/ReadUtils.java | 12 +++++++----- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/TechnologyComposition.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/TechnologyComposition.java index e7c3bbaad..f9b9eb3de 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/TechnologyComposition.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/TechnologyComposition.java @@ -20,11 +20,11 @@ import java.util.List; import java.util.Map; /** - * Counts of bases from SLX, 454, and SOLiD at this site + * Counts of bases from Illumina, 454, and SOLiD at this site */ @Hidden public class TechnologyComposition extends InfoFieldAnnotation implements ExperimentalAnnotation { - private String nSLX = "NumSLX"; + private String nIllumina = "NumIllumina"; private String n454 ="Num454"; private String nSolid = "NumSOLiD"; private String nOther = "NumOther"; @@ -46,7 +46,7 @@ public class TechnologyComposition extends InfoFieldAnnotation implements Experi reads454++; else if (ReadUtils.isSOLiDRead(p.getRead())) readsSolid++; - else if (ReadUtils.isSLXRead(p.getRead())) + else if (ReadUtils.isIlluminaRead(p.getRead())) readsIllumina++; else readsOther++; @@ -55,16 +55,16 @@ public class TechnologyComposition extends InfoFieldAnnotation implements Experi } Map map = new HashMap(); - map.put(nSLX, String.format("%d", readsIllumina)); + map.put(nIllumina, String.format("%d", readsIllumina)); map.put(n454, String.format("%d", reads454)); map.put(nSolid, String.format("%d", readsSolid)); map.put(nOther, String.format("%d", readsOther)); return map; } - public List getKeyNames() { return Arrays.asList(nSLX,n454,nSolid,nOther); } + public List getKeyNames() { return Arrays.asList(nIllumina,n454,nSolid,nOther); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(nSLX, 1, VCFHeaderLineType.Integer, "Number of SLX reads"), + public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(nIllumina, 1, VCFHeaderLineType.Integer, "Number of Illumina reads"), new VCFInfoHeaderLine(n454, 1, VCFHeaderLineType.Integer, "Number of 454 reads"), new VCFInfoHeaderLine(nSolid, 1, VCFHeaderLineType.Integer, "Number of SOLiD reads"), new VCFInfoHeaderLine(nOther, 1, VCFHeaderLineType.Integer, "Number of Other technology reads")); } diff --git a/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java b/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java index d2d5e6bc5..1d0fa96e6 100755 --- a/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java +++ b/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java @@ -31,6 +31,7 @@ import net.sf.samtools.*; import org.broadinstitute.sting.gatk.GenomeAnalysisEngine; import org.broadinstitute.sting.utils.GenomeLoc; import org.broadinstitute.sting.utils.MathUtils; +import org.broadinstitute.sting.utils.NGSPlatform; import org.broadinstitute.sting.utils.collections.Pair; import org.broadinstitute.sting.utils.exceptions.ReviewedStingException; @@ -217,7 +218,7 @@ public class ReadUtils { * @return checks the read group tag PL for the default 454 tag */ public static boolean is454Read(SAMRecord read) { - return isPlatformRead(read, "454"); + return NGSPlatform.fromRead(read) == NGSPlatform.LS454; } /** @@ -227,7 +228,7 @@ public class ReadUtils { * @return checks the read group tag PL for the default ion tag */ public static boolean isIonRead(SAMRecord read) { - return isPlatformRead(read, "IONTORRENT"); + return NGSPlatform.fromRead(read) == NGSPlatform.ION_TORRENT; } /** @@ -237,7 +238,7 @@ public class ReadUtils { * @return checks the read group tag PL for the default SOLiD tag */ public static boolean isSOLiDRead(SAMRecord read) { - return isPlatformRead(read, "SOLID"); + return NGSPlatform.fromRead(read) == NGSPlatform.SOLID; } /** @@ -246,8 +247,8 @@ public class ReadUtils { * @param read the read to test * @return checks the read group tag PL for the default SLX tag */ - public static boolean isSLXRead(SAMRecord read) { - return isPlatformRead(read, "ILLUMINA"); + public static boolean isIlluminaRead(SAMRecord read) { + return NGSPlatform.fromRead(read) == NGSPlatform.ILLUMINA; } /** @@ -259,6 +260,7 @@ public class ReadUtils { * @return whether or not name == PL tag in the read group of read */ public static boolean isPlatformRead(SAMRecord read, String name) { + SAMReadGroupRecord readGroup = read.getReadGroup(); if (readGroup != null) { Object readPlatformAttr = readGroup.getAttribute("PL"); From b093ba9dcc54bda5d5936cb8807010a563a90f3b Mon Sep 17 00:00:00 2001 From: Eric Banks Date: Wed, 6 Jun 2012 15:17:30 -0400 Subject: [PATCH 3/4] Stabilized NGSPlatform code: don't assume all reads have read groups (e.g. artificial SAM records) --- public/java/src/org/broadinstitute/sting/utils/NGSPlatform.java | 1 + 1 file changed, 1 insertion(+) diff --git a/public/java/src/org/broadinstitute/sting/utils/NGSPlatform.java b/public/java/src/org/broadinstitute/sting/utils/NGSPlatform.java index 597dc4803..504704e55 100644 --- a/public/java/src/org/broadinstitute/sting/utils/NGSPlatform.java +++ b/public/java/src/org/broadinstitute/sting/utils/NGSPlatform.java @@ -81,6 +81,7 @@ public enum NGSPlatform { * @return an NGSPlatform object matching the PL field of the header, of UNKNOWN if there was no match */ public static final NGSPlatform fromReadGroup(SAMReadGroupRecord rg) { + if ( rg == null ) return UNKNOWN; return fromReadGroupPL(rg.getPlatform()); } From bad50a1b05e7168a2c3af2c7af43a6398a9740d6 Mon Sep 17 00:00:00 2001 From: Eric Banks Date: Wed, 6 Jun 2012 22:45:38 -0400 Subject: [PATCH 4/4] Fix docs --- .../sting/gatk/walkers/indels/IndelRealigner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java index e12f26fcc..addfc5fab 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java @@ -103,7 +103,7 @@ import java.util.*; * -T IndelRealigner \ * -targetIntervals intervalListFromRTC.intervals \ * -o realignedBam.bam \ - * [--known /path/to/indels.vcf] \ + * [-known /path/to/indels.vcf] \ * [-compress 0] (this argument recommended to speed up the process *if* this is only a temporary file; otherwise, use the default value) * *