Skip to content

Commit

Permalink
bug fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhemin Zhou committed Aug 31, 2023
1 parent 65ef275 commit fec43d8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 29 deletions.
2 changes: 1 addition & 1 deletion externals/samtools
6 changes: 3 additions & 3 deletions modules/MLSType.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,9 +603,9 @@ def nomenclature(genome, refAllele, parameters) :
try :
qry = os.path.join(dirPath, 'query')
ref = os.path.join(dirPath, 'reference')
with open(qry, 'w') as fout:
with open(qry, 'wt') as fout:
fout.write(genome)
with open(ref, 'wb') as fout:
with open(ref, 'wt') as fout:
fout.write(refAllele)
blasttab = dualBlast().run_comparison(dirPath, qry, ref, parameters['min_iden']-0.1, parameters['min_frag_len']-10)

Expand Down Expand Up @@ -649,7 +649,7 @@ def MLSType(args) :
elif parameters['output'].upper().endswith('GZ') :
fout = gzip.open(parameters['output'], 'wt')
else :
fout = open(parameters['output'], 'w')
fout = open(parameters['output'], 'wt')

fout.write(alleles + '\n')
fout.close()
Expand Down
25 changes: 0 additions & 25 deletions modules/assemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,29 +395,12 @@ def do_spades(self, reads) :
elif len(lib) == 3 :
read_input.append('--pe-1 {0} {1} --pe-2 {0} {2} --pe-s {0} {3}'.format(lib_id+1, lib[0], lib[1], lib[2]))

<<<<<<< HEAD
cmd = '{python} {spades} -t {n_cpu} {read_input} -o {outdir}'.format(
python=sys.executable, read_input=' '.join(read_input), outdir=outdir, **parameters)
spades_run = Popen( cmd.split(' '), stdout=PIPE, bufsize=0, universal_newlines=True)
spades_run.communicate()
if spades_run.returncode != 0 :
sys.exit(20123)
=======
# code used to try with --only-assemble, and if this failed, try without but this was found to giver poorer
# performance with SRR23242239 and no samples where it improved performance so this is now skipped
cmd = '{python} {spades} -t {n_cpu} {read_input} -k {kmer} -o {outdir}'.format(
python=sys.executable, read_input=' '.join(read_input), kmer=kmer, outdir=outdir, **parameters)
spades_run = Popen( cmd.split(' '), stdout=PIPE, bufsize=0, universal_newlines=True)
spades_run.communicate()
if spades_run.returncode != 0 :
# cmd = '{python} {spades} -t {n_cpu} {read_input} -k {kmer} -o {outdir}'.format(
# python=sys.executable, read_input=' '.join(read_input), kmer=kmer,
# outdir=outdir, **parameters)
# spades_run = Popen(cmd.split(' '), stdout=PIPE, bufsize=0, universal_newlines=True)
# spades_run.communicate()
# if spades_run.returncode != 0 :
sys.exit(20123)
>>>>>>> 49ef6b9595e2c317a1a3960b145af8cd189d955e
try :
shutil.copyfile( '{outdir}/scaffolds.fasta'.format(outdir=outdir), output_file )
except :
Expand Down Expand Up @@ -559,17 +542,9 @@ def do_polish(self, reference, reads, onlySNP=False):
# found more in the reads than the reference, implying that the reference is the
# minor allele. Hapog outputs two ratios, just use the value from the first.
diffs = [ [p for p in nn.split('\t')] for nn in (n[0].split('\n')) if len(nn) ]
<<<<<<< HEAD
diffs = [ [names[int(p[0])], int(p[1]), p[2][4:], p[3][5:].upper().replace('-', '')] for p in diffs if float(p[7][7:]) > 0.5 ]
for n, i, o, r in diffs[::-1] :
if not onlySNP or len(r) == 1 :
=======
diffs = [ [names[int(p[0])], int(p[1]), p[2][4:], p[3][5:].upper().replace('-', ''),
float(p[6][7:]),float(p[7][7:])] for p in diffs ]
for n, i, o, r, r1, r2 in diffs[::-1] :
if (not onlySNP or len(r) == 1) and r1 > 0.6:
changes += 1
>>>>>>> 49ef6b9595e2c317a1a3960b145af8cd189d955e
seq[n][i] = r
except Exception as e:
logger('Problem while parsing Hapog output {0}'.format(str(e)))
Expand Down

0 comments on commit fec43d8

Please sign in to comment.