/** * Extracts the DNA sequence transcribed from the input genetic coordinates. * * @param chromosome the name of the chromosome * @param exonStarts The list holding the genetic coordinates pointing to the start positions of the exons (including UTR regions) * @param exonEnds The list holding the genetic coordinates pointing to the end positions of the exons (including UTR regions) * @param cdsStart The start position of a coding region * @param cdsEnd The end position of a coding region * @param orientation The orientation of the strand where the gene is living * * @return the DNA sequence transcribed from the input genetic coordinates */ public static DNASequence getTranscriptDNASequence(TwoBitFacade twoBitFacade, String chromosome, List<Integer> exonStarts, List<Integer> exonEnds, int cdsStart, int cdsEnd, Character orientation) throws Exception { List<Range<Integer>> cdsRegion = getCDSRegions(exonStarts, exonEnds, cdsStart, cdsEnd); String dnaSequence = ""; for (Range<Integer> range : cdsRegion) { String exonSequence = twoBitFacade.getSequence(chromosome,range.lowerEndpoint(), range.upperEndpoint()); dnaSequence += exonSequence; } if (orientation.equals('-')) { dnaSequence = new StringBuilder(dnaSequence).reverse().toString(); DNASequence dna = new DNASequence(dnaSequence); SequenceView<NucleotideCompound> compliment = dna.getComplement(); dnaSequence = compliment.getSequenceAsString(); } return new DNASequence(dnaSequence.toUpperCase()); } }