Loading main/Main.java +3 −3 Original line number Diff line number Diff line Loading @@ -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. Loading @@ -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; Loading vcf/PlinkGenMap.java +40 −24 Original line number Diff line number Diff line Loading @@ -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]; Loading @@ -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]; Loading @@ -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" Loading vcf/WindowIt.java +1 −1 Original line number Diff line number Diff line Loading @@ -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 Loading Loading
main/Main.java +3 −3 Original line number Diff line number Diff line Loading @@ -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. Loading @@ -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; Loading
vcf/PlinkGenMap.java +40 −24 Original line number Diff line number Diff line Loading @@ -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]; Loading @@ -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]; Loading @@ -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" Loading
vcf/WindowIt.java +1 −1 Original line number Diff line number Diff line Loading @@ -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 Loading