Merge pull request #770 from broadinstitute/pd_ngs_platform
Moved platform flow information into NGSPlatform
This commit is contained in:
commit
f93b5b2c39
|
|
@ -55,11 +55,10 @@ import org.broadinstitute.gatk.engine.recalibration.ReadCovariates;
|
||||||
import org.broadinstitute.gatk.engine.recalibration.RecalibrationArgumentCollection;
|
import org.broadinstitute.gatk.engine.recalibration.RecalibrationArgumentCollection;
|
||||||
import org.broadinstitute.gatk.utils.BaseUtils;
|
import org.broadinstitute.gatk.utils.BaseUtils;
|
||||||
import org.broadinstitute.gatk.utils.NGSPlatform;
|
import org.broadinstitute.gatk.utils.NGSPlatform;
|
||||||
|
import org.broadinstitute.gatk.utils.SequencerFlowClass;
|
||||||
import org.broadinstitute.gatk.utils.exceptions.UserException;
|
import org.broadinstitute.gatk.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.gatk.utils.sam.GATKSAMRecord;
|
import org.broadinstitute.gatk.utils.sam.GATKSAMRecord;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 The Broad Institute
|
* Copyright (c) 2009 The Broad Institute
|
||||||
*
|
*
|
||||||
|
|
@ -104,9 +103,6 @@ public class CycleCovariate implements StandardCovariate {
|
||||||
public static final int CUSHION_FOR_INDELS = 4;
|
public static final int CUSHION_FOR_INDELS = 4;
|
||||||
private String default_platform = null;
|
private String default_platform = null;
|
||||||
|
|
||||||
private static final EnumSet<NGSPlatform> DISCRETE_CYCLE_PLATFORMS = EnumSet.of(NGSPlatform.ILLUMINA, NGSPlatform.SOLID, NGSPlatform.PACBIO, NGSPlatform.COMPLETE_GENOMICS);
|
|
||||||
private static final EnumSet<NGSPlatform> FLOW_CYCLE_PLATFORMS = EnumSet.of(NGSPlatform.LS454, NGSPlatform.ION_TORRENT);
|
|
||||||
|
|
||||||
// Initialize any member variables using the command-line arguments passed to the walkers
|
// Initialize any member variables using the command-line arguments passed to the walkers
|
||||||
@Override
|
@Override
|
||||||
public void initialize(final RecalibrationArgumentCollection RAC) {
|
public void initialize(final RecalibrationArgumentCollection RAC) {
|
||||||
|
|
@ -126,7 +122,7 @@ public class CycleCovariate implements StandardCovariate {
|
||||||
final NGSPlatform ngsPlatform = default_platform == null ? read.getNGSPlatform() : NGSPlatform.fromReadGroupPL(default_platform);
|
final NGSPlatform ngsPlatform = default_platform == null ? read.getNGSPlatform() : NGSPlatform.fromReadGroupPL(default_platform);
|
||||||
|
|
||||||
// Discrete cycle platforms
|
// Discrete cycle platforms
|
||||||
if (DISCRETE_CYCLE_PLATFORMS.contains(ngsPlatform)) {
|
if (ngsPlatform.getSequencerType() == SequencerFlowClass.DISCRETE) {
|
||||||
final int readOrderFactor = read.getReadPairedFlag() && read.getSecondOfPairFlag() ? -1 : 1;
|
final int readOrderFactor = read.getReadPairedFlag() && read.getSecondOfPairFlag() ? -1 : 1;
|
||||||
final int increment;
|
final int increment;
|
||||||
int cycle;
|
int cycle;
|
||||||
|
|
@ -149,7 +145,7 @@ public class CycleCovariate implements StandardCovariate {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flow cycle platforms
|
// Flow cycle platforms
|
||||||
else if (FLOW_CYCLE_PLATFORMS.contains(ngsPlatform)) {
|
else if (ngsPlatform.getSequencerType() == SequencerFlowClass.FLOW) {
|
||||||
|
|
||||||
final byte[] bases = read.getReadBases();
|
final byte[] bases = read.getReadBases();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ package org.broadinstitute.gatk.utils;
|
||||||
import org.broadinstitute.gatk.utils.sam.GATKSAMReadGroupRecord;
|
import org.broadinstitute.gatk.utils.sam.GATKSAMReadGroupRecord;
|
||||||
import org.broadinstitute.gatk.utils.sam.GATKSAMRecord;
|
import org.broadinstitute.gatk.utils.sam.GATKSAMRecord;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -42,38 +43,48 @@ import java.util.List;
|
||||||
public enum NGSPlatform {
|
public enum NGSPlatform {
|
||||||
// note the order of elements here determines the order of matching operations, and therefore the
|
// note the order of elements here determines the order of matching operations, and therefore the
|
||||||
// efficiency of getting a NGSPlatform from a string.
|
// efficiency of getting a NGSPlatform from a string.
|
||||||
ILLUMINA("ILLUMINA", "SLX", "SOLEXA"),
|
ILLUMINA(SequencerFlowClass.DISCRETE, "ILLUMINA", "SLX", "SOLEXA"),
|
||||||
SOLID("SOLID"),
|
SOLID(SequencerFlowClass.DISCRETE, "SOLID"),
|
||||||
LS454("454"),
|
LS454(SequencerFlowClass.FLOW, "454", "LS454"),
|
||||||
COMPLETE_GENOMICS("COMPLETE"),
|
COMPLETE_GENOMICS(SequencerFlowClass.DISCRETE, "COMPLETE"),
|
||||||
PACBIO("PACBIO"),
|
PACBIO(SequencerFlowClass.DISCRETE, "PACBIO"),
|
||||||
ION_TORRENT("IONTORRENT"),
|
ION_TORRENT(SequencerFlowClass.FLOW, "IONTORRENT"),
|
||||||
CAPILLARY("CAPILLARY"),
|
CAPILLARY(SequencerFlowClass.OTHER, "CAPILLARY"),
|
||||||
HELICOS("HELICOS"),
|
HELICOS(SequencerFlowClass.OTHER, "HELICOS"),
|
||||||
UNKNOWN("UNKNOWN");
|
UNKNOWN(SequencerFlowClass.OTHER, "UNKNOWN");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of the prefix names in a BAM file for each of the platforms.
|
* Array of the prefix names in a BAM file for each of the platforms.
|
||||||
*/
|
*/
|
||||||
protected final String[] BAM_PL_NAMES;
|
protected final String[] BAM_PL_NAMES;
|
||||||
|
protected final SequencerFlowClass sequencerType;
|
||||||
|
|
||||||
NGSPlatform(final String... BAM_PL_NAMES) {
|
NGSPlatform(final SequencerFlowClass type, final String... BAM_PL_NAMES) {
|
||||||
if ( BAM_PL_NAMES.length == 0 ) throw new IllegalStateException("Platforms must have at least one name");
|
if ( BAM_PL_NAMES.length == 0 ) throw new IllegalStateException("Platforms must have at least one name");
|
||||||
|
|
||||||
for ( int i = 0; i < BAM_PL_NAMES.length; i++ )
|
for ( int i = 0; i < BAM_PL_NAMES.length; i++ )
|
||||||
BAM_PL_NAMES[i] = BAM_PL_NAMES[i].toUpperCase();
|
BAM_PL_NAMES[i] = BAM_PL_NAMES[i].toUpperCase();
|
||||||
|
|
||||||
this.BAM_PL_NAMES = BAM_PL_NAMES;
|
this.BAM_PL_NAMES = BAM_PL_NAMES;
|
||||||
|
this.sequencerType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a representative PL string for this platform
|
* Returns a representative PL string for this platform
|
||||||
* @return
|
* @return a representative PL string
|
||||||
*/
|
*/
|
||||||
public final String getDefaultPlatform() {
|
public final String getDefaultPlatform() {
|
||||||
return BAM_PL_NAMES[0];
|
return BAM_PL_NAMES[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The broad "type" of sequencer this platform represents (discrete or flow)
|
||||||
|
* @return a SequencerFlowClass
|
||||||
|
*/
|
||||||
|
public final SequencerFlowClass getSequencerType() {
|
||||||
|
return sequencerType;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience get -- get the NGSPlatform from a GATKSAMRecord.
|
* Convenience get -- get the NGSPlatform from a GATKSAMRecord.
|
||||||
*
|
*
|
||||||
|
|
@ -126,10 +137,9 @@ public enum NGSPlatform {
|
||||||
* @return the list of platform names
|
* @return the list of platform names
|
||||||
*/
|
*/
|
||||||
public static String knownPlatformsString() {
|
public static String knownPlatformsString() {
|
||||||
final List<String> names = new LinkedList<String>();
|
final List<String> names = new LinkedList<>();
|
||||||
for ( final NGSPlatform pl : values() ) {
|
for ( final NGSPlatform pl : values() ) {
|
||||||
for ( final String name : pl.BAM_PL_NAMES )
|
names.addAll(Arrays.asList(pl.BAM_PL_NAMES));
|
||||||
names.add(name);
|
|
||||||
}
|
}
|
||||||
return Utils.join(",", names);
|
return Utils.join(",", names);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2012 The Broad Institute
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person
|
||||||
|
* obtaining a copy of this software and associated documentation
|
||||||
|
* files (the "Software"), to deal in the Software without
|
||||||
|
* restriction, including without limitation the rights to use,
|
||||||
|
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following
|
||||||
|
* conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be
|
||||||
|
* included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||||
|
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.broadinstitute.gatk.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In broad terms, each sequencing platform can be classified by whether it flows nucleotides in some order
|
||||||
|
* such that homopolymers get sequenced in a single event (ie 454 or Ion) or it reads each position in the
|
||||||
|
* sequence one at a time, regardless of base composition (Illumina or Solid). This information is primarily
|
||||||
|
* useful in the BQSR process
|
||||||
|
*/
|
||||||
|
public enum SequencerFlowClass {
|
||||||
|
DISCRETE,
|
||||||
|
FLOW,
|
||||||
|
OTHER //Catch-all for unknown platforms, as well as relics that GATK doesn't handle well (Capillary, Helicos)
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue