This is a test version of Biostars. For the public version, visit https://www.biostars.org.
make markers into 1MB nonoverlapping windows
#!/bin/bash
#PBS -q longlong
#PBS -l nodes=1:ppn=5

if [ -n "$PBS_O_WORKDIR" ]; then
    cd $PBS_O_WORKDIR
fi

for i in $(seq 233515 315320599)
do
    plink  --bfile tg2\
           --chr 1
           --from-bp ${i}\
           --to-bp  ${i+1000000} \
           --allow-no-sex \
           --make-bed\
           --out tg${i}


done

I used plink to make markers into 1Mb windows .The command like this,but I got no answers.I don't know why this happened.

snp gene software error

1 answer

1 ) with

for i in $(seq 233515 315320599)

you filling your memory with the numbers from 233515 315320599 (about 3 Giga bytes in memory)

$ seq 233515 315320599 | wc -c
3,040,571,395

use streaming

 seq 233515 315320599 | while read i; do ...

2) this is not bash:

${i+1000000}

it will always produce

1000000

$ seq 1 2 3 | while read T; do echo -e "${T} to ${T+10000}" ; done
1 to 10000
3 to 10000

what you want is

$ seq 1 2 3 | while read T; do echo -e "${T} to $(($T+10000))" ; done
1 to 10001
3 to 10003

Log in to answer this question.