Question: how to run mscore in bash?
0
gravatar for MichaelTrev
9 months ago by
MichaelTrev10
MichaelTrev10 wrote:

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 aligment mscore • 313 views
ADD COMMENTlink modified 9 months ago • written 9 months ago by MichaelTrev10
didn't work

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

ADD REPLYlink written 9 months ago by ATpoint26k

OK! I explained in edit :)

ADD REPLYlink written 9 months ago by MichaelTrev10

Use these for some inspiration :
Bash Script Loop Help
C: looping a list of trimed fasta files to run spades assembler

ADD REPLYlink written 9 months ago by genomax75k
1
gravatar for cpad0112
9 months ago by
cpad011212k
India
cpad011212k wrote:

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 COMMENTlink written 9 months ago by cpad011212k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 700 users visited in the last hour