From 54f682a99c60a20ca10d4772d68a3562d9920dc6 Mon Sep 17 00:00:00 2001 From: Eric Banks Date: Wed, 6 Jun 2012 11:44:37 -0400 Subject: [PATCH] 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");