This is a test version of Biostars. For the public version, visit https://www.biostars.org.
downloading 1000 genomes project bam files in the background

My question is somehow related to what I asked yesterday. C: downloading bam files of phase 3 of 1000 genomes project

I am trying to download bam files of 1000 genomes project, only for my desired intervals by incorporating samtools -view. As it takes probably more than a day, I want to run it in the background, this is the code that I am using so far (I used & in the end of my code):

wget -q -O - "ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/current.tree" | cut -f 1 | grep '.bam$' | while read B; do echo -n "$B " && /data/programs/samtools-1.3.1/samtools  view -bu "http://ftp.1000genomes.ebi.ac.uk/vol1/$B" "1:115258827-115258827"  && rm *.chrom20.* && rm *.chrom11.* ; done &

I also tried (& disown)

wget -q -O - "ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/current.tree" | cut -f 1 | grep '.bam$' | while read B; do echo -n "$B " && /data/programs/samtools-1.3.1/samtools  view -bu "http://ftp.1000genomes.ebi.ac.uk/vol1/$B" "1:115258827-115258827"  && rm *.chrom20.* && rm *.chrom11.* ; done & disown

However, when I logout, my jobs terminate. My question is how can I download files and run my command that I mention above in the background?

bam

Have a look at GNU screen to run processes in the background. IMHO one of the most useful GNU application, I use it like every day.

look into wrapping your command in nohup and &

option -b activates running wget in background mode

you might also try to execute your cmdline as such

( cmdline ) &

so use () to 'encapsulate' your cmdline. I'm doubting the behaviour of the & on a piped cmdline

0 answers

No answers yet.

Log in to answer this question.