how to run a command for batch file
1
0
Entering edit mode
9.0 years ago

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 • 3.2k views
ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode
ADD REPLY
0
Entering edit mode
9.0 years ago
dschika ▴ 320

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
ADD COMMENT

Login before adding your answer.

Traffic: 1981 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6