Unify to NGSPlatform framework. TechnologyComposition annotation now generalizes to Illumina and not just SLX.

This commit is contained in:
Eric Banks 2012-06-06 11:44:37 -04:00
parent dd46d843fb
commit 54f682a99c
2 changed files with 13 additions and 11 deletions

View File

@ -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<String, Object> map = new HashMap<String, Object>();
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<String> getKeyNames() { return Arrays.asList(nSLX,n454,nSolid,nOther); }
public List<String> getKeyNames() { return Arrays.asList(nIllumina,n454,nSolid,nOther); }
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(nSLX, 1, VCFHeaderLineType.Integer, "Number of SLX reads"),
public List<VCFInfoHeaderLine> 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")); }

View File

@ -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");