[med-svn] [Git][med-team/beagle][upstream] New upstream version 5.1-191125+dfsg

Dylan Aïssi gitlab at salsa.debian.org
Sat Dec 14 17:58:21 GMT 2019



Dylan Aïssi pushed to branch upstream at Debian Med / beagle


Commits:
32b96745 by Dylan Aïssi at 2019-12-14T17:58:05Z
New upstream version 5.1-191125+dfsg
- - - - -


3 changed files:

- main/Main.java
- vcf/PlinkGenMap.java
- vcf/WindowIt.java


Changes:

=====================================
main/Main.java
=====================================
@@ -65,8 +65,8 @@ public class Main {
      * The program name and version.
      */
     public static final String VERSION = "(version 5.1)";
-    public static final String PROGRAM = "beagle.20Nov19.573.jar";
-    public static final String COMMAND = "java -jar beagle.20Nov19.573.jar";
+    public static final String PROGRAM = "beagle.25Nov19.28d.jar";
+    public static final String COMMAND = "java -jar beagle.25Nov19.28d.jar";
 
     /**
      * The copyright string.
@@ -78,7 +78,7 @@ public class Main {
      */
     public static final String SHORT_HELP = Main.PROGRAM + " " + VERSION
             + Const.nl + Main.COPYRIGHT
-            + Const.nl + "Enter \"java -jar beagle.20Nov19.573.jar\" to "
+            + Const.nl + "Enter \"java -jar beagle.25Nov19.28d.jar\" to "
             + "list command line argument";
 
     private final Par par;


=====================================
vcf/PlinkGenMap.java
=====================================
@@ -307,11 +307,11 @@ public final class PlinkGenMap implements GeneticMap {
 
     @Override
     public double genPos(int chrom, int basePosition) {
-        double minEndCm = 5.0;
         checkChromIndex(chrom);
-        int mapSize = basePos[chrom].length;
-        assert mapSize>=2;
-        assert genPos[chrom].length==mapSize;
+        double minEndCmDist = 5.0;
+        int mapSizeM1 = basePos[chrom].length - 1;
+        assert mapSizeM1>0;
+        assert genPos[chrom].length==basePos[chrom].length;
         int index = Arrays.binarySearch(basePos[chrom], basePosition);
         if (index>=0) {
             return genPos[chrom][index];
@@ -319,23 +319,23 @@ public final class PlinkGenMap implements GeneticMap {
             int insPt = -index-1;
             int aIndex = insPt - 1;
             int bIndex = insPt;
-            if (insPt==mapSize) {
-                insPt = Arrays.binarySearch(genPos[chrom], genPos[chrom][mapSize-1] - minEndCm);
+            if (aIndex==mapSizeM1) {
+                insPt = Arrays.binarySearch(genPos[chrom], genPos[chrom][mapSizeM1] - minEndCmDist);
                 if (insPt<0) {
                     insPt = -insPt - 2;
                 }
-                assert insPt<(mapSize-1);
+                assert insPt<mapSizeM1;
                 aIndex = Math.max(insPt, 0);
-                bIndex = mapSize-1;
+                bIndex = mapSizeM1;
             }
-            else if (insPt==0) {
-                insPt = Arrays.binarySearch(genPos[chrom], genPos[chrom][0] + minEndCm);
+            else if (bIndex==0) {
+                insPt = Arrays.binarySearch(genPos[chrom], genPos[chrom][0] + minEndCmDist);
                 if (insPt<0) {
                     insPt = -insPt - 1;
                 }
                 assert insPt>0;
                 aIndex = 0;
-                bIndex = Math.min(insPt, mapSize-1);
+                bIndex = Math.min(insPt, mapSizeM1);
             }
             int x = basePosition;
             int a = basePos[chrom][aIndex];
@@ -349,30 +349,46 @@ public final class PlinkGenMap implements GeneticMap {
     @Override
     public int basePos(int chrom, double geneticPosition) {
         checkChromIndex(chrom);
-        assert basePos[chrom].length>=2;
+        int minEndBasepairDist = 5_000_000;
+        int mapSizeM1 = genPos[chrom].length - 1;
+        assert mapSizeM1>0;
         assert basePos[chrom].length==genPos[chrom].length;
         int index = Arrays.binarySearch(genPos[chrom], geneticPosition);
         if (index>=0) {
             return basePos[chrom][index];
         } else {
             int insPt = -index-1;
-            if (insPt==genPos[chrom].length) {
-                --insPt;
-                while (genPos[chrom][insPt]==genPos[chrom][insPt-1]) {
-                    --insPt;
+            int aIndex = insPt - 1;
+            int bIndex = insPt;
+            if (aIndex==mapSizeM1) {
+                insPt = Arrays.binarySearch(basePos[chrom], basePos[chrom][mapSizeM1] - minEndBasepairDist);
+                if (insPt<0) {
+                    insPt = -insPt - 2;
+                }
+                assert insPt<mapSizeM1;
+                aIndex = Math.max(insPt, 0);
+                bIndex = mapSizeM1;
+                while (genPos[chrom][aIndex]==genPos[chrom][bIndex] && aIndex>0) {
+                    --aIndex;
                 }
             }
-            else if (insPt==0) {
-                ++insPt;
-                while (genPos[chrom][insPt]==genPos[chrom][insPt-1]) {
-                    ++insPt;
+            else if (bIndex==0) {
+                insPt = Arrays.binarySearch(basePos[chrom], basePos[chrom][0] + minEndBasepairDist);
+                if (insPt<0) {
+                    insPt = -insPt - 1;
+                }
+                assert insPt>0;
+                aIndex = 0;
+                bIndex = Math.min(insPt, mapSizeM1);
+                while (genPos[chrom][aIndex]==genPos[chrom][bIndex] && bIndex<mapSizeM1) {
+                    ++bIndex;
                 }
             }
             double x = geneticPosition;
-            double a = genPos[chrom][insPt-1];
-            double b = genPos[chrom][insPt];
-            int fa = basePos[chrom][insPt-1];
-            int fb = basePos[chrom][insPt];
+            double a = genPos[chrom][aIndex];
+            double b = genPos[chrom][bIndex];
+            int fa = basePos[chrom][aIndex];
+            int fb = basePos[chrom][bIndex];
             double interp = ((x-a)/(b-a)) * (fb-fa);
             if (interp>=Integer.MAX_VALUE) {
                 String s = "Base position exceeds Integer.MAX_VALUE"


=====================================
vcf/WindowIt.java
=====================================
@@ -260,7 +260,7 @@ public class WindowIt<E extends GTRec> implements SampleFileIt<Window<E>> {
                         }
                         int endPos = genMap.basePos(chromIndex, endCm);
                         int overlapEnd = nextList.size();
-                        nextList.add(next);   // ensure at least on record is added
+                        nextList.add(next);   // ensure at least one record is added
                         next = it.hasNext() ? it.next() : null;
                         while (next!=null
                                 && next.marker().chromIndex()==chromIndex



View it on GitLab: https://salsa.debian.org/med-team/beagle/commit/32b96745d1405627d139e59191f7108d2f79f40f

-- 
View it on GitLab: https://salsa.debian.org/med-team/beagle/commit/32b96745d1405627d139e59191f7108d2f79f40f
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20191214/1da894f6/attachment-0001.html>


More information about the debian-med-commit mailing list