Unit test fixed - Tribble codecs aren't designed to be stateless, but I was
using one as though it was. Fixed, and debug code reverted. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4917 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
b9cb57f4b9
commit
3fc9862964
|
|
@ -60,13 +60,10 @@ public class TableCodec implements ReferenceDependentFeatureCodec {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object readHeader(LineReader reader) {
|
public Object readHeader(LineReader reader) {
|
||||||
System.out.printf(" TableCodec.readHeader:%n ");
|
|
||||||
new Exception().printStackTrace(System.out);
|
|
||||||
String line = "";
|
String line = "";
|
||||||
try {
|
try {
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
if (line.startsWith(headerDelimiter)) {
|
if (line.startsWith(headerDelimiter)) {
|
||||||
System.out.printf(" Line w/ header delimiter: %s%n",line);
|
|
||||||
if (header.size() > 0) throw new IllegalStateException("Input table file seems to have two header lines. The second is = " + line);
|
if (header.size() > 0) throw new IllegalStateException("Input table file seems to have two header lines. The second is = " + line);
|
||||||
String spl[] = line.split(delimiterRegex);
|
String spl[] = line.split(delimiterRegex);
|
||||||
for (String s : spl) header.add(s);
|
for (String s : spl) header.add(s);
|
||||||
|
|
|
||||||
|
|
@ -237,14 +237,12 @@ public class RMDTrackBuilder extends PluginManager<FeatureCodec> {
|
||||||
FeatureSource featureSource = null;
|
FeatureSource featureSource = null;
|
||||||
SAMSequenceDictionary sequenceDictionary = null;
|
SAMSequenceDictionary sequenceDictionary = null;
|
||||||
|
|
||||||
FeatureCodec codec = createCodec(targetClass, name);
|
|
||||||
|
|
||||||
// Detect whether or not this source should be indexed.
|
// Detect whether or not this source should be indexed.
|
||||||
boolean canBeIndexed = (storageType == RMDStorageType.FILE);
|
boolean canBeIndexed = (storageType == RMDStorageType.FILE);
|
||||||
|
|
||||||
if(canBeIndexed) {
|
if(canBeIndexed) {
|
||||||
try {
|
try {
|
||||||
Index index = loadIndex(inputFile, codec);
|
Index index = loadIndex(inputFile, createCodec(targetClass, name));
|
||||||
try { logger.info(String.format(" Index for %s has size in bytes %d", inputFile, Sizeof.getObjectGraphSize(index))); }
|
try { logger.info(String.format(" Index for %s has size in bytes %d", inputFile, Sizeof.getObjectGraphSize(index))); }
|
||||||
catch (ReviewedStingException e) { }
|
catch (ReviewedStingException e) { }
|
||||||
|
|
||||||
|
|
@ -257,7 +255,7 @@ public class RMDTrackBuilder extends PluginManager<FeatureCodec> {
|
||||||
sequenceDictionary = getSequenceDictionaryFromProperties(index);
|
sequenceDictionary = getSequenceDictionaryFromProperties(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
featureSource = new BasicFeatureSource(inputFile.getAbsolutePath(), index, codec);
|
featureSource = new BasicFeatureSource(inputFile.getAbsolutePath(), index, createCodec(targetClass, name));
|
||||||
}
|
}
|
||||||
catch (TribbleException e) {
|
catch (TribbleException e) {
|
||||||
throw new UserException(e.getMessage());
|
throw new UserException(e.getMessage());
|
||||||
|
|
@ -267,7 +265,7 @@ public class RMDTrackBuilder extends PluginManager<FeatureCodec> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
featureSource = BasicFeatureSource.getFeatureSource(inputFile.getAbsolutePath(),codec,false);
|
featureSource = BasicFeatureSource.getFeatureSource(inputFile.getAbsolutePath(),createCodec(targetClass, name),false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Pair<FeatureSource,SAMSequenceDictionary>(featureSource,sequenceDictionary);
|
return new Pair<FeatureSource,SAMSequenceDictionary>(featureSource,sequenceDictionary);
|
||||||
|
|
|
||||||
|
|
@ -64,14 +64,12 @@ public class ReferenceOrderedViewUnitTest extends BaseTest {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testNoBindings() {
|
public void testNoBindings() {
|
||||||
System.out.printf("Starting testNoBindings%n");
|
|
||||||
Shard shard = new MockLocusShard(genomeLocParser,Collections.singletonList(genomeLocParser.createGenomeLoc("chrM",1,30)));
|
Shard shard = new MockLocusShard(genomeLocParser,Collections.singletonList(genomeLocParser.createGenomeLoc("chrM",1,30)));
|
||||||
LocusShardDataProvider provider = new LocusShardDataProvider(shard, null, genomeLocParser, shard.getGenomeLocs().get(0), null, seq, Collections.<ReferenceOrderedDataSource>emptyList());
|
LocusShardDataProvider provider = new LocusShardDataProvider(shard, null, genomeLocParser, shard.getGenomeLocs().get(0), null, seq, Collections.<ReferenceOrderedDataSource>emptyList());
|
||||||
ReferenceOrderedView view = new ManagingReferenceOrderedView( provider );
|
ReferenceOrderedView view = new ManagingReferenceOrderedView( provider );
|
||||||
|
|
||||||
RefMetaDataTracker tracker = view.getReferenceOrderedDataAtLocus(genomeLocParser.createGenomeLoc("chrM",10));
|
RefMetaDataTracker tracker = view.getReferenceOrderedDataAtLocus(genomeLocParser.createGenomeLoc("chrM",10));
|
||||||
Assert.assertEquals(tracker.getAllRods().size(), 0, "The tracker should not have produced any data");
|
Assert.assertEquals(tracker.getAllRods().size(), 0, "The tracker should not have produced any data");
|
||||||
System.out.printf("Ending testNoBindings%n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -79,7 +77,6 @@ public class ReferenceOrderedViewUnitTest extends BaseTest {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSingleBinding() {
|
public void testSingleBinding() {
|
||||||
System.out.printf("Starting testSingleBinding%n");
|
|
||||||
String fileName = testDir + "TabularDataTest.dat";
|
String fileName = testDir + "TabularDataTest.dat";
|
||||||
RMDTriplet triplet = new RMDTriplet("tableTest","Table",fileName,RMDStorageType.FILE);
|
RMDTriplet triplet = new RMDTriplet("tableTest","Table",fileName,RMDStorageType.FILE);
|
||||||
ReferenceOrderedDataSource dataSource = new ReferenceOrderedDataSource(triplet,builder,seq.getSequenceDictionary(),genomeLocParser,false);
|
ReferenceOrderedDataSource dataSource = new ReferenceOrderedDataSource(triplet,builder,seq.getSequenceDictionary(),genomeLocParser,false);
|
||||||
|
|
@ -95,7 +92,6 @@ public class ReferenceOrderedViewUnitTest extends BaseTest {
|
||||||
Assert.assertEquals(datum.get("COL1"),"C","datum parameter for COL1 is incorrect");
|
Assert.assertEquals(datum.get("COL1"),"C","datum parameter for COL1 is incorrect");
|
||||||
Assert.assertEquals(datum.get("COL2"),"D","datum parameter for COL2 is incorrect");
|
Assert.assertEquals(datum.get("COL2"),"D","datum parameter for COL2 is incorrect");
|
||||||
Assert.assertEquals(datum.get("COL3"),"E","datum parameter for COL3 is incorrect");
|
Assert.assertEquals(datum.get("COL3"),"E","datum parameter for COL3 is incorrect");
|
||||||
System.out.printf("Ending testSingleBinding%n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -103,7 +99,6 @@ public class ReferenceOrderedViewUnitTest extends BaseTest {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testMultipleBinding() {
|
public void testMultipleBinding() {
|
||||||
System.out.printf("Starting testMultipleBinding%n");
|
|
||||||
File file = new File(testDir + "TabularDataTest.dat");
|
File file = new File(testDir + "TabularDataTest.dat");
|
||||||
|
|
||||||
RMDTriplet testTriplet1 = new RMDTriplet("tableTest1","Table",file.getAbsolutePath(),RMDStorageType.FILE);
|
RMDTriplet testTriplet1 = new RMDTriplet("tableTest1","Table",file.getAbsolutePath(),RMDStorageType.FILE);
|
||||||
|
|
@ -129,6 +124,5 @@ public class ReferenceOrderedViewUnitTest extends BaseTest {
|
||||||
Assert.assertEquals(datum2.get("COL1"),"C","datum2 parameter for COL1 is incorrect");
|
Assert.assertEquals(datum2.get("COL1"),"C","datum2 parameter for COL1 is incorrect");
|
||||||
Assert.assertEquals(datum2.get("COL2"),"D","datum2 parameter for COL2 is incorrect");
|
Assert.assertEquals(datum2.get("COL2"),"D","datum2 parameter for COL2 is incorrect");
|
||||||
Assert.assertEquals(datum2.get("COL3"),"E","datum2 parameter for COL3 is incorrect");
|
Assert.assertEquals(datum2.get("COL3"),"E","datum2 parameter for COL3 is incorrect");
|
||||||
System.out.printf("Ending testMultipleBinding%n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue