Changes between Version 14 and Version 15 of SOPs/vcf_manipulation


Ignore:
Timestamp:
03/17/23 10:30:26 (22 months ago)
Author:
gbell
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SOPs/vcf_manipulation

    v14 v15  
    9999}}}
    100100
    101 Extract fields from a VCF file to a TXT, tab separated format with [http://snpeff.sourceforge.net/SnpSift.html#Extract snpSift extractFields] function
     101Extract fields from a VCF file to a TXT, tab separated format with the [http://snpeff.sourceforge.net/SnpSift.html#Extract snpSift extractFields] function
    102102{{{
    103103# Extract chromosome, position, reference base(s), alternate bases(s), all the samples' ADF and ADR (number of high-quality ref-fwd, alt-fwd, ref-reverse, and alt-reverse bases):
     
    107107java -jar SnpSift.jar extractFields foo.vcf CHROM POS REF ALT "GEN[*].ADF[*]" "GEN[*].ADR[*]" > Foo.ADF.ADR.split.vcf
    108108}}}
     109
     110Extract fields from a VCF file to a TXT, tab separated file with the [https://samtools.github.io/bcftools/howtos/query.html bcftools query] function
     111
     112{{{
     113# Extract any fields that are in the INFO or other fields
     114bcftools query -f '%CHROM\t%POS\t%REF\t%ALT\t%AC\t%AN\t%AF\n' gnomad.genomes.r2.1.1.sites.21.vcf.bgz > gnomad.genomes.r2.1.1.sites.21.vcf.AC+AN+AF.txt
     115# Start by keeping only SNPs (so remove indels)
     116bcftools view --types snps gnomad.genomes.r2.1.1.sites.21.vcf.bgz | bcftools query -f '%CHROM\t%POS\t%REF\t%ALT\t%AC\t%AN\n' >| gnomad.genomes.r2.1.1.sites.21.vcf.SNPs_only.AC+AN+AF.txt
     117# Make a bedgraph file using an output value (such as AF for the score)
     118awk -F"\t" '{print "chr"$1 "\t" $2-1 "\t" $2 "\t" $7}' gnomad.genomes.r2.1.1.sites.21.vcf.AC+AN+AF.txt >| gnomad.genomes.r2.1.1.sites.21.AF.bedgraph
     119# Make output a bed file showing the REF and ALT alleles (like "G>C" for QC)
     120awk -F"\t" '{print "chr"$1 "\t" $2-1 "\t" $2 "\t" $3">"$4}' gnomad.genomes.r2.1.1.sites.21.vcf.AC+AN+AF.txt >| gnomad.genomes.r2.1.1.sites.21.bed
     121}}}