I am very new to using python3 and am hoping to use it to reduce the time I need to spend running Infernal to look for a variety of RNAs in a large collection of bacterial genomes. I am hoping to write a short module in python that will let me sequentially run infernal using a single covariance model on a list of genome files.
At the moment I am trying to use subprocess.run() or subprocess.Popen() to do so.
import subprocess
import os
import glob
genomes = list(glob.glob(os.path.join("/path/to/genomes/", "*.fa")))
for x in files:
subprocess.Popen(args=["cmsearch", "/path/to/covariancemodel/", "genomes"], shell=False)
my issue is I do not know a way to have "genomes" passed as the components of the list within the command.
Is this a way off approach to trying to automate this? If so is there a better way to do it or is there a way to simply pass each file in the list to the cmsearch command?
1 2 3
or1,2,3
or1, 2, 3
or something else? $\endgroup$