Skip to content

Commit

Permalink
edge case where segment is completely masked (#46)
Browse files Browse the repository at this point in the history
* edge case where segment is completely masked

* Update meta.yaml
  • Loading branch information
andrewkern authored Feb 24, 2023
1 parent 2bc9348 commit d730c11
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions diploshic/makeFeatureVecsForChrArmFromVcfDiploid.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ def readSampleToPopFile(sampleToPopFileName):
for i in range(len(positions))
if segmentStart <= positions[i] <= segmentEnd
]
if len(snpIndicesToKeep) == 0:
sys.exit(
"Error: no SNPs in the given segment of the chr arm; exiting\n"
)
positions = [positions[i] for i in snpIndicesToKeep]
genos = allel.GenotypeArray(genos.subset(sel0=snpIndicesToKeep))

Expand Down
4 changes: 4 additions & 0 deletions diploshic/makeFeatureVecsForChrArmFromVcf_ogSHIC.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ def getSnpIndicesInSubWins(subWinSize, lastSubWinEnd, snpLocs):
for i in range(len(positions))
if segmentStart <= positions[i] <= segmentEnd
]
if len(snpIndicesToKeep) == 0:
sys.exit(
"Error: no SNPs in the given segment of the chr arm; exiting\n"
)
positions = [positions[i] for i in snpIndicesToKeep]
refAlleles = [refAlleles[i] for i in snpIndicesToKeep]
altAlleles = [altAlleles[i] for i in snpIndicesToKeep]
Expand Down
2 changes: 1 addition & 1 deletion meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package:
name: diploshic
version: "0.34"
version: "0.4"

source:
git_url: https://github.com/kr-colab/diploshic
Expand Down

0 comments on commit d730c11

Please sign in to comment.