Skip to content

Commit

Permalink
FileNotFound error added if input file is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
davve2 committed Apr 15, 2020
1 parent 19c500a commit ff2e288
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CanSNPer2/CanSNPerTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def main():
snpfile=args.snpfile,
database=args.database,
min_required_hits=args.min_required_hits,
keep_going=args.keep_going,
rerun=args.rerun
)

Expand Down
6 changes: 5 additions & 1 deletion CanSNPer2/modules/CanSNPer2.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,12 @@ def run(self,database,organism):
if not self.skip_mauve: print("Run {n} alignments to references using progressiveMauve".format(n=len(self.query)))
for q in self.query: ## For each query file_path
try:
qfile = q.rsplit("/")[-1] ## Remove path from query name
self.query_name = os.path.basename(q).rsplit(".",1)[0] ## get name of file and remove ending

qfile = q.rsplit("/")[-1] ## Remove path from query name
if not os.path.exists(q):
raise FileNotFoundError("Input file: {qfile} was not found!".format(qfile=q))

outputfile = "{outdir}/{xmfa}_{snpfile}".format(outdir=self.outdir,xmfa=self.query_name,snpfile=self.snpfile)
if os.path.exists(outputfile) and not self.rerun:
logger.debug("{outputfile} already exits, skip!".format(outputfile=outputfile))
Expand Down

0 comments on commit ff2e288

Please # to comment.