Add hidden command-line argument for low-memory sharding.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5355 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2011-03-02 15:13:16 +00:00
parent ae42c0c7da
commit 5e4b321f86
5 changed files with 37 additions and 8 deletions

View File

@ -836,6 +836,9 @@ public class GenomeAnalysisEngine {
if ( getWalkerBAQApplicationTime() == BAQ.ApplicationTime.FORBIDDEN && argCollection.BAQMode != BAQ.CalculationMode.OFF)
throw new UserException.BadArgumentValue("baq", "Walker cannot accept BAQ'd base qualities, and yet BAQ mode " + argCollection.BAQMode + " was requested.");
// TEMPORARY: Force low-memory sharding to be available.
SAMDataSource.enableLowMemorySharding(argCollection.enableLowMemorySharding);
return new SAMDataSource(
samReaderIDs,
genomeLocParser,

View File

@ -238,10 +238,14 @@ public class GATKArgumentCollection {
public int processTrackerID = -1;
@Element(required = false)
@Argument(fullName="allow_intervals_with_unindexed_bam",doc="Allow interval processing with an unsupported BAM. NO INTEGRATION TESTS are available. Use at your own risk.")
@Argument(fullName="allow_intervals_with_unindexed_bam",doc="Allow interval processing with an unsupported BAM. NO INTEGRATION TESTS are available. Use at your own risk.",required=false)
@Hidden
public boolean allowIntervalsWithUnindexedBAM = false;
@Element(required = false)
@Argument(fullName="enable_experimental_low_memory_sharding",doc="Enable experimental low-memory sharding functionality. Use at your own risk.",required=false)
public boolean enableLowMemorySharding = false;
// --------------------------------------------------------------------------------------------------------------
//
// methods
@ -428,6 +432,9 @@ public class GATKArgumentCollection {
if (allowIntervalsWithUnindexedBAM != other.allowIntervalsWithUnindexedBAM)
return false;
if (enableLowMemorySharding != other.enableLowMemorySharding)
return false;
return true;
}

View File

@ -83,7 +83,7 @@ public class LocusShardStrategy implements ShardStrategy {
else
intervals = locations;
if(SAMDataSource.TRY_LOW_MEMORY_SHARDING)
if(SAMDataSource.isLowMemoryShardingEnabled())
this.filePointerIterator = new LowMemoryIntervalSharder(this.reads,intervals);
else
this.filePointerIterator = IntervalSharder.shardIntervals(this.reads,intervals);

View File

@ -96,7 +96,7 @@ public class ReadShardStrategy implements ShardStrategy {
this.locations = locations;
if(locations != null)
filePointerIterator = SAMDataSource.TRY_LOW_MEMORY_SHARDING ? new LowMemoryIntervalSharder(this.dataSource,locations) : IntervalSharder.shardIntervals(this.dataSource,locations);
filePointerIterator = SAMDataSource.isLowMemoryShardingEnabled() ? new LowMemoryIntervalSharder(this.dataSource,locations) : IntervalSharder.shardIntervals(this.dataSource,locations);
else
filePointerIterator = filePointers.iterator();

View File

@ -128,7 +128,10 @@ public class SAMDataSource {
*/
private final SAMResourcePool resourcePool;
static final boolean TRY_LOW_MEMORY_SHARDING = false;
/**
* Whether to enable the new low-memory sharding mechanism.
*/
private static boolean enableLowMemorySharding = false;
/**
* Create a new SAM data source given the supplied read metadata.
@ -281,7 +284,7 @@ public class SAMDataSource {
originalToMergedReadGroupMappings.put(id,mappingToMerged);
}
if(TRY_LOW_MEMORY_SHARDING) {
if(enableLowMemorySharding) {
for(SAMReaderID id: readerIDs) {
File indexFile = findIndexFile(id.samFile);
if(indexFile != null) {
@ -302,6 +305,22 @@ public class SAMDataSource {
*/
public ReadProperties getReadsInfo() { return readProperties; }
/**
* Enable experimental low-memory sharding.
* @param enable True to enable sharding. False otherwise.
*/
public static void enableLowMemorySharding(final boolean enable) {
enableLowMemorySharding = enable;
}
/**
* Returns whether low-memory sharding is enabled.
* @return True if enabled, false otherwise.
*/
public static boolean isLowMemoryShardingEnabled() {
return enableLowMemorySharding;
}
/**
* Checks to see whether any reads files are supplying data.
* @return True if no reads files are supplying data to the traversal; false otherwise.
@ -389,7 +408,7 @@ public class SAMDataSource {
* @return True if all readers have an index.
*/
public boolean hasIndex() {
if(TRY_LOW_MEMORY_SHARDING)
if(enableLowMemorySharding)
return readerIDs.size() == bamIndices.size();
else {
for(SAMFileReader reader: resourcePool.getReadersWithoutLocking()) {
@ -406,7 +425,7 @@ public class SAMDataSource {
* @return The index. Will preload the index if necessary.
*/
public BrowseableBAMIndex getIndex(final SAMReaderID id) {
if(TRY_LOW_MEMORY_SHARDING)
if(enableLowMemorySharding)
return bamIndices.get(id);
else {
SAMReaders readers = resourcePool.getReadersWithoutLocking();
@ -729,7 +748,7 @@ public class SAMDataSource {
for(SAMReaderID readerID: readerIDs) {
SAMFileReader reader = new SAMFileReader(readerID.samFile);
reader.enableFileSource(true);
if(!TRY_LOW_MEMORY_SHARDING)
if(!enableLowMemorySharding)
reader.enableIndexCaching(true);
reader.setValidationStringency(validationStringency);