
org.biojava.nbio.genome.parsers.twobit.TwoBitFacade Maven / Gradle / Ivy
The newest version!
/*
* BioJava development code
*
* This code may be freely distributed and modified under the
* terms of the GNU Lesser General Public Licence. This should
* be distributed with the code. If you do not have a copy,
* see:
*
* http://www.gnu.org/copyleft/lesser.html
*
* Copyright for this code is held jointly by the individual
* authors. These should be listed in @author doc comments.
*
* For more information on the BioJava project and its aims,
* or to join the biojava-l mailing list, visit the home page
* at:
*
* http://www.biojava.org/
*
*/
package org.biojava.nbio.genome.parsers.twobit;
import java.io.File;
/**
* A facade that makes it easier to work with a 2bit file.
*
* Created by yana on 3/27/17.
*/
public class TwoBitFacade {
private TwoBitParser twoBitParser = null;
/**
* Reads a genome from a locally stored .2bit file.
*
* @param file the File to a .2bit file.
*/
public TwoBitFacade(File file) throws Exception {
twoBitParser = new TwoBitParser(file);
}
/**
* Closes .2bit file twoBitParser.
*/
public void close() throws Exception {
if (twoBitParser != null)
twoBitParser.close();
}
/**
* Sets a chromosome for TwoBitParser.
*
* @param chr The chromosome name (e.g. chr21)
*/
public void setChromosome(String chr) throws Exception {
if ( twoBitParser == null){
}
twoBitParser.close();
String[] names = twoBitParser.getSequenceNames();
for(int i=0;i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy