Add tile to ReadHashDatum, and implement TileCovariate
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2166 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
db40e28e54
commit
ac1b289d55
|
|
@ -18,6 +18,7 @@ import java.util.*;
|
|||
|
||||
import net.sf.samtools.SAMRecord;
|
||||
import net.sf.samtools.SAMReadGroupRecord;
|
||||
import edu.mit.broad.picard.illumina.parser.IlluminaUtil;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 The Broad Institute
|
||||
|
|
@ -237,7 +238,8 @@ public class CovariateCounterWalker extends LocusWalker<Integer, PrintStream> {
|
|||
logger.info( "The covariates being used here: " );
|
||||
logger.info( requestedCovariates );
|
||||
|
||||
if(estimatedCapacity > 300 * 40 * 200 * 16) { estimatedCapacity = 300 * 40 * 200 * 16; } // Don't want to crash with out of heap space exception
|
||||
if(estimatedCapacity > 300 * 40 * 200 * 16 || estimatedCapacity < 0) // could be negative if overflowed
|
||||
{ estimatedCapacity = 300 * 40 * 200 * 16; } // Don't want to crash with out of heap space exception
|
||||
dataManager = new RecalDataManager( estimatedCapacity );
|
||||
readDatumHashMap = new IdentityHashMap<SAMRecord, ReadHashDatum>();
|
||||
}
|
||||
|
|
@ -347,8 +349,8 @@ public class CovariateCounterWalker extends LocusWalker<Integer, PrintStream> {
|
|||
if( FORCE_PLATFORM != null ) {
|
||||
platform = FORCE_PLATFORM;
|
||||
}
|
||||
|
||||
readDatum = new ReadHashDatum( readGroupId, platform, quals, bases, isNegStrand, mappingQuality, length );
|
||||
Integer tile = IlluminaUtil.getTileFromReadName(read.getReadName());
|
||||
readDatum = new ReadHashDatum( readGroupId, platform, quals, bases, isNegStrand, mappingQuality, length, tile );
|
||||
readDatumHashMap.put( read, readDatum );
|
||||
sizeOfReadDatumHashMap++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,10 @@ public class ReadHashDatum {
|
|||
public boolean isNegStrand;
|
||||
public int mappingQuality;
|
||||
public int length;
|
||||
public Integer tile;
|
||||
|
||||
public ReadHashDatum(String _readGroup, String _platform, byte[] _quals, byte[] _bases, boolean _isNegStrand, int _mappingQuality, int _length) {
|
||||
public ReadHashDatum(String _readGroup, String _platform, byte[] _quals, byte[] _bases, boolean _isNegStrand,
|
||||
int _mappingQuality, int _length, Integer _tile) {
|
||||
readGroup = _readGroup;
|
||||
platform = _platform;
|
||||
quals = _quals;
|
||||
|
|
@ -22,6 +24,7 @@ public class ReadHashDatum {
|
|||
isNegStrand = _isNegStrand;
|
||||
mappingQuality = _mappingQuality;
|
||||
length = _length;
|
||||
tile = _tile;
|
||||
}
|
||||
|
||||
public ReadHashDatum(ReadHashDatum that) {
|
||||
|
|
@ -32,5 +35,6 @@ public class ReadHashDatum {
|
|||
this.isNegStrand = that.isNegStrand;
|
||||
this.mappingQuality = that.mappingQuality;
|
||||
this.length = that.length;
|
||||
this.tile = that.tile;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ import java.util.regex.Pattern;
|
|||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
import edu.mit.broad.picard.illumina.parser.IlluminaUtil;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 The Broad Institute
|
||||
*
|
||||
|
|
@ -332,7 +334,9 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
|||
platform = FORCE_PLATFORM;
|
||||
}
|
||||
|
||||
ReadHashDatum readDatum = new ReadHashDatum( readGroupId, platform, originalQuals, bases, isNegStrand, read.getMappingQuality(), bases.length );
|
||||
Integer tile = IlluminaUtil.getTileFromReadName(read.getReadName());
|
||||
ReadHashDatum readDatum = new ReadHashDatum( readGroupId, platform, originalQuals, bases, isNegStrand,
|
||||
read.getMappingQuality(), bases.length, tile );
|
||||
|
||||
// For each base in the read
|
||||
for( int iii = startPos; iii < stopPos; iii++ ) { // Skip first or last base because there is no dinuc depending on the direction of the read
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* The MIT License
|
||||
*
|
||||
* Copyright (c) 2009 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.gatk.walkers.recalibration;
|
||||
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
|
||||
/**
|
||||
* @author alecw@broadinstitute.org
|
||||
*/
|
||||
public class TileCovariate implements Covariate {
|
||||
public Comparable getValue(final ReadHashDatum readDatum, final int offset) {
|
||||
if (readDatum.tile == null) {
|
||||
throw new StingException("Tile number not defined for read");
|
||||
}
|
||||
return readDatum.tile;
|
||||
}
|
||||
|
||||
public Comparable getValue(final String str) {
|
||||
return Integer.parseInt( str );
|
||||
}
|
||||
|
||||
public int estimatedNumberOfBins() {
|
||||
return 120;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue