use of org.broadinstitute.hellbender.tools.exome.TargetTableReader in project gatk by broadinstitute.
the class TargetCodec method canDecode.
@Override
public boolean canDecode(final String path) {
File file;
try {
// Use the URI constructor so that we can handle file:// URIs
final URI uri = new URI(path);
file = uri.isAbsolute() ? new File(uri) : new File(path);
} catch (Exception e) {
// Contract for canDecode() mandates that all exception be trapped
return false;
}
if (!file.canRead() || !file.isFile()) {
return false;
}
try {
new TargetTableReader(file).close();
} catch (final IOException | RuntimeException ex) {
// whereas RuntimeException would be caused by a formatting error in the file.
return false;
}
//disallow .bed extension
final String toDecode = AbstractFeatureReader.hasBlockCompressedExtension(path) ? path.substring(0, path.lastIndexOf(".")) : path;
return !toDecode.toLowerCase().endsWith(BED_EXTENSION);
}
use of org.broadinstitute.hellbender.tools.exome.TargetTableReader in project gatk-protected by broadinstitute.
the class TargetCodec method canDecode.
@Override
public boolean canDecode(final String path) {
File file;
try {
// Use the URI constructor so that we can handle file:// URIs
final URI uri = new URI(path);
file = uri.isAbsolute() ? new File(uri) : new File(path);
} catch (Exception e) {
// Contract for canDecode() mandates that all exception be trapped
return false;
}
if (!file.canRead() || !file.isFile()) {
return false;
}
try {
new TargetTableReader(file).close();
} catch (final IOException | RuntimeException ex) {
// whereas RuntimeException would be caused by a formatting error in the file.
return false;
}
//disallow .bed extension
final String toDecode = AbstractFeatureReader.hasBlockCompressedExtension(path) ? path.substring(0, path.lastIndexOf(".")) : path;
return !toDecode.toLowerCase().endsWith(BED_EXTENSION);
}
Aggregations