Skip to content

Commit

Permalink
Major bug fixed
Browse files Browse the repository at this point in the history
The contigs identifier of some assemblers like unicycler is just a number, I opted to standardize all searches using strings
  • Loading branch information
EnzoAndree committed Feb 15, 2021
1 parent 8dc6f45 commit cb404fd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
23 changes: 12 additions & 11 deletions bin/fastmlst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def runMLST(margument):


if __name__ == '__main__':
V = '%(prog)s v0.0.11'
V = '%(prog)s v0.0.12'
parser = argparse.ArgumentParser()
parser.add_argument(type=str, nargs='*', dest='genomes')
parser.add_argument('-t', '--threads', type=int, default=cpu_count(),
Expand All @@ -64,9 +64,9 @@ if __name__ == '__main__':
help='Set a scheme target (I am not dumb, let me choose a scheme by myself!)')
parser.add_argument('--scheme-list', action='store_true',
help='Show all schemes supported')
parser.add_argument('-fo', '--fastaoutput', type=str, default='mlst.fasta',
parser.add_argument('-fo', '--fastaoutput', type=str, default='',
help='File name of the concatenated alleles output' +
' (default mlst.fasta)')
' (default "")')
parser.add_argument('-to', '--tableoutput', type=str, default=stdout,
help='File name of the MLST table output' +
' (default STDOUT)')
Expand Down Expand Up @@ -201,14 +201,15 @@ if __name__ == '__main__':
str_alleles += genome.str_st
str_alleles += '\n'
dict_alleles.append(genome.dict_st)
if args.fasta2line:
SeqIO.write(fastaconcat, args.fastaoutput, 'fasta-2line')
if args.novel:
SeqIO.write(fastanovelconcat, args.novel, 'fasta-2line')
else:
SeqIO.write(fastaconcat, args.fastaoutput, 'fasta')
if args.novel:
SeqIO.write(fastanovelconcat, args.novel, 'fasta')
# FastMLSTv0.0.12 by default do not write the fasta file
if args.fasta2line and args.fastaoutput != '':
SeqIO.write(fastaconcat, args.fastaoutput, 'fasta-2line')
if args.novel:
SeqIO.write(fastanovelconcat, args.novel, 'fasta-2line')
elif args.fastaoutput != '':
SeqIO.write(fastaconcat, args.fastaoutput, 'fasta')
if args.novel:
SeqIO.write(fastanovelconcat, args.novel, 'fasta')

# output formated
if type(args.tableoutput) == str:
Expand Down
2 changes: 2 additions & 0 deletions fastmlst/mlst.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ def blast_filter(self, blast_out):
dfblast['coverage'] = (dfblast.length - dfblast.gaps) / dfblast.slen
dfblast['identity'] = (dfblast.nident - dfblast.gaps) / dfblast.slen # this is a 'global' %identity
dfblast[toint] = dfblast[toint].astype(int)
# Bug Fixed on FastMLSTv0.0.12: The contigs identifier of some assemblers like unicycler is just a number, I opted to standardize all searches using strings
dfblast['qseqid'] = dfblast['qseqid'].astype(str)
# don't even look at the hits below these cov's and identities
dfblast = dfblast.loc[(dfblast['coverage'] <= 1) & (dfblast['coverage'] >= self.coverage) & (dfblast['identity'] >= self.identity)] # insertions can not be processed properly yet
# dfblast = dfblast.loc[dfblast['slen'] >= dfblast['length']] # if have an insertion slen < length
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup

setup(name='fastmlst',
version='0.0.11',
version='0.0.12',
description='A multi-core tool for multilocus sequence typing of draft genome assemblies using PubMLST typing schemes',
url='https://github.com/EnzoAndree/FastMLST',
author='Enzo Guerrero-Araya',
Expand Down

0 comments on commit cb404fd

Please sign in to comment.