This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how to run a command for batch file

Hi all

I am using a shell command for converting xml file format to gff file format

./interproscan.sh -mode convert -f gff3 -i input.xml -b output.gff

which converts an xml file to gff format. But the problem is I am able to run single sequence file at a time. And I have to work on hundred of sequences, which will take much time.

so I want to run this programme for a batch search at a time. how I can manage to do so. I know basic shell command but not able to run a command in loop.

shell linux unix coomand

are the files catchable by a loop? i.e. have they got something/anything exclusively in common?

1 answer

To run the command in a look and assuming you have no other xml files in your folder you could try:

for XML in *xml ; do basename $XML .xml | xargs -n 1 -P 1 -I {} sh -c "./interproscan.sh -mode convert -f gff3 -i {}.xml -b {}.gff" ; done
  • Get all xml file names
  • Get the file name without xml
  • Use xargs to use the result of the basename command in the interproscan command

Log in to answer this question.