Renamed GATKSamRecord -> GATKSAMRecord for consistency. Better docs.
This commit is contained in:
parent
110e13bc1e
commit
2403e96062
|
|
@ -39,7 +39,7 @@ import org.broadinstitute.sting.utils.pileup.ExtendedEventPileupElement;
|
||||||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||||
import org.broadinstitute.sting.utils.pileup.ReadBackedExtendedEventPileup;
|
import org.broadinstitute.sting.utils.pileup.ReadBackedExtendedEventPileup;
|
||||||
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
||||||
import org.broadinstitute.sting.utils.sam.GATKSamRecord;
|
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||||
import org.broadinstitute.sting.utils.sam.ReadUtils;
|
import org.broadinstitute.sting.utils.sam.ReadUtils;
|
||||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||||
|
|
@ -125,7 +125,7 @@ public class IndelGenotypeLikelihoodsCalculationModel extends GenotypeLikelihood
|
||||||
|
|
||||||
for ( ExtendedEventPileupElement p : indelPileup.toExtendedIterable() ) {
|
for ( ExtendedEventPileupElement p : indelPileup.toExtendedIterable() ) {
|
||||||
//SAMRecord read = p.getRead();
|
//SAMRecord read = p.getRead();
|
||||||
GATKSamRecord read = ReadUtils.hardClipAdaptorSequence(p.getRead());
|
GATKSAMRecord read = ReadUtils.hardClipAdaptorSequence(p.getRead());
|
||||||
if (read == null)
|
if (read == null)
|
||||||
continue;
|
continue;
|
||||||
if(ReadUtils.is454Read(read)) {
|
if(ReadUtils.is454Read(read)) {
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ import org.broadinstitute.sting.utils.collections.NestedHashMap;
|
||||||
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||||
import org.broadinstitute.sting.utils.sam.GATKSamRecord;
|
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -352,7 +352,7 @@ public class CountCovariatesWalker extends LocusWalker<CountCovariatesWalker.Cou
|
||||||
if( tracker.getValues(knownSites).size() == 0 ) { // If something here is in one of the knownSites tracks then skip over it, otherwise proceed
|
if( tracker.getValues(knownSites).size() == 0 ) { // If something here is in one of the knownSites tracks then skip over it, otherwise proceed
|
||||||
// For each read at this locus
|
// For each read at this locus
|
||||||
for( final PileupElement p : context.getBasePileup() ) {
|
for( final PileupElement p : context.getBasePileup() ) {
|
||||||
final GATKSamRecord gatkRead = (GATKSamRecord) p.getRead();
|
final GATKSAMRecord gatkRead = (GATKSAMRecord) p.getRead();
|
||||||
int offset = p.getOffset();
|
int offset = p.getOffset();
|
||||||
|
|
||||||
if( gatkRead.containsTemporaryAttribute( SKIP_RECORD_ATTRIBUTE ) ) {
|
if( gatkRead.containsTemporaryAttribute( SKIP_RECORD_ATTRIBUTE ) ) {
|
||||||
|
|
@ -445,7 +445,7 @@ public class CountCovariatesWalker extends LocusWalker<CountCovariatesWalker.Cou
|
||||||
* @param offset The offset in the read for this locus
|
* @param offset The offset in the read for this locus
|
||||||
* @param refBase The reference base at this locus
|
* @param refBase The reference base at this locus
|
||||||
*/
|
*/
|
||||||
private void updateDataFromRead(CountedData counter, final GATKSamRecord gatkRead, final int offset, final byte refBase) {
|
private void updateDataFromRead(CountedData counter, final GATKSAMRecord gatkRead, final int offset, final byte refBase) {
|
||||||
final Object[][] covars = (Comparable[][]) gatkRead.getTemporaryAttribute(COVARS_ATTRIBUTE);
|
final Object[][] covars = (Comparable[][]) gatkRead.getTemporaryAttribute(COVARS_ATTRIBUTE);
|
||||||
final Object[] key = covars[offset];
|
final Object[] key = covars[offset];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import net.sf.samtools.SAMRecord;
|
||||||
import org.broadinstitute.sting.utils.BaseUtils;
|
import org.broadinstitute.sting.utils.BaseUtils;
|
||||||
import org.broadinstitute.sting.utils.NGSPlatform;
|
import org.broadinstitute.sting.utils.NGSPlatform;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.sam.GATKSamRecord;
|
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
@ -71,7 +71,7 @@ public class CycleCovariate implements StandardCovariate {
|
||||||
// Illumina, Solid, PacBio, and Complete Genomics
|
// Illumina, Solid, PacBio, and Complete Genomics
|
||||||
//-----------------------------
|
//-----------------------------
|
||||||
|
|
||||||
final NGSPlatform ngsPlatform = ((GATKSamRecord)read).getNGSPlatform();
|
final NGSPlatform ngsPlatform = ((GATKSAMRecord)read).getNGSPlatform();
|
||||||
if( DISCRETE_CYCLE_PLATFORMS.contains(ngsPlatform) ) {
|
if( DISCRETE_CYCLE_PLATFORMS.contains(ngsPlatform) ) {
|
||||||
final int init;
|
final int init;
|
||||||
final int increment;
|
final int increment;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
||||||
import org.broadinstitute.sting.utils.sam.GATKSAMReadGroupRecord;
|
import org.broadinstitute.sting.utils.sam.GATKSAMReadGroupRecord;
|
||||||
import org.broadinstitute.sting.utils.sam.GATKSamRecord;
|
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -229,7 +229,7 @@ public class RecalDataManager {
|
||||||
* @param RAC The list of shared command line arguments
|
* @param RAC The list of shared command line arguments
|
||||||
*/
|
*/
|
||||||
public static void parseSAMRecord( final SAMRecord read, final RecalibrationArgumentCollection RAC ) {
|
public static void parseSAMRecord( final SAMRecord read, final RecalibrationArgumentCollection RAC ) {
|
||||||
GATKSAMReadGroupRecord readGroup = ((GATKSamRecord)read).getReadGroup();
|
GATKSAMReadGroupRecord readGroup = ((GATKSAMRecord)read).getReadGroup();
|
||||||
|
|
||||||
// If there are no read groups we have to default to something, and that something could be specified by the user using command line arguments
|
// If there are no read groups we have to default to something, and that something could be specified by the user using command line arguments
|
||||||
if( readGroup == null ) {
|
if( readGroup == null ) {
|
||||||
|
|
@ -243,7 +243,7 @@ public class RecalDataManager {
|
||||||
// There is no readGroup so defaulting to these values
|
// There is no readGroup so defaulting to these values
|
||||||
readGroup = new GATKSAMReadGroupRecord( RAC.DEFAULT_READ_GROUP );
|
readGroup = new GATKSAMReadGroupRecord( RAC.DEFAULT_READ_GROUP );
|
||||||
readGroup.setPlatform( RAC.DEFAULT_PLATFORM );
|
readGroup.setPlatform( RAC.DEFAULT_PLATFORM );
|
||||||
((GATKSamRecord)read).setReadGroup( readGroup );
|
((GATKSAMRecord)read).setReadGroup( readGroup );
|
||||||
} else {
|
} else {
|
||||||
throw new UserException.MalformedBAM(read, "The input .bam file contains reads with no read group. First observed at read with name = " + read.getReadName() );
|
throw new UserException.MalformedBAM(read, "The input .bam file contains reads with no read group. First observed at read with name = " + read.getReadName() );
|
||||||
}
|
}
|
||||||
|
|
@ -253,7 +253,7 @@ public class RecalDataManager {
|
||||||
final String oldPlatform = readGroup.getPlatform();
|
final String oldPlatform = readGroup.getPlatform();
|
||||||
readGroup = new GATKSAMReadGroupRecord( RAC.FORCE_READ_GROUP );
|
readGroup = new GATKSAMReadGroupRecord( RAC.FORCE_READ_GROUP );
|
||||||
readGroup.setPlatform( oldPlatform );
|
readGroup.setPlatform( oldPlatform );
|
||||||
((GATKSamRecord)read).setReadGroup( readGroup );
|
((GATKSAMRecord)read).setReadGroup( readGroup );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( RAC.FORCE_PLATFORM != null && (readGroup.getPlatform() == null || !readGroup.getPlatform().equals(RAC.FORCE_PLATFORM))) {
|
if( RAC.FORCE_PLATFORM != null && (readGroup.getPlatform() == null || !readGroup.getPlatform().equals(RAC.FORCE_PLATFORM))) {
|
||||||
|
|
@ -572,7 +572,7 @@ public class RecalDataManager {
|
||||||
* value for the ith position in the read and the jth covariate in
|
* value for the ith position in the read and the jth covariate in
|
||||||
* reqeustedCovariates list.
|
* reqeustedCovariates list.
|
||||||
*/
|
*/
|
||||||
public static Comparable[][] computeCovariates(final GATKSamRecord gatkRead, final List<Covariate> requestedCovariates) {
|
public static Comparable[][] computeCovariates(final GATKSAMRecord gatkRead, final List<Covariate> requestedCovariates) {
|
||||||
//compute all covariates for this read
|
//compute all covariates for this read
|
||||||
final List<Covariate> requestedCovariatesRef = requestedCovariates;
|
final List<Covariate> requestedCovariatesRef = requestedCovariates;
|
||||||
final int numRequestedCovariates = requestedCovariatesRef.size();
|
final int numRequestedCovariates = requestedCovariatesRef.size();
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ import org.broadinstitute.sting.utils.classloader.PluginManager;
|
||||||
import org.broadinstitute.sting.utils.collections.NestedHashMap;
|
import org.broadinstitute.sting.utils.collections.NestedHashMap;
|
||||||
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.sam.GATKSamRecord;
|
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||||
import org.broadinstitute.sting.utils.text.TextFormattingUtils;
|
import org.broadinstitute.sting.utils.text.TextFormattingUtils;
|
||||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||||
|
|
||||||
|
|
@ -398,7 +398,7 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
||||||
|
|
||||||
//compute all covariate values for this read
|
//compute all covariate values for this read
|
||||||
final Comparable[][] covariateValues_offset_x_covar =
|
final Comparable[][] covariateValues_offset_x_covar =
|
||||||
RecalDataManager.computeCovariates((GATKSamRecord) read, requestedCovariates);
|
RecalDataManager.computeCovariates((GATKSAMRecord) read, requestedCovariates);
|
||||||
|
|
||||||
// For each base in the read
|
// For each base in the read
|
||||||
for( int offset = 0; offset < read.getReadLength(); offset++ ) {
|
for( int offset = 0; offset < read.getReadLength(); offset++ ) {
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ import net.sf.samtools.SAMRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A canonical, master list of the standard NGS platforms. These values
|
* A canonical, master list of the standard NGS platforms. These values
|
||||||
* can be obtained (efficiently) from a GATKSamRecord object with the
|
* can be obtained (efficiently) from a GATKSAMRecord object with the
|
||||||
* getNGSPlatform method.
|
* getNGSPlatform method.
|
||||||
*
|
*
|
||||||
* @author Mark DePristo
|
* @author Mark DePristo
|
||||||
|
|
@ -65,7 +65,7 @@ public enum NGSPlatform {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience constructor -- calculates the NGSPlatfrom from a SAMRecord.
|
* Convenience constructor -- calculates the NGSPlatfrom from a SAMRecord.
|
||||||
* Note you should not use this function if you have a GATKSamRecord -- use the
|
* Note you should not use this function if you have a GATKSAMRecord -- use the
|
||||||
* accessor method instead.
|
* accessor method instead.
|
||||||
*
|
*
|
||||||
* @param read
|
* @param read
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ public class ArtificialSAMUtils {
|
||||||
if( (refIndex == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX && alignmentStart != SAMRecord.NO_ALIGNMENT_START) ||
|
if( (refIndex == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX && alignmentStart != SAMRecord.NO_ALIGNMENT_START) ||
|
||||||
(refIndex != SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX && alignmentStart == SAMRecord.NO_ALIGNMENT_START) )
|
(refIndex != SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX && alignmentStart == SAMRecord.NO_ALIGNMENT_START) )
|
||||||
throw new ReviewedStingException("Invalid alignment start for artificial read, start = " + alignmentStart);
|
throw new ReviewedStingException("Invalid alignment start for artificial read, start = " + alignmentStart);
|
||||||
SAMRecord record = new GATKSamRecord(header);
|
SAMRecord record = new GATKSAMRecord(header);
|
||||||
record.setReadName(name);
|
record.setReadName(name);
|
||||||
record.setReferenceIndex(refIndex);
|
record.setReferenceIndex(refIndex);
|
||||||
record.setAlignmentStart(alignmentStart);
|
record.setAlignmentStart(alignmentStart);
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,27 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2011, 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.sting.utils.sam;
|
package org.broadinstitute.sting.utils.sam;
|
||||||
|
|
||||||
import net.sf.samtools.*;
|
import net.sf.samtools.*;
|
||||||
|
|
@ -7,23 +31,17 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ebanks
|
* @author ebanks, depristo
|
||||||
* GATKSAMRecord
|
* GATKSAMRecord
|
||||||
*
|
*
|
||||||
* this class extends the samtools SAMRecord class and caches important
|
* this class extends the samtools BAMRecord class (and SAMRecord) and caches important
|
||||||
* (and oft-accessed) data that's not already cached by the SAMRecord class
|
* (and oft-accessed) data that's not already cached by the SAMRecord class
|
||||||
*
|
*
|
||||||
* IMPORTANT NOTE: Because ReadGroups are not set through the SAMRecord,
|
* IMPORTANT NOTE: Because ReadGroups are not set through the SAMRecord,
|
||||||
* if they are ever modified externally then one must also invoke the
|
* if they are ever modified externally then one must also invoke the
|
||||||
* setReadGroup() method here to ensure that the cache is kept up-to-date.
|
* setReadGroup() method here to ensure that the cache is kept up-to-date.
|
||||||
*
|
|
||||||
* 13 Oct 2010 - mhanna - this class is fundamentally flawed: it uses a decorator
|
|
||||||
* pattern to wrap a heavyweight object, which can lead
|
|
||||||
* to heinous side effects if the wrapping is not carefully
|
|
||||||
* done. Hopefully SAMRecord will become an interface and
|
|
||||||
* this will eventually be fixed.
|
|
||||||
*/
|
*/
|
||||||
public class GATKSamRecord extends BAMRecord {
|
public class GATKSAMRecord extends BAMRecord {
|
||||||
// the SAMRecord data we're caching
|
// the SAMRecord data we're caching
|
||||||
private String mReadString = null;
|
private String mReadString = null;
|
||||||
private GATKSAMReadGroupRecord mReadGroup = null;
|
private GATKSAMReadGroupRecord mReadGroup = null;
|
||||||
|
|
@ -41,13 +59,12 @@ public class GATKSamRecord extends BAMRecord {
|
||||||
* HACK TO CREATE GATKSAMRECORD WITH ONLY A HEADER FOR TESTING PURPOSES ONLY
|
* HACK TO CREATE GATKSAMRECORD WITH ONLY A HEADER FOR TESTING PURPOSES ONLY
|
||||||
* @param header
|
* @param header
|
||||||
*/
|
*/
|
||||||
public GATKSamRecord(final SAMFileHeader header) {
|
public GATKSAMRecord(final SAMFileHeader header) {
|
||||||
super(header, SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX, SAMRecord.NO_ALIGNMENT_START,
|
super(header, SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX, SAMRecord.NO_ALIGNMENT_START,
|
||||||
(short)0, (short)255, 0, 1, 0, 1, 0, 0, 0, null);
|
(short)0, (short)255, 0, 1, 0, 1, 0, 0, 0, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GATKSAMRecord(final SAMFileHeader header,
|
||||||
public GATKSamRecord(final SAMFileHeader header,
|
|
||||||
final int referenceSequenceIndex,
|
final int referenceSequenceIndex,
|
||||||
final int alignmentStart,
|
final int alignmentStart,
|
||||||
final short readNameLength,
|
final short readNameLength,
|
||||||
|
|
@ -91,6 +108,10 @@ public class GATKSamRecord extends BAMRecord {
|
||||||
return mReadGroup;
|
return mReadGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Efficient caching accessor that returns the GATK NGSPlatform of this read
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public NGSPlatform getNGSPlatform() {
|
public NGSPlatform getNGSPlatform() {
|
||||||
return getReadGroup().getNGSPlatform();
|
return getReadGroup().getNGSPlatform();
|
||||||
}
|
}
|
||||||
|
|
@ -153,12 +174,16 @@ public class GATKSamRecord extends BAMRecord {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return super.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
|
|
||||||
// note -- this forbids a GATKSAMRecord being equal to its underlying SAMRecord
|
if (!(o instanceof GATKSAMRecord)) return false;
|
||||||
if (!(o instanceof GATKSamRecord)) return false;
|
|
||||||
|
|
||||||
// note that we do not consider the GATKSAMRecord internal state at all
|
// note that we do not consider the GATKSAMRecord internal state at all
|
||||||
return super.equals(o);
|
return super.equals(o);
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ public class GATKSamRecordFactory implements SAMRecordFactory {
|
||||||
final int mateAlignmentStart,
|
final int mateAlignmentStart,
|
||||||
final int insertSize,
|
final int insertSize,
|
||||||
final byte[] variableLengthBlock) {
|
final byte[] variableLengthBlock) {
|
||||||
return new GATKSamRecord(header,
|
return new GATKSAMRecord(header,
|
||||||
referenceSequenceIndex,
|
referenceSequenceIndex,
|
||||||
alignmentStart,
|
alignmentStart,
|
||||||
readNameLength,
|
readNameLength,
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ public class ReadUtils {
|
||||||
public static final String REDUCED_READ_CONSENSUS_COUNTS_TAG = "CC";
|
public static final String REDUCED_READ_CONSENSUS_COUNTS_TAG = "CC";
|
||||||
|
|
||||||
public final static byte[] getReducedReadQualityTagValue(final SAMRecord read) {
|
public final static byte[] getReducedReadQualityTagValue(final SAMRecord read) {
|
||||||
// TODO -- warning of performance problem. Should be cached in GATKSamRecord
|
// TODO -- warning of performance problem. Should be cached in GATKSAMRecord
|
||||||
return read.getByteArrayAttribute(ReadUtils.REDUCED_READ_QUALITY_TAG);
|
return read.getByteArrayAttribute(ReadUtils.REDUCED_READ_QUALITY_TAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -260,10 +260,10 @@ public class ReadUtils {
|
||||||
* @param adaptorLength length of adaptor sequence
|
* @param adaptorLength length of adaptor sequence
|
||||||
* @return a new read with adaptor sequence hard-clipped out or null if read is fully clipped
|
* @return a new read with adaptor sequence hard-clipped out or null if read is fully clipped
|
||||||
*/
|
*/
|
||||||
public static GATKSamRecord hardClipAdaptorSequence(final SAMRecord rec, int adaptorLength) {
|
public static GATKSAMRecord hardClipAdaptorSequence(final SAMRecord rec, int adaptorLength) {
|
||||||
|
|
||||||
Pair<Integer, Integer> adaptorBoundaries = getAdaptorBoundaries(rec, adaptorLength);
|
Pair<Integer, Integer> adaptorBoundaries = getAdaptorBoundaries(rec, adaptorLength);
|
||||||
GATKSamRecord result = (GATKSamRecord)rec;
|
GATKSAMRecord result = (GATKSAMRecord)rec;
|
||||||
|
|
||||||
if ( adaptorBoundaries != null ) {
|
if ( adaptorBoundaries != null ) {
|
||||||
if ( rec.getReadNegativeStrandFlag() && adaptorBoundaries.second >= rec.getAlignmentStart() && adaptorBoundaries.first < rec.getAlignmentEnd() )
|
if ( rec.getReadNegativeStrandFlag() && adaptorBoundaries.second >= rec.getAlignmentStart() && adaptorBoundaries.first < rec.getAlignmentEnd() )
|
||||||
|
|
@ -276,7 +276,7 @@ public class ReadUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
// return true if the read needs to be completely clipped
|
// return true if the read needs to be completely clipped
|
||||||
private static GATKSamRecord hardClipStartOfRead(SAMRecord oldRec, int stopPosition) {
|
private static GATKSAMRecord hardClipStartOfRead(SAMRecord oldRec, int stopPosition) {
|
||||||
|
|
||||||
if ( stopPosition >= oldRec.getAlignmentEnd() ) {
|
if ( stopPosition >= oldRec.getAlignmentEnd() ) {
|
||||||
// BAM representation issue -- we can't clip away all bases in a read, just leave it alone and let the filter deal with it
|
// BAM representation issue -- we can't clip away all bases in a read, just leave it alone and let the filter deal with it
|
||||||
|
|
@ -284,9 +284,9 @@ public class ReadUtils {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
GATKSamRecord rec;
|
GATKSAMRecord rec;
|
||||||
try {
|
try {
|
||||||
rec = (GATKSamRecord)oldRec.clone();
|
rec = (GATKSAMRecord)oldRec.clone();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -356,7 +356,7 @@ public class ReadUtils {
|
||||||
return rec;
|
return rec;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static GATKSamRecord hardClipEndOfRead(SAMRecord oldRec, int startPosition) {
|
private static GATKSAMRecord hardClipEndOfRead(SAMRecord oldRec, int startPosition) {
|
||||||
|
|
||||||
if ( startPosition <= oldRec.getAlignmentStart() ) {
|
if ( startPosition <= oldRec.getAlignmentStart() ) {
|
||||||
// BAM representation issue -- we can't clip away all bases in a read, just leave it alone and let the filter deal with it
|
// BAM representation issue -- we can't clip away all bases in a read, just leave it alone and let the filter deal with it
|
||||||
|
|
@ -364,9 +364,9 @@ public class ReadUtils {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
GATKSamRecord rec;
|
GATKSAMRecord rec;
|
||||||
try {
|
try {
|
||||||
rec = (GATKSamRecord)oldRec.clone();
|
rec = (GATKSAMRecord)oldRec.clone();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -584,7 +584,7 @@ public class ReadUtils {
|
||||||
* @param rec original SAM record
|
* @param rec original SAM record
|
||||||
* @return a new read with adaptor sequence hard-clipped out or null if read is fully clipped
|
* @return a new read with adaptor sequence hard-clipped out or null if read is fully clipped
|
||||||
*/
|
*/
|
||||||
public static GATKSamRecord hardClipAdaptorSequence(final SAMRecord rec) {
|
public static GATKSAMRecord hardClipAdaptorSequence(final SAMRecord rec) {
|
||||||
return hardClipAdaptorSequence(rec, DEFAULT_ADAPTOR_SIZE);
|
return hardClipAdaptorSequence(rec, DEFAULT_ADAPTOR_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue