JAL-2738 ensure variant feature is in forward sense
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 9 Oct 2017 10:55:55 +0000 (11:55 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 9 Oct 2017 10:55:55 +0000 (11:55 +0100)
src/jalview/io/vcf/VCFLoader.java

index 711b82a..3d269d8 100644 (file)
@@ -437,13 +437,16 @@ public class VCFLoader
 
       /*
        * convert chromosomal location to sequence coordinates
+       * - may be reverse strand (convert to forward for sequence feature)
        * - null if a partially overlapping feature
        */
       int[] seqLocation = mapping.locateInFrom(start, end);
       if (seqLocation != null)
       {
-        count += addAlleleFeatures(seq, variant, seqLocation[0],
-                seqLocation[1], forwardStrand);
+        int featureStart = Math.min(seqLocation[0], seqLocation[1]);
+        int featureEnd = Math.max(seqLocation[0], seqLocation[1]);
+        count += addAlleleFeatures(seq, variant, featureStart, featureEnd,
+                forwardStrand);
       }
     }