/** * Read all the chains and load into an OverlapDetector. * @param chainFile File in UCSC chain format. * @return OverlapDetector will all Chains from reader loaded into it. */ static OverlapDetector<Chain> loadChains(final File chainFile) { final Set<Integer> ids = new HashSet<Integer>(); BufferedLineReader reader = new BufferedLineReader(IOUtil.openFileForReading(chainFile)); final OverlapDetector<Chain> ret = new OverlapDetector<Chain>(0, 0); Chain chain; while ((chain = Chain.loadChain(reader, chainFile.toString())) != null) { if (ids.contains(chain.id)) { throw new SAMException("Chain id " + chain.id + " appears more than once in chain file."); } ids.add(chain.id); ret.addLhs(chain, chain.interval); } reader.close(); return ret; }
/** * Read all the chains and load into an OverlapDetector. * @param chainFile File in UCSC chain format. * @return OverlapDetector will all Chains from reader loaded into it. */ static OverlapDetector<Chain> loadChains(final File chainFile) { final BufferedLineReader reader = new BufferedLineReader(IOUtil.openFileForReading(chainFile)); final OverlapDetector<Chain> ret = new OverlapDetector<Chain>(0, 0); Chain chain; while ((chain = Chain.loadChain(reader, chainFile.toString())) != null) { ret.addLhs(chain, chain.interval); } reader.close(); return ret; }
/** * Read all the chains and load into an OverlapDetector. * @param chainFile File in UCSC chain format. * @return OverlapDetector will all Chains from reader loaded into it. */ static OverlapDetector<Chain> loadChains(final File chainFile) { final BufferedLineReader reader = new BufferedLineReader(IOUtil.openFileForReading(chainFile)); final OverlapDetector<Chain> ret = new OverlapDetector<Chain>(0, 0); Chain chain; while ((chain = Chain.loadChain(reader, chainFile.toString())) != null) { ret.addLhs(chain, chain.interval); } reader.close(); return ret; }