how to run mscore in bash?
1
0
Entering edit mode
5.2 years ago
MichaelTrev ▴ 10

Hi, I have another question with bash. In the folder, I have 400 result files. I want all result to compare with his reference file.

My file structure looks like:

resFileXXX.fasta
XXX.afa
resFileYYYYYY.fasta
YYYYYY.afa
resFileU.fasta
U.afa

I need to create script comparing this by mscore. mscore command looks that:

mscore -cftit <referenceFile> <restultFile> >output

So in my case it will be something like this:

mscore -cftit XXX.afa resFileXXX.fasta >finalXXX.txt

Can someone tell me how to create a proper script in bash? It's unfamiliar to me yet, and files are too much to do that manually.

Now my script looks like this (didn't work):

#!/bin/bash
ls *.afa | while read A; do B=`echo $A | sed 's/^file/Res/;s/.afa$//'`; ./mscore -cftit $A $B.fasta >     ${B}final.txt; done

It didn't work coz it creates blank files, and they have weird names like XXXresXXX.fasta.afa As I said bash is unfamiliar to me, so I think it's a syntax error. I don't even know that script is in good convention :)

Can someone help with this problem?

bash mscore aligment • 1.2k views
ADD COMMENT
0
Entering edit mode
didn't work

is the most uninformative error message in all of science ;-) Please avoid this and expain what the problem is.

ADD REPLY
0
Entering edit mode

OK! I explained in edit :)

ADD REPLY
0
Entering edit mode
ADD REPLY
1
Entering edit mode
5.2 years ago

input:

$ ls
resFileU.fasta  resFileXXX.fasta  resFileYYYYYY.fasta  U.afa  XXX.afa  YYYYYY.afa

in bash:

$ for i in *.afa; do echo "mscore -cftit $i resFile$i > final${i%.afa}.txt"; done
mscore -cftit U.afa resFileU.afa > finalU.txt
mscore -cftit XXX.afa resFileXXX.afa > finalXXX.txt
mscore -cftit YYYYYY.afa resFileYYYYYY.afa > finalYYYYYY.txt

using GNU-parallel:

$ parallel --dry-run 'mscore -cftit {} resFile{} > final{.}.txt' ::: *.afa       
mscore -cftit U.afa resFileU.afa > finalU.txt
mscore -cftit XXX.afa resFileXXX.afa > finalXXX.txt
mscore -cftit YYYYYY.afa resFileYYYYYY.afa > finalYYYYYY.txt
ADD COMMENT

Login before adding your answer.

Traffic: 1849 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