remove some dependencies on out of date methods from the tests

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4047 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
aaron 2010-08-17 00:07:26 +00:00
parent c1df293feb
commit e632d9b83d
1 changed files with 23 additions and 21 deletions

View File

@ -5,6 +5,7 @@ import net.sf.samtools.SAMSequenceDictionary;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.broad.tribble.Feature;
import org.broad.tribble.bed.BEDCodec;
import org.broad.tribble.index.Index;
import org.broad.tribble.index.linear.LinearIndex;
import org.broad.tribble.iterators.CloseableTribbleIterator;
@ -44,7 +45,7 @@ public class IndexPerformanceTests extends BaseTest {
String fileLocation = validationDataLocation + "Index_Performance_Data/";
// bin sizes to try
int[] binSizes = {10, 100, 1000, 5000, 10000, 50000};
int[] binSizes = {100, 1000, 5000, 16000};
PrintWriter writer;
PrintWriter writer2;
@ -56,19 +57,20 @@ public class IndexPerformanceTests extends BaseTest {
IndexedFastaSequenceFile seq = new IndexedFastaSequenceFile(new File(hg18Reference));
GenomeLocParser.setupRefContigOrdering(seq);
int recordCount[] = {10,100,1000,10000,100000,500000,1000000};
int longestFeature[] = {1,50,100,1000,100000};
// the input files
inputFiles.put("\"10\"",new File(fileLocation + "tip10.vcf"));
inputFiles.put("\"100\"",new File(fileLocation + "tip100.vcf"));
inputFiles.put("\"1,000\"",new File(fileLocation + "tip1000.vcf"));
inputFiles.put("\"10,000\"",new File(fileLocation + "tip10000.vcf"));
inputFiles.put("\"100,000\"",new File(fileLocation + "tip100000.vcf"));
inputFiles.put("\"1,000,000\"",new File(fileLocation + "tip1000000.vcf"));
for (int rCount : recordCount){
for (int longest : longestFeature) {
inputFiles.put("./BED/" + "bed_density_" + rCount + "_fLengthMax_" + longest + ".BED",new File("./BED/" + "bed_density_" + rCount + "_fLengthMax_" + longest + ".BED"));
}
}
for (String name : inputFiles.keySet()) {
inputTypes.put(name,VCFCodec.class);
inputTypes.put(name, BEDCodec.class);
}
inputFiles.put("Big Table",new File("/humgen/gsa-hpprojects/dev/depristo/oneOffProjects/slowAnnotator/big.table.txt"));
inputTypes.put("Big Table", AnnotatorInputTableCodec.class);
}
@Test
@ -115,10 +117,10 @@ public class IndexPerformanceTests extends BaseTest {
* every other 1000 bases of chr1 (of the first 100M), the count of records seen in the last operation, and the index size
*/
public List<Long> performIndexTest(String name, boolean useLinear, int size) {
TribbleRMDTrackBuilder.useLinearIndex = useLinear;
TribbleRMDTrackBuilder.binSize = size;
//TribbleRMDTrackBuilder.useLinearIndex = useLinear;
//TribbleRMDTrackBuilder.binSize = size;
deleteIndex(inputFiles.get(name));
deleteIndex(new File(inputFiles.get(name) + ((useLinear) ? ".idx" : ".tdx")));
// time creating the index
long createTime = System.currentTimeMillis();
Pair<BasicFeatureSource, SAMSequenceDictionary> pairing = builder.createFeatureReader(inputTypes.get(name),inputFiles.get(name));
@ -135,7 +137,7 @@ public class IndexPerformanceTests extends BaseTest {
for (int x = 1; x < 1000000; x = x + 1000) {
//CloseableTribbleIterator<Feature> iter = pairing.first.query("chr1", x+(int)Math.floor(Math.random()*1000), x+1000); // query
CloseableTribbleIterator<Feature> iter = pairing.first.query("chr1", x, x+1000); // query
for (Feature feat : iter) {
while (iter.hasNext() && iter.next().getStart() < x) {
count++;
}
}
@ -205,8 +207,8 @@ public class IndexPerformanceTests extends BaseTest {
private Map<Integer,Integer> getMapOfFeatures(Map<GenomeLoc, Integer> features, boolean useLinear) {
File bigTable = new File("/humgen/gsa-hpprojects/dev/depristo/oneOffProjects/slowAnnotator/big.table.txt");
TribbleRMDTrackBuilder.useLinearIndex = useLinear;
TribbleRMDTrackBuilder.binSize = 1000;
//TribbleRMDTrackBuilder.useLinearIndex = useLinear;
//TribbleRMDTrackBuilder.binSize = 1000;
deleteIndex(inputFiles.get("Big Table"));
// time creating the index
@ -238,8 +240,8 @@ public class IndexPerformanceTests extends BaseTest {
//@Test
public void testGetTreeIndexLocation() {
File bigTable = new File("small.table.txt");
TribbleRMDTrackBuilder.useLinearIndex = false;
TribbleRMDTrackBuilder.binSize = 1000;
//TribbleRMDTrackBuilder.useLinearIndex = false;
//TribbleRMDTrackBuilder.binSize = 1000;
deleteIndex(bigTable);
// time creating the index
@ -265,10 +267,10 @@ public class IndexPerformanceTests extends BaseTest {
private void deleteIndex(File fl) {
File indexFile = new File(fl + TribbleRMDTrackBuilder.indexExtension);
System.err.println("Trying to delete index " + fl);
boolean deleted = true;
if (indexFile.exists())
deleted = indexFile.delete();
if (fl.exists())
deleted = fl.delete();
if (!deleted)
Assert.fail("Unable to delete index file");
}