rcedgar / muscle

Multiple sequence and structure alignment with top benchmark scores scalable to thousands of sequences. Generates replicate alignments, enabling assessment of downstream analyses such as trees and predicted structures.
https://drive5.com/muscle
GNU General Public License v3.0
186 stars 21 forks source link

Can muscle be made to take two or more non-file cli arguments (input streams)? [v3.8] #59

Closed rtviii closed 1 year ago

rtviii commented 1 year ago

Can muscle be made to take two (or more) non-file cli arguments?

I realize that one can be piped from stdin. That is what i'm doing currently (Python subprocess snippet). Yet when there are two or more moving pieces this appears super limiting. In the case below i also need to precompute a given "class_profile" and it would have been ideal to be able to send a second stream - into muscl.

    class_profile_path = msa_class_proteovision_path(poly_class)
    cmd = [
        '/home/my/musclepath/muscle3.8',
        '-profile',
        '-in1',
        class_profile_path,
        '-in2',
        '-',
        '-quiet']

    process = subprocess.Popen(cmd,
                               stdout = subprocess.PIPE,
                               stdin  = subprocess.PIPE,
                               stderr = subprocess.PIPE, env = os.environ.copy())

    stdout, stderr = process.communicate(input=fasta_from_string(fasta_target).encode())
    out   ,err     = stdout.decode(), stderr.decode()
    process.wait()

I've looked for unix-y ways to resolve this, but it seems that short of something painful and possibly inconsistent like tricking the program with expects, there is nothing to be done and arguments past -in1(assuming this consumes stdin),-in2,-in3, -inX have to rely on filepaths. I don't think even a synthetic File object works. Am i missing something?

Tried process substituion ./muscle -profile -in1 <( echo $msa1) -in2 <(echo $msa2) -quiet but strings are too long. Getting OSError: [Errno 36] File name too long

Resorted to temporary files in the end.

This is regarding version 3.8 and i would understand if is now offtopic, yet, still wondering. Thanks and kind regards!

rcedgar commented 1 year ago

No idea, sorry.