public boolean hasNext() { return bedIterator.hasNext(); //To change body of implemented methods use File | Settings | File Templates. }
public boolean hasNext() { return bedIterator.hasNext(); //To change body of implemented methods use File | Settings | File Templates. }
protected String next() throws IOException{ if(this.tabixIterator != null){ return this.tabixIterator.next(); } else if(this.bigBedIterator != null) { if( ! this.bigBedIterator.hasNext()){ return null; } BedFeature x= this.bigBedIterator.next(); if(x == null){ return null; } StringBuilder sb= new StringBuilder(); sb.append(x.getChromosome()); sb.append("\t"); sb.append(x.getStartBase()); sb.append("\t"); sb.append(x.getEndBase()); for(String field : x.getRestOfFields()){ sb.append("\t"); sb.append(field); } return sb.toString(); } else { throw new RuntimeException(); } }
public MethylScore next() { BedFeature feat = null; while (feat == null && bedIterator.hasNext()) { feat = bedIterator.next(); String[] restOfFields = feat.getRestOfFields(); MethylScore score = type == Type.ZILLER ? createZillerScore(feat, restOfFields) : createUSCScore(feat, restOfFields); return score; } return null; }
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; }