Skip to content

CoVarPlot - Covarage Variant Plots for viral whole genome sequencing

License

Notifications You must be signed in to change notification settings

Psy-Fer/CoVarPlot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CoVarPlot

CoVarPlot - Covarage Variant Plots for viral whole genome sequencing

This script was created as part of the interARTIC project, and is the code that generates the output plots.

Please cite InterARTIC if you use this. https://github.com/Psy-Fer/interARTIC

Input currently only supports that generated by the artic pipelines, but should work for any virus, or primer scheme you have used.

data prep

To generate depth plots from bam files and primer scheme, follow these commands using scripts from the artic pipeline. NB: Copies are in the scripts folder, however these are not mine, and all credit should go to the authors at https://github.com/artic-network/fieldbioinformatics. Seriously, they have done an amazing job.

These are normally run in the regular artic pipeline

# install requirements with python3.6 (not sure if other versions will work, but probably)

python3.6 -m pip install pysam pandas Bio

minimap2 -a -x map-ont -t 4 ~/interartic_bin/primer-schemes/eden/nCoV-2019/V1/nCoV-2019.reference.fasta ../plot_thickens_fastq_pass-NB12.fastq | samtools view -bS -F 4 - | samtools sort -o plot_thickens_sample7_NB12.sorted.bam

python3.6 align_trim.py --normalise 200 ~/interartic_bin/primer-schemes/eden/nCoV-2019/V1/nCoV-2019.scheme.bed --start --remove-incorrect-pairs < plot_thickens_sample7_NB12.sorted.bam | samtools sort -T plot_thickens_sample7_NB12 - -o plot_thickens_sample7_NB12.trimmed.rg.sorted.bam

python3.6 align_trim.py --normalise 200 ~/interartic_bin/primer-schemes/eden/nCoV-2019/V1/nCoV-2019.scheme.bed --remove-incorrect-pairs < plot_thickens_sample7_NB12.sorted.bam | samtools sort -T plot_thickens_sample7_NB12 - -o plot_thickens_sample7_NB12.primertrimmed.rg.sorted.bam

samtools index plot_thickens_sample7_NB12.primertrimmed.rg.sorted.bam

python3.6 make_depth_mask.py --store-rg-depths ~/interartic_bin/primer-schemes/eden/nCoV-2019/V1/nCoV-2019.reference.fasta plot_thickens_sample7_NB12.primertrimmed.rg.sorted.bam plot_thickens_sample7_NB12.coverage_mask.txt

Feedback is welcome.

setup

Use python3, and install the libs needed.

python3 -m pip install matplotlib numpy

You might need tk or somthing like it for the --show option if you don't already have it installed.

Run

usage: covarplot.py [-h] [--version] [-v VCF_FILE] [-d1 DEPTH_FILE_1]
                    [-d2 DEPTH_FILE_2] [-b BED] [--show] [-s SAVE] [-l]

Plots for interArtic

optional arguments:
  -h, --help            show this help message and exit
  --version             Prints version
  -v VCF_FILE, --vcf_file VCF_FILE
                        full path to vcf file (default: None)
  -d1 DEPTH_FILE_1, --depth_file_1 DEPTH_FILE_1
                        full path to depth file 1 (default: None)
  -d2 DEPTH_FILE_2, --depth_file_2 DEPTH_FILE_2
                        full path to depth file 2 (default: None)
  -b BED, --bed BED     full path to scheme bed file (default: None)
  --show                Show plot rather than saving it (default: False)
  -s SAVE, --save SAVE  Save path (default: None)
  -l, --log             y-axis log scale (default: False)

Example command:

python3 covarplot.py -v example/plot_thickens_sample12_NB12.pass.vcf.gz -d1 example/plot_thickens_sample12_NB12.coverage_mask.txt.nCoV-2019_1.depths -d2 example/plot_thickens_sample12_NB12.coverage_mask.txt.nCoV-2019_2.depths -b example/nCoV-2019.scheme.bed --show -l

You can also run this plot with JUST the -d1 and -d2 flags, or just the -v flag, and get either a coverage or variant plot respectively. Include the -b flag in each though. (I'll make this option too soon)

Example

About

CoVarPlot - Covarage Variant Plots for viral whole genome sequencing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages