Skip to content

Issue with calling subprocess command #66

@fwzhao

Description

@fwzhao

toolkit/ngs_toolkit/general.py

Lines 1400 to 1408 in 3f828b2

# shuffle input in no background is provided
if background_fasta is None:
shuffled = input_fasta + ".shuffled"
cmd = """
fasta-dinucleotide-shuffle -c 1 -f {0} > {1}
""".format(
input_fasta, shuffled
)
subprocess.call(cmd.split(" "))

The new lines ("\n") and write std_out (">") are causing problems for subprocess.call
I originally encountered this issue when running meme_ame having broken down the command, wehre first there was a Unknown command argument: "\n": "\n", which i was able to trace to the -
"""
cmd
"""
Subsequently after fixing this, subprocess.call does not recognize ">"

The fix:

shuffled = input_fasta + ".shuffled"
file = open(shuffled, "w")
cmd = """fasta-dinucleotide-shuffle -c 1 -f {0}""".format(
    input_fasta
)
subprocess.call(cmd.split(" "), stdout=file)
file.close()

This actually generates the shuffled background. I'm not sure why ">" is not accepted, I did some googling but it was not successful

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions