To loop files and run in mutiple times
1
0
Entering edit mode
10.2 years ago
muralinmars ▴ 100

Hi guys,

It will be great if someone can give some suggestions.

How to loop the body (shown below) to different "chr$" files, where dollar sign take different values (eg. 1,3,5,7,12).

Say for instance, for the first run it takes the value chr1 (and use it in the body) and then chr3 and so on.....

This is the body of the loop file:

/drn/common/u/snn/FAST/FAST.1.8.mc/bin/linux_x86_64/FAST \
       --summary-file /drn/common/data/chr$.simple \
       --hap-file /drn/common/CEU/chr$.hap.gz \
       --pos-file /drn/common/CEU/chr$.hap.ra.gz \
       --out-file /drn/common/output/out_chr$ \
       --gene-set /drn/common/data/chr$.txt \
       --chr $ \
       --mode summary \
       --n-sample 2000 \
       --logistic-vegas-perm \

Thanks a bunch

linux sequencing • 1.3k views
ADD COMMENT
0
Entering edit mode
10.2 years ago

Save the following text as a shell file (test.sh) and run it.

​for i in 1 3 5 7 2
do
    command = `/drn/common/u/snn/FAST/FAST.1.8.mc/bin/linux_x86_64/FAST \
                         --summary-file /drn/common/data/chr"$i".simple \
                         --hap-file /drn/common/CEU/chr"$i".hap.gz \
                         --pos-file /drn/common/CEU/chr"$i".hap.ra.gz \
                         --out-file /drn/common/output/out_chr"$i"\
                         --gene-set /drn/common/data/chr"$i".txt \
                         --chr "$i"\
                         --mode summary \
                         --n-sample 2000 \
                         --logistic-vegas-perm`
    echo $command
done
ADD COMMENT
1
Entering edit mode

I should have refreshed before posting, you beat me by 3 minutes!

ADD REPLY
0
Entering edit mode

Thanks a bunch,, ashutosh,

what does the echo $command do - just curious

ADD REPLY
1
Entering edit mode

It prints the command that you want to run to the screen to ensure that things are working correctly.

ADD REPLY

Login before adding your answer.

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