Closed mmpust closed 5 months ago
oh so log file says: /bin/sh: 1: mash: Argument list too long but should not be a problem based on https://github.com/marbl/Mash/issues/179
Okay, can be solved by writing argument list to text file and then taking text files as input for mash.
def make_sketch(outdir, kmer, sketch):
"""
Calculates the distance between the query fasta files
stored in the sketch file by using mash.
Parameters
----------
outdir
string, the path to output directory
option
string, either 'GC' for the gene clusters or 'HG' for the housekeeping genes
returns
----------
"""
outlogfile = os.path.join(outdir, 'log.file')
with open(outlogfile, "wb") as log_file:
try:
outfile = os.path.join(outdir, 'mash_sketch')
inp_files = glob(os.path.join(outdir, 'GC_PROT*'))
inp_txt = os.path.join(outdir, 'input_files.txt')
with open(inp_txt, 'w') as f:
for file in inp_files:
f.write(file + '\n')
cmd_mash = f"mash sketch -o {outfile} -k {kmer} -p 1 -s {sketch} -l {inp_txt}"
#inp = os.path.join(outdir, 'GC_PROT*')
#cmd_mash = f"mash sketch -o {outfile} -k {kmer} -p 1 -s {sketch} -a {inp}"
p = Popen(cmd_mash, shell=True, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
log_file.write(stderr)
except(subprocess.CalledProcessError):
# Raise error here for error table
pass
Hi, I am running the command:
any ideas what the problem is with mash_sketch.msh? Thanks!