Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- And here is my script to process vcf file into Circos Plot image:
- #Turn VCF Spots into number counts in region
- for ID in $(ls | grep -P -o '.*(?=(.vcf))')
- do
- if [ ! -f ${ID}.dat.txt ] ;then
- awk '/^#/ {next} {printf("%s\t%d\n",$1,$2-$2%10000);}' ${ID}.vcf | sort | uniq -c | awk '{printf("%s\t%s\t%d\t%s\n",$2,$3,$3+10000,$1);}' > ${ID}.dat.txt
- fi
- done
- for ID in $(ls | grep -P -o '.*(?=(.dat.txt))')
- do
- if [ ! -f ${ID}.chrd.txt ] ;then
- echo process ${ID} changing chromosome id to name
- cp ${ID}.dat.txt ${ID}.chrd.txt
- pids="$pids $!"
- wait $pids
- while read ref_seq chr
- do
- #Convert ref_seq ID into chromosome number
- sed -i s/${ref_seq}/${chr}/g ${ID}.chrd.txt
- pids="$pids $!"
- wait $pids
- done < ref_chr.list
- fi
- if [ ! -f ${ID}.png ] ;then
- echo Create ${ID} config file for circos
- #Input the plot file and the max point
- maxpoint=$(sort -rnk4 ${ID}.chrd.txt | awk '!x[$2]++' | head -1 | cut -f 4)
- sed s/plotfileinput.txt/${ID}.chrd.txt/g vcf_density.conf > ${ID}_vcf_density.conf
- sed -i s/max_point_vale/${maxpoint}/g ${ID}_vcf_density.conf
- pids="$pids $!"
- wait $pids
- echo Drawing ${ID} circos plot
- circos -outputdir ./ -outputfile ${ID} -conf ${ID}_vcf_density.conf
- pids="$pids $!"
- wait $pids
- fi
- rm ${ID}.dat.txt
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement