| 2 | |
| 3 | Create a VCF ([http://en.wikipedia.org/wiki/Variant_Call_Format variant call format]) file [with about any program that identifies variants], such as |
| 4 | * samtools' mpileup+bcftools: |
| 5 | {{{ |
| 6 | samtools mpileup -uf indexed_genome My_mapped_reads.bam | bcftools view -bvcg - >| My_mapped_reads.raw.bcf |
| 7 | samtools mpileup -uf indexed_genome *.bam | bcftools view -bvcg - >| Multiple_samples.raw.bcf |
| 8 | }}} |
| 9 | |
| 10 | Convert from BCF (binary version of VCF) to VCF: |
| 11 | {{{ |
| 12 | bcftools view My_mapped_reads.raw.bcf > My_mapped_reads.raw.vcf |
| 13 | }}} |
| 14 | |
| 15 | Convert from VCF to BCF: |
| 16 | {{{ |
| 17 | bcftools view -bS -D chr_list.txt My_mapped_reads.raw.vcf > My_mapped_reads.raw.bcf |
| 18 | }}} |
| 19 | |
| 20 | Merge multiple VCF files -- works on raw VCF files but apparently not with those processed by vcf-annotate |
| 21 | |
| 22 | {{{ |
| 23 | # For each VCF file: |
| 24 | bgzip Variants_sample_A.raw.vcf |
| 25 | tabix -p vcf Variants_sample_A.raw.vcf.gz |
| 26 | }}} |
| 27 | Merge multiple bgzipped, tabixed files: |
| 28 | {{{ |
| 29 | vcf-merge *.raw.vcf.gz >| Variants_all_samples.raw.vcf |
| 30 | }}} |
| 31 | |
| 32 | Annotate a VCF file (applying all filters with default values): |
| 33 | {{{ |
| 34 | cat Variants_all_samples.raw.vcf | vcf-annotate -f + > Variants_all_samples.withTags.vcf |
| 35 | }}} |
| 36 | |