Skip to main content

smvplot is a cmd line python tool to generate IGV-like screenshots

Project description

smvplot

smvplot is a cmd line python tool to generate IGV-like screenshots.

Install

  • Clone the repository
git clone https://github.com/NagaComBio/smvplot.git
  • Use pip to install the local copy
cd smvplot
pip install .
  • Soon the package will be available via proper pip channel

Usage

$ smvplot --help
usage: smvplot [-h] --bam_paths FILE --bam_names STR --ref FILE [--exclude_flag INT] [--map_quality INT] [--vcf FILE] [--bed FILE] [--annotations FILE] [--prefix PREFIX] [--window N] [--samtoolsbin N] [--tabixbin N]
               [--plot_dir DIR]
               [region]

This script generates a png file for each entry in a vcf file, a bed file or a manually specified region.

positional arguments:
  region              syntax either 'chr:start-end' or 'chr:center', use --vcf or --bed for more convenience

optional arguments:
  -h, --help          show this help message and exit
  --bam_paths FILE    input list of bam files separated by comma. Maximum 3 BAM files
  --bam_names STR     input list of names separated by comma. Same length as BAM files
  --ref FILE          input reference genome file (fastq format)
  --exclude_flag INT  Exclude the reads with corresponding SAM flags, [default = 3840]
  --map_quality INT   Minimum mapping quality for the reads, [default = 20]
  --vcf FILE          input vcf file ( as an alternative use --bed )
  --bed FILE          input bed file ( as an alternative use --vcf )
  --annotations FILE  annotation track indexed with tabix
  --prefix PREFIX     target directory and file name prefix for generated output files
  --window N          the output file for position X will show the region [X-window,X+window], [default = 100]
  --samtoolsbin N     the path to the samtools binary, [default = samtools]
  --tabixbin N        the path to the tabix binary, [default = tabix]
  --plot_dir DIR      subfolder for the pdf plots
  --out_format STR    Output format of the plot, [default = pdf]

Example plots

On the GIAB samples

  1. For a single variant from a single BAM
smvplot 
  --bam_paths HG001_merged.mdup.bam \
  --bam_names HG001 \
  --ref GRCh38_decoy_ebv_phiX_alt_hla_chr.fa \
  --plot_dir ~/smvplot_test \
  --prefix giab_HG001 \
  --out_format png
  chr1:3339544

  1. For a single variant from a TRIO (3 BAMs)
smvplot \
  --bam_paths HG002_merged.mdup.bam,HG003_merged.mdup.bam,HG004_merged.mdup.bam \
  --bam_names HG002_Son,HG003_Father,HG004_Mother \
  --ref GRCh38_decoy_ebv_phiX_alt_hla_chr.fa \
  --plot_dir ~/smvplot_test \
  --prefix giab_HG00234 \
  --out_format png \
  chr1:783175

  1. For multiple variants from a VCF/BED file
smvplot \
  --bam_paths HG002_merged.mdup.bam,HG003_merged.mdup.bam,HG004_merged.mdup.bam \
  --bam_names HG002_Son,HG003_Father,HG004_Mother \
  --ref GRCh38_decoy_ebv_phiX_alt_hla_chr.fa \
  --plot_dir ~/smvplot_test \
  --prefix giab_HG00234 \
  --out_format png \
  --vcf giab_benchmark_variants.vcf # --bed giab_benchmark_variants.vcf

Acknowledgements

The visualize.py was originally written for the tumor-control somatic variants in the DKFZ somatic indel workflow by Philip Ginsbach and Ivo Buchhalter. Since it was really helpful in multiple projects and workflows, I have developed and expanded it into a python package for wider usage.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smvplot-0.0.1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

smvplot-0.0.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file smvplot-0.0.1.tar.gz.

File metadata

  • Download URL: smvplot-0.0.1.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.11.3 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.9.12

File hashes

Hashes for smvplot-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b735d271c5426ddb27ae198a1f7902cbe9ae9cc827bd77dac54252f2a79e0901
MD5 fbadf7a476329240508c0cb852817b18
BLAKE2b-256 72bbbf4a6b5da924fde3d5c51f2b1851ee8ef37b1cea84fd3b4748c98db522a8

See more details on using hashes here.

File details

Details for the file smvplot-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: smvplot-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.11.3 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.9.12

File hashes

Hashes for smvplot-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 431394b03092c2ecb7f6f16ecd1a2429897b36456412afb9ba5b0ca42cad8bb6
MD5 a0fbe690bd73dea7fadcad5f160edb92
BLAKE2b-256 9e10f5cd564e1c36e89556bb5768e678363a73f3b7ee7cf79171648263254e68

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page