Search in sources :

Example 1 with IndexedBedReader

use of com.github.lindenb.jvarkit.util.bio.bed.IndexedBedReader in project jvarkit by lindenb.

the class KnimeVariantHelper method openBed.

public IndexedBedReader openBed(final String resourceName, String path) throws IOException {
    failIf(this.bedReaders.containsKey(resourceName), "duplicate resource " + resourceName);
    final IndexedBedReader reader = new IndexedBedReader(path);
    this.bedReaders.put(resourceName, reader);
    return reader;
}
Also used : IndexedBedReader(com.github.lindenb.jvarkit.util.bio.bed.IndexedBedReader)

Example 2 with IndexedBedReader

use of com.github.lindenb.jvarkit.util.bio.bed.IndexedBedReader in project jvarkit by lindenb.

the class VCFBedSetFilter method doWork.

@Override
public int doWork(List<String> args) {
    try {
        if (this.tabixFile == null && this.treeMapFile == null) {
            LOG.error("Undefined tabix or memory file");
            return -1;
        } else if (this.tabixFile != null && this.treeMapFile != null) {
            LOG.error("You cannot use both options: treemap/tabix");
            return -1;
        } else if (this.tabixFile != null) {
            LOG.info("opening Bed " + this.tabixFile);
            this.bedReader = new IndexedBedReader(this.tabixFile);
        } else {
            LOG.info("opening Bed " + this.treeMapFile);
            this.intervalTreeMap = super.readBedFileAsBooleanIntervalTreeMap(this.treeMapFile);
        }
        if (this.filterName == null || this.filterName.trim().isEmpty()) {
            LOG.error("Undefined filter name");
            return -1;
        }
        return doVcfToVcf(args, outputFile);
    } catch (final Exception err) {
        LOG.error(err);
        return -1;
    } finally {
        CloserUtil.close(this.bedReader);
        this.bedReader = null;
        this.intervalTreeMap = null;
    }
}
Also used : IndexedBedReader(com.github.lindenb.jvarkit.util.bio.bed.IndexedBedReader)

Aggregations

IndexedBedReader (com.github.lindenb.jvarkit.util.bio.bed.IndexedBedReader)2