add experimental support for tabix files (for any of our Tribble rod types), as long as they end in .gz and can be read by the tabix reader.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3429 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
f7c9f131ea
commit
f3e2aae570
|
|
@ -105,6 +105,40 @@ public class TribbleRMDTrackBuilder extends PluginManager<FeatureCodec> implemen
|
|||
*/
|
||||
public FeatureReader createFeatureReader(Class targetClass, File inputFile) {
|
||||
FeatureReader reader = null;
|
||||
if (inputFile.getAbsolutePath().endsWith(".gz"))
|
||||
reader = createBasicFeatureReaderNoAssumedIndex(targetClass, inputFile);
|
||||
else
|
||||
reader = getLinearFeatureReader(targetClass, inputFile);
|
||||
return reader;
|
||||
}
|
||||
|
||||
/**
|
||||
* create a feature reader, without assuming there exists an index. This code assumes the feature
|
||||
* reader of the appropriate type will figure out what the right index type is, and determine if it
|
||||
* exists.
|
||||
*
|
||||
* @param targetClass the codec class type
|
||||
* @param inputFile the file to load
|
||||
* @return a feature reader implementation
|
||||
*/
|
||||
private BasicFeatureReader createBasicFeatureReaderNoAssumedIndex(Class targetClass, File inputFile) {
|
||||
// we might not know the index type, try loading with the default reader constructor
|
||||
logger.debug("Attempting to blindly load " + inputFile);
|
||||
try {
|
||||
return new BasicFeatureReader(inputFile.getAbsolutePath(),this.createByType(targetClass));
|
||||
} catch (IOException e) {
|
||||
throw new StingException("Unable to create feature reader from file " + inputFile);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* create a linear feature reader, where we create the index ahead of time
|
||||
* @param targetClass the target class
|
||||
* @param inputFile the tribble file to parse
|
||||
* @return the input file as a FeatureReader
|
||||
*/
|
||||
private FeatureReader getLinearFeatureReader(Class targetClass, File inputFile) {
|
||||
FeatureReader reader;
|
||||
try {
|
||||
Index index = loadIndex(inputFile, this.createByType(targetClass), true);
|
||||
reader = new BasicFeatureReader(inputFile.getAbsolutePath(), index, this.createByType(targetClass));
|
||||
|
|
|
|||
Loading…
Reference in New Issue