Skip to content

Commit d730c11

Browse files
authored
edge case where segment is completely masked (#46)
* edge case where segment is completely masked * Update meta.yaml
1 parent 2bc9348 commit d730c11

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

diploshic/makeFeatureVecsForChrArmFromVcfDiploid.py

+4
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ def readSampleToPopFile(sampleToPopFileName):
141141
for i in range(len(positions))
142142
if segmentStart <= positions[i] <= segmentEnd
143143
]
144+
if len(snpIndicesToKeep) == 0:
145+
sys.exit(
146+
"Error: no SNPs in the given segment of the chr arm; exiting\n"
147+
)
144148
positions = [positions[i] for i in snpIndicesToKeep]
145149
genos = allel.GenotypeArray(genos.subset(sel0=snpIndicesToKeep))
146150

diploshic/makeFeatureVecsForChrArmFromVcf_ogSHIC.py

+4
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ def getSnpIndicesInSubWins(subWinSize, lastSubWinEnd, snpLocs):
123123
for i in range(len(positions))
124124
if segmentStart <= positions[i] <= segmentEnd
125125
]
126+
if len(snpIndicesToKeep) == 0:
127+
sys.exit(
128+
"Error: no SNPs in the given segment of the chr arm; exiting\n"
129+
)
126130
positions = [positions[i] for i in snpIndicesToKeep]
127131
refAlleles = [refAlleles[i] for i in snpIndicesToKeep]
128132
altAlleles = [altAlleles[i] for i in snpIndicesToKeep]

meta.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package:
22
name: diploshic
3-
version: "0.34"
3+
version: "0.4"
44

55
source:
66
git_url: https://github.com/kr-colab/diploshic

0 commit comments

Comments
 (0)