turned off the progress output from tribble when making an index, and fixing a case where the index file isn't writable so we instead make the index in memory.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3312 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
bacc507a48
commit
78409dca0d
|
|
@ -120,7 +120,16 @@ public class TribbleRMDTrackBuilder extends PluginManager<FeatureCodec> implemen
|
|||
*/
|
||||
public static LinearIndex createIndex(File inputFile, FeatureCodec codec) throws IOException {
|
||||
LinearIndexCreator create = new LinearIndexCreator(inputFile, codec);
|
||||
return create.createIndex();
|
||||
create.setDisplayProgress(false); // don't display progress indicators
|
||||
|
||||
// if we can write the index, we should, but if not just create it in memory
|
||||
if (new File(inputFile.getAbsoluteFile() + linearIndexExtension).canWrite())
|
||||
return create.createIndex();
|
||||
else {
|
||||
logger.info("Unable to write to location " + inputFile.getAbsoluteFile() + linearIndexExtension + " for index file, creating index in memory only");
|
||||
return create.createIndex(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class VCFReader implements Iterator<VCFRecord>, Iterable<VCFRecord> {
|
|||
}
|
||||
if (transform != null) codec.setTransformer(transform);
|
||||
try {
|
||||
vcfReader = new FeatureReader(vcfFile,codec);
|
||||
vcfReader = new FeatureReader(vcfFile,index,codec);
|
||||
iterator= vcfReader.iterator();
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new StingException("Unable to read VCF File from " + vcfFile, e);
|
||||
|
|
|
|||
|
|
@ -23,10 +23,14 @@
|
|||
|
||||
package org.broadinstitute.sting.gatk.refdata.tracks.builders;
|
||||
|
||||
import org.broad.tribble.vcf.VCFCodec;
|
||||
import org.broadinstitute.sting.BaseTest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
|
|
@ -49,9 +53,19 @@ public class TribbleRMDTrackBuilderUnitTest extends BaseTest {
|
|||
@Test
|
||||
public void testBuilder() {
|
||||
Map<String,Class> classes = builder.getAvailableTrackNamesAndTypes();
|
||||
for (String c: classes.keySet()) {
|
||||
System.err.println("class = " + c);
|
||||
Assert.assertTrue(classes.size() > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuilderIndexUnwriteable() {
|
||||
File vcfFile = new File(validationDataLocation + "/ROD_validation/mixedup.vcf");
|
||||
try {
|
||||
builder.createIndex(vcfFile,new VCFCodec());
|
||||
} catch (IOException e) {
|
||||
Assert.fail("Unable to make index because of IO exception " + e.getMessage());
|
||||
}
|
||||
//Assert.fail("Fail");
|
||||
// make sure we didn't write the file (check that it's length is zero)
|
||||
Assert.assertEquals(0,new File(vcfFile + TribbleRMDTrackBuilder.linearIndexExtension).length());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
<ivy-module version="1.0">
|
||||
<info organisation="org.broad" module="tribble" revision="75" status="integration" publication="20100503124200" />
|
||||
</ivy-module>
|
||||
Binary file not shown.
|
|
@ -0,0 +1,3 @@
|
|||
<ivy-module version="1.0">
|
||||
<info organisation="org.broad" module="tribble" revision="77" status="integration" publication="20100504124200" />
|
||||
</ivy-module>
|
||||
Loading…
Reference in New Issue