Skip to content

Commit

Permalink
Catch exception when there are no short variations between the genomes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mnshgl0110 committed Dec 11, 2024
1 parent df86063 commit 30d4511
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion syri/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.7.0"
__version__ = "1.7.1"
12 changes: 10 additions & 2 deletions syri/pyxFiles/findshv.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,16 @@ def getshv(args, coords, chrlink):
logger.error('Error in finding SNPs using show-snps: ' + out[1].decode())
sys.exit()
else:
allsnps = pd.read_table(cwdpath + prefix + fname, header = None)
logger.debug('finished writing SNPs')
try:
allsnps = pd.read_table(cwdpath + prefix + fname, header = None)
logger.debug('finished writing SNPs')
except pd.errors.EmptyDataError as e:
logger.warning('No SNPs or small indels were identified in the alignments.')
if mapit == 1:
fileRemove(cwdpath + prefix + fname)
with open(cwdpath + prefix + 'snps.txt', "w") as fout:
pass
return None

achrs = pd.unique(allAlignments['aChr'])
bchrs = pd.unique(allAlignments['bChr'])
Expand Down
3 changes: 1 addition & 2 deletions syri/pyxFiles/findsv.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ def getSV(cwdPath, allAlignments, prefix, offset):
logger = logging.getLogger("getSV")
offset = -abs(offset)
fout = open(cwdPath + prefix + "sv.txt", "w")
allAlignments["id"] = allAlignments.group.astype(
"str") + 'Chr' + allAlignments.aChr + 'Chr' + allAlignments.bChr + allAlignments.state
allAlignments["id"] = allAlignments.group.astype("str") + 'Chr' + allAlignments.aChr + 'Chr' + allAlignments.bChr + allAlignments.state
allBlocks = pd.unique(allAlignments.id)

for i in allBlocks:
Expand Down

0 comments on commit 30d4511

Please sign in to comment.