Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sum_id=
- for ID in $(ls | grep -P -o '.*(?=(.vcf$))')
- #List all VCF files and Compress / Index
- do
- echo Compress and index the ${ID}.vcf files
- if [ ! -f ${ID}.vcf.gz.tbi ] ;then
- if [ ! -f ${ID}.vcf.gz ] ;then
- bgzip ${ID}.vcf
- pids="$pids $!"
- wait $pids
- fi
- tabix -p vcf ${ID}.vcf.gz
- pids="$pids $!"
- wait $pids
- fi
- done
- for ID in $(ls | grep -P -o '.*(?=(\.vcf.gz$))')
- # Get the ID files in list
- do
- sum_id="$sum_id $ID"
- done
- echo $sum_id
- echo Pick 2 in all IDs
- set -- $sum_id
- # Create ID sets
- for a; do
- if [ "$#" -gt 0 ]; then shift; fi
- for b; do
- printf "%s - %s\n" "$a" "$b"
- bcftools isec -p ${a}_${b} ${a}.vcf.gz ${b}.vcf.gz
- pids="$pids $!"
- echo Finish intersection ${a}_${b}
- wait $pids
- if [ ! -d two_pair ] ;then
- mkdir two_pair
- fi
- cd ${a}_${b}
- mv 0002.vcf ../two_pair/${a}_${b}.vcf
- cd ..
- echo
- echo
- done
- done
- echo Compress and index the two_pair vcf files
- cd two_pair
- for ID in $(ls | grep -P -o '.*(?=(.vcf$))')
- do
- if [ ! -f ${ID}.vcf.gz.tbi ] ;then
- if [ ! -f ${ID}.vcf.gz ] ;then
- echo Compress ${ID}.vcf
- bgzip ${ID}.vcf
- pids="$pids $!"
- wait $pids
- fi
- echo Index ${ID}.vcf
- tabix -p vcf ${ID}.vcf.gz
- pids="$pids $!"
- wait $pids
- fi
- done
- cd ..
- echo Pick 3 in all IDs
- set -- $sum_id
- for a; do
- if [ "$#" -gt 0 ]; then shift; fi
- for b; do
- if [ "$#" -gt 0 ]; then shift; fi
- for c; do
- printf "%s - %s - %s\n" "$a" "$b" "$c"
- bcftools isec -p ${a}_${b}_${c} two_pair/${a}_${b}.vcf.gz ${c}.vcf.gz
- pids="$pids $!"
- echo Finish intersection ${a}_${b}_${c}
- wait $pids
- if [ ! -d three_pair ] ;then
- mkdir three_pair
- fi
- cd ${a}_${b}_${c}
- mv 0002.vcf ../three_pair/${a}_${b}_${c}.vcf
- cd ..
- echo
- echo
- done
- done
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement