public static List < Range < Integer > > getCDSRegions ( List < Integer > origExonStarts , List < Integer > origExonEnds , int cdsStart , int cdsEnd ) { // remove exons that are fully landed in UTRs List < Integer > exonStarts = new ArrayList < Integer > ( origExonStarts ) ; List < Integer > exonEnds = new ArrayList < Integer > ( origExonEnds ) ; int j = 0 ; for ( int i = 0 ; i < origExonStarts . size ( ) ; i ++ ) { if ( ( origExonEnds . get ( i ) < cdsStart ) || ( origExonStarts . get ( i ) > cdsEnd ) ) { exonStarts . remove ( j ) ; 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 < Range < Integer > > ( ) ; 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 exons boundaries in CDS coordinates corresponding to the forward DNA strand .