Created
January 31, 2017 18:29
-
-
Save adefelicibus/e668b2f03c157b3b272c871030c5d0b9 to your computer and use it in GitHub Desktop.
Split a vcf file by samples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for file in *.vcf*; do | |
for sample in `bcftools view -h $file | grep "^#CHROM" | cut -f10-`; do | |
bcftools view -c1 -Oz -s $sample -o ${file/.vcf*/.$sample.vcf.gz} $file | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment