// Path: biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/twobit/TwoBitFacade.java
// 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<names.length;i++) {
// 			if ( names[i].equalsIgnoreCase(chr) ) {
// 				twoBitParser.setCurrentSequence(names[i]);
// 				break;
// 			}
// 		}
// 	}
// 
// 	/**
// 	 * Extract a sequence from a chromosome, using chromosomal coordinates
// 	 *
// 	 * @param chromosomeName
// 	 * @param start
// 	 * @param end
// 	 * @return the DNASequence from the requested coordinates.
// 	 * @throws Exception
// 	 */
// 	public String getSequence(String chromosomeName, int start, int end) throws Exception {
// 		twoBitParser.close();
// 		twoBitParser.setCurrentSequence(chromosomeName);
// 		return twoBitParser.loadFragment(start,end-start);
// 	}
// }


import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.Range;
import org.biojava.nbio.core.sequence.DNASequence;
import org.biojava.nbio.core.sequence.compound.NucleotideCompound;
import org.biojava.nbio.core.sequence.template.SequenceView;
import org.biojava.nbio.genome.parsers.genename.ChromPos;
import org.biojava.nbio.genome.parsers.genename.GeneChromosomePosition;
import org.biojava.nbio.genome.parsers.twobit.TwoBitFacade;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
				exonEnds.remove(j);
			}
			else {
				j++;
			}
		}

		// remove untranslated regions from exons
		int nExons = exonStarts.size();
		exonStarts.remove(0);
		exonStarts.add(0, cdsStart);
		exonEnds.remove(nExons-1);
		exonEnds.add(cdsEnd);

		List<Range<Integer>> cdsRegion = new ArrayList<>();
		for ( int i=0; i<nExons; i++ ) {
			Range<Integer> r = Range.closed(exonStarts.get(i), exonEnds.get(i));
			cdsRegion.add(r);
		}
		return cdsRegion;
	}

	/**
	 * Extracts the DNA sequence transcribed from the input genetic coordinates.
	 *
	 * @param twoBitFacade the facade that provide an access to a 2bit file
	 * @param gcp The container with chromosomal positions
	 *
	 * @return the DNA sequence transcribed from the input genetic coordinates
	 */
// Path: biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/twobit/TwoBitFacade.java
// 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<names.length;i++) {
// 			if ( names[i].equalsIgnoreCase(chr) ) {
// 				twoBitParser.setCurrentSequence(names[i]);
// 				break;
// 			}
// 		}
// 	}
// 
// 	/**
// 	 * Extract a sequence from a chromosome, using chromosomal coordinates
// 	 *
// 	 * @param chromosomeName
// 	 * @param start
// 	 * @param end
// 	 * @return the DNASequence from the requested coordinates.
// 	 * @throws Exception
// 	 */
// 	public String getSequence(String chromosomeName, int start, int end) throws Exception {
// 		twoBitParser.close();
// 		twoBitParser.setCurrentSequence(chromosomeName);
// 		return twoBitParser.loadFragment(start,end-start);
// 	}
// }


// Path: biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.Range;
import org.biojava.nbio.core.sequence.DNASequence;
import org.biojava.nbio.core.sequence.compound.NucleotideCompound;
import org.biojava.nbio.core.sequence.template.SequenceView;
import org.biojava.nbio.genome.parsers.genename.ChromPos;
import org.biojava.nbio.genome.parsers.genename.GeneChromosomePosition;
import org.biojava.nbio.genome.parsers.twobit.TwoBitFacade;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

				exonEnds.remove(j);
			}
			else {
				j++;
			}
		}

		// remove untranslated regions from exons
		int nExons = exonStarts.size();
		exonStarts.remove(0);
		exonStarts.add(0, cdsStart);
		exonEnds.remove(nExons-1);
		exonEnds.add(cdsEnd);

		List<Range<Integer>> cdsRegion = new ArrayList<>();
		for ( int i=0; i<nExons; i++ ) {
			Range<Integer> r = Range.closed(exonStarts.get(i), exonEnds.get(i));
			cdsRegion.add(r);
		}
		return cdsRegion;
	}

	/**
	 * Extracts the DNA sequence transcribed from the input genetic coordinates.
	 *
	 * @param twoBitFacade the facade that provide an access to a 2bit file
	 * @param gcp The container with chromosomal positions
	 *
	 * @return the DNA sequence transcribed from the input genetic coordinates
	 */
	public static DNASequence getTranscriptDNASequence(TwoBitFacade twoBitFacade, GeneChromosomePosition gcp) throws Exception {