protected TabixBigBedIterator(BBFileReader reader, String chrom, int start, int end){ this.bigBedIterator= reader.getBigBedIterator(chrom, start, chrom, end, false); }
public Iterator getFeatures(String chr, int start, int end) throws IOException { String tmp = chrNameMap.get(chr); String querySeq = tmp == null ? chr : tmp; BigBedIterator bedIterator = reader.getBigBedIterator(querySeq, start, chr, end, false); return new WrappedIterator(bedIterator); }
public Iterator<MethylScore> query(String chr, int start, int end) { String tmp = chrNameMap.get(chr); String querySeq = tmp == null ? chr : tmp; BigBedIterator bedIterator = reader.getBigBedIterator(querySeq, start, chr, end, false); return new WrappedIterator(bedIterator, type); }
/** * Open file * @param fileName */ void open(String fileName) { try { label = Gpr.removeExt(Gpr.baseName(fileName)); // Open file BBFileReader readerBb = new BBFileReader(fileName); BBFileHeader bbFileHdr = readerBb.getBBFileHeader(); // Get header if (!bbFileHdr.isHeaderOK()) throw new IOException("Bad header for file '" + fileName + "'"); // Sanity check if (!bbFileHdr.isBigBed()) throw new RuntimeException("Unrecognized header type for file '" + fileName + "' (expecting BigBed)"); // Get file type iterator = readerBb.getBigBedIterator(); } catch (Exception e) { throw new RuntimeException("Error loading file '" + fileName + "'.", e); } }
private static String initRegionFromBigBed(String bigBedFile) throws IOException{ BBFileReader reader= new BBFileReader(bigBedFile); if(! reader.isBigBedFile()){ System.err.println("File " + bigBedFile + " is not bigBed."); throw new RuntimeException(); } String region= reader.getChromosomeNames().get(0); // Just get chrom to start with for(String chrom : reader.getChromosomeNames()){ BigBedIterator iter = reader.getBigBedIterator(chrom, 0, chrom, Integer.MAX_VALUE, false); if(iter.hasNext()){ BedFeature x= (BedFeature) iter.next(); region= x.getChromosome() + ":" + (x.getStartBase() + 1); reader.close(); return region; } } reader.close(); return region; }