ziyewang / MetaBinner

GNU General Public License v3.0
48 stars 6 forks source link

A bug in gen_kmer.py #35

Closed quliping closed 8 months ago

quliping commented 8 months ago

Metabinner is a nice software and performed very well in my data. However, I found a bug in the script 'gen_kmer.py'.

At line 63, you used both 'os.path.dirname(fasta_file)' and 'os.path.splitext(fasta_file)[0]', it seems redundant... 'os.path.dirname' give the path of assembly file, and os.path.splitext()[0] just remove suffix. For example, if fasta_file is '03_connected_assembly/A1.fasta', theoutfile will be '03_connected_assembly/03_connected_assembly/A1_kmer_4_f1000.csv'... This is obviously wrong, isn't it? I think you should just use 'os.path.splitext' like this: outfile = os.path.join(os.path.splitext(fasta_file)[0] +'_kmer_'+ str(kmer_len) + '_f' + str(length_threshold) + '.csv').

image

quliping commented 8 months ago

By the way, I re-worte this part: image

now we can use this script as this: gen_kmer.py path/to/assembly/assembly.fasta 1000 4 path/to/output/dir Among which 'path/to/output/dir' is the output path.

ziyewang commented 8 months ago

Hi,

Since generating k-mer profiles is an independent step, my previous code outputs the k-mer files directly into the contig file folder. Thank you for your suggestion.

Best, Ziye

quliping commented 8 months ago

Hi,

Since generating k-mer profiles is an independent step, my previous code outputs the k-mer files directly into the contig file folder. Thank you for your suggestion.

Best, Ziye

OK~