@@ -141,18 +141,34 @@ public void testHBA(){
141141
142142 private void validateExon (int exonNr , int start , int stop , List <Range <Integer >> cdsranges ) {
143143
144- Range exon = cdsranges .get (exonNr );
144+ Range < Integer > exon = cdsranges .get (exonNr );
145145 assertTrue ("Exon " + exonNr + " boundary " + exon .lowerEndpoint () + " does not match " +start , exon .lowerEndpoint ().equals (start ));
146146 assertTrue ("Exon " + exonNr + " boundary " + exon .upperEndpoint () + " does not match " + stop , exon .upperEndpoint ().equals (stop ));
147147
148148 }
149149
150- @ Test
151- /** Test to make sure the mapping tool correctly retrieves the mRNA position for a gene
150+ /** Get the position of the nucleotide base corresponding to the position of that base on the mRNA sequence
151+ * for a gene living on the reverse DNA strand.
152+ *
153+ * @author Yana Valasatava
154+ */
155+ private int getPositionInmRNA (String geneName , String genebankId , int posChrom ) {
156+ for (GeneChromosomePosition gcp : gcps ) {
157+ if ( gcp .getGeneName ().equals (geneName ) ) {
158+ if ( gcp .getGenebankId ().equals (genebankId ) ) {
159+ return ChromosomeMappingTools .getCDSPosForChromosomeCoordinate (posChrom , gcp );
160+ }
161+ }
162+ }
163+ return -1 ;
164+ }
165+
166+ /** Make sure the mapping tool correctly retrieves the mRNA position for a gene
152167 * living on the forward DNA strand for different chromosome positions.
153168 *
154169 * @author Yana Valasatava
155170 */
171+ @ Test
156172 public void testForwardMappingPositions () {
157173
158174 String geneName = "HORMAD2" ; // gene on the forward DNA strand
@@ -190,13 +206,13 @@ public void testForwardMappingPositions() {
190206 }
191207 }
192208 }
193-
194- @ Test
195- /** Test to make sure the mapping tool correctly retrieves the mRNA position for a gene
209+
210+ /** Make sure the mapping tool correctly retrieves the mRNA position for a gene
196211 * living on the reverse DNA strand for different chromosome positions.
197212 *
198213 * @author Yana Valasatava
199214 */
215+ @ Test
200216 public void testReverseMappingPositions () {
201217
202218 String geneName = "BCL11B" ; // gene on the reverse DNA strand
@@ -235,12 +251,12 @@ public void testReverseMappingPositions() {
235251 }
236252 }
237253
238- @ Test
239254 /** Test to make sure the mapping tool correctly identify that position falls outside the coding region
240255 * for a gene living on the forward DNA strand.
241256 *
242257 * @author Yana Valasatava
243258 */
259+ @ Test
244260 public void testForwardMappingForExonBoundaries () {
245261
246262 String geneName = "HBA1" ; // gene on the reverse DNA strand
@@ -249,68 +265,51 @@ public void testForwardMappingForExonBoundaries() {
249265 int posExonStart = 176717 ; // starting position of the first base in a coding region (1st exon)
250266 int posExonEnd = 176811 ; // ending position of the first base in a coding region (1st exon)
251267
252- for (GeneChromosomePosition gcp : gcps ) {
253-
254- if ( !gcp .getGeneName ().equals (geneName ) )
255- continue ;
256- if ( !gcp .getGenebankId ().equals (genebankId ) )
257- continue ;
258-
259- int cdsSE = ChromosomeMappingTools .getCDSPosForChromosomeCoordinate (posExonStart -1 , gcp );
260- assertEquals (cdsSE , -1 );
261-
262- int cdsEE = ChromosomeMappingTools .getCDSPosForChromosomeCoordinate (posExonEnd +1 , gcp );
263- assertEquals (cdsEE , -1 );
268+ int cdsSE = getPositionInmRNA (geneName , genebankId , posExonStart -1 );
269+ assertEquals (cdsSE , -1 );
264270
265- break ;
266- }
271+ int cdsEE = getPositionInmRNA ( geneName , genebankId , posExonEnd + 1 ) ;
272+ assertEquals ( cdsEE , - 1 );
267273 }
268-
269- @ Test
274+
270275 /** Test to make sure the mapping tool correctly identify that position falls outside the coding region
271276 * for a gene living on the reverse DNA strand.
272277 *
273278 * @author Yana Valasatava
274279 */
280+ @ Test
275281 public void testReverseMappingForExonBoundaries () {
276282
277283 String geneName = "BCL11B" ; // gene on the reverse DNA strand
278284 String genebankId = "NM_138576" ; // GeneBank ID for the transcript used for testing (ENST00000357195)
279285
280286 int posExonStart = 99174151 ; // starting position of the first base in a coding region (1st exon)
281287 int posExonEnd = 99176195 ; // ending position of the first base in a coding region (1st exon)
282-
283- for (GeneChromosomePosition gcp : gcps ) {
284-
285- if ( !gcp .getGeneName ().equals (geneName ) )
286- continue ;
287- if ( !gcp .getGenebankId ().equals (genebankId ) )
288- continue ;
289-
290- int cdsSE = ChromosomeMappingTools .getCDSPosForChromosomeCoordinate (posExonStart -1 , gcp );
291- assertEquals (cdsSE , -1 );
292-
293- int cdsEE = ChromosomeMappingTools .getCDSPosForChromosomeCoordinate (posExonEnd +1 , gcp );
294- assertEquals (cdsEE , -1 );
295-
296- break ;
297- }
288+
289+ int cdsSE = getPositionInmRNA (geneName , genebankId , posExonStart -1 );
290+ assertEquals (cdsSE , -1 );
291+
292+ int cdsEE = getPositionInmRNA (geneName , genebankId , posExonEnd +1 );
293+ assertEquals (cdsEE , -1 );
298294 }
299295
300- /** Get the position of the nucleotide base corresponding to the position of that base on the mRNA sequence
301- * for a gene living on the reverse DNA strand.
296+ /** Test to make sure the mapping tool correctly converts the genetic position to a position on mRNA
297+ * when multiple UTR regions are consecutive.
302298 *
303299 * @author Yana Valasatava
304300 */
305- private int getPositionInmRNA (String geneName , String genebankId , int posChrom ) {
306- for (GeneChromosomePosition gcp : gcps ) {
307- if ( !gcp .getGeneName ().equals (geneName ) )
308- continue ;
309- if ( !gcp .getGenebankId ().equals (genebankId ) )
310- continue ;
311- return ChromosomeMappingTools .getCDSPosForChromosomeCoordinate (posChrom , gcp );
312- }
313- return -1 ;
301+ @ Test
302+ public void testMappingCromosomePosTomRNAMultiUTRs () {
303+
304+ String geneName = "ILK" ; // gene on the reverse DNA strand
305+ String genebankId = "NM_001278442" ; // GeneBank ID for the transcript used for testing (ENST00000532063)
306+
307+ int chromPos = 6608760 ;
308+ int mRNAPos = 16 ;
309+
310+ int cds = getPositionInmRNA (geneName , genebankId , chromPos );
311+ assertEquals (cds , mRNAPos );
312+
314313 }
315314}
316315
0 commit comments