snpmatch

A simple python library to identify the most likely strain from the population

https://github.com/gregor-mendel-institute/snpmatch

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
    Links to: nature.com, zenodo.org
  • Committers with academic emails
    3 of 5 committers (60.0%) from academic institutions
  • Institutional organization owner
    Organization gregor-mendel-institute has institutional domain (www.gmi.oeaw.ac.at)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.0%) to scientific vocabulary

Keywords

1001genomes arabidopsis arageno genotype genotyping genotyping-by-sequencing pipeline snpmatch snps
Last synced: 6 months ago · JSON representation

Repository

A simple python library to identify the most likely strain from the population

Basic Info
Statistics
  • Stars: 9
  • Watchers: 6
  • Forks: 5
  • Open Issues: 2
  • Releases: 21
Topics
1001genomes arabidopsis arageno genotype genotyping genotyping-by-sequencing pipeline snpmatch snps
Created over 9 years ago · Last pushed about 2 years ago
Metadata Files
Readme License

README.md

DOI

SNPmatch

SNPmatch is a Python toolkit which can be used to genotype a sample from as-low-as as 4000 markers from the database lines. SNPmatch can genotype samples efficiently and economically using a simple likelihood approach.

Installation & Usage

The below steps deal with running SNPmatch on a local machine. Also consider using Nextflow when implementing it on your cluster, we have provided best practices scripts here.

Installation using conda

SNPmatch can be easily installed either by conda (provided yml file) or pip. SNPmatch uses various python packages (NumPy, pandas, scikit-allel), which are automatically downloaded. Follow the commands below for successful installation.

```bash

Conda installation, after cloning the repo

conda env create -f environment.yml

or installing SNPmatch from git hub repository

pip install git+https://github.com/Gregor-Mendel-Institute/SNPmatch.git

or PyPi

pip install SNPmatch ```

Database files

Database files containing the known genotype information for many strains have to be provided as HDF5 formatted file. These can be generated with given markers or variants present in a VCF file. The database files can be generated with the functions given in SNPmatch. They are generated using the commands given below.

The below commands require BCFtools executable in the path environment. The database files are read using PyGWAS package. So the VCF files need to have biallelic SNPs only for now.

bash snpmatch makedb -i input_database.vcf -o db

The above command generates three files, * db.csv * db.hdf5 * db.acc.hdf5 * db.csv.json

The two hdf5 files are the main database files used for further analysis. The files have the same information but are chunked for better efficiency. The files db.hdf5 and db.acc.hdf5 are given to the SNPmatch command under -d and -e options respectively.

For Arabidopsis thaliana users, we have made SNP database files for the RegMap and 1001Genomes panel available and can be downloaded here.

If you are working with other genomes, the above command generates a JSON file containing chromosome information. Provide this JSON file in cross and genotype_cross functions under --genome option.

Input file

As the input file, SNPmatch takes genotype information in two file formats (BED and VCF). Example input files are given in the folder sample_files. Briefly, BED files should be three tab-separated column with chromosome, position and genotype shown below.

1 125 0/0 1 284 0/0 1 336 0/0 1 346 1/1 1 353 0/0 1 363 0/0 1 465 0/0 1 471 0/1 1 540 0/0 1 564 0/0 1 597 0/0 1 612 1/1 1 617 0/1 VCF file in a default format in the link. The main arguments required for SNPmatch are CHROM and POS in header and GT in the INFO column. PL (Normalized Phred-scaled likelihoods of the possible genotypes), if present improves the efficiency of SNPmatch.

Usage

SNPmatch can be run as bash commands given below. A detailed manual for each command with -h.

```bash snpmatch inbred -v -i inputfile -d db.hdf5 -e db.acc.hdf5 -o outputfile

or

snpmatch parser -v -i inputfile -o inputnpz snpmatch inbred -v -i inputnpz -d db.hdf5 -e db.acc.hdf5 -o outputfile ```

AraGeno

SNPmatch can be run directly for A. thaliana researchers as a web tool, AraGeno

Output files for inbred

SNPmatch outputs two file, 1. output_file.scores.txt --- tab-separated file

|1|2|3|4|5|6|7|8| |---|---|---|---|---|---|---|---| |8426|4946|4987|0.99|517.57|1.0|5525|4.55| |8427|4861|5194|0.93|4897.21|9.46|5525|4.55| |6191|4368|4933|0.88|8652.07|16.72|5525|4.55|

The column information for the table is strain ID, Number of matched SNPs, Total informative SNPs, Probability of match, Likelihood, Likelihood ratio against best hit, Number of SNPs, Average depth of SNPs respectively. You can filter the strains that do not match the sample by the likelihood ratio value which is chi-square distributed.

  1. output_file.matches.json --- JSON file It might be easier to parse this file using json editor. All the strains that might match to the sample is present in this file. Also a simple interpretation based on the SNPmatch result is provided.

Genotyping a hybrid

SNPmatch can be used to identify hybrid individuals when parental strains are present in database. For such individuals, SNPmatch can be run in windows across the genome. The commands used to run are given below

```bash snpmatch cross -v -d db.hdf5 -e db.acc.hdf5 -i inputfile -b windowsizeinbp -o output_file

to identify the windows matching to each parent in a hybrid

```

These scripts are implemented based on the A. thaliana genome sizes. But please change --genome option by providing JSON file generated while working with other genomes.

Output files for cross

We have three output files for the cross match in SNPmatch 1. output_file.scores.txt --- tab-separated file The file is exactly same as explained before. Additionally, F1 simulated results are appended to the file. 2. output_file.windowscore.txt --- tab-separated file The file provides information on the strains that match to input sample for each window across the genome.

|1|2|3|4|5|6|7|8| |---|---|---|---|---|---|---|---| |1006|11|11|1.0|1.0|1|222|1| |1158|11|11|1.0|1.0|1|222|1| |1166|11|11|1.0|1.0|1|222|1|

Here columns are strain ID, number of SNPs matched, Informative SNPs, Probability of match, Likelihood, Is the window identical to the line? used a simple binomial test, Number of strains that match at this window, window ID (number starting for 1 covering genome linearly). Filtering this table by column 7 having 1 would result in homozygous windows.

  1. output_file.matches.json --- JSON file

The file containing the list of matched strains, list of homozygous windows and strains matched to them and along with a simple interpretation.

Identifying underlying haplotype for a experimental cross

For a given hybird sample and its parents, SNPmatch can determine the underlying haplotype structure (homozygous or heterozygous).

```bash snpmatch genotypecross -v -e db.acc.hdf5 -p "parent1xparent2" -i inputfile -o outputfile -b windowsize

or if parents have VCF files individually

snpmatch genotypecross -v -p parent1.vcf -q parent2.vcf -i inputfile -o outputfile -b windowsize ```

One can implement this by considering a Markhof chain (HMM, requires hmmlearn python package), by running above command using --hmm. The starting probabilities are based on mendel segregation (1:2:1, for F2), might be necessary to change them when implementing for higher crosses. The transition probability matrix is adapted from R/qtl (Browman 2009, doi:10.1007/978-0-387-92125-9).

The output file is a tab delimited file as below.

|1|2|3|4|5|6|7| |---|---|---|---|---|---|---| 1|1|300000|14|1114|NA|1.47,1.64,1.00| 1|300001|600000|19|1248|2|2.46,2.29,1.00| 1|600001|900000|8|1018|2|nan,3.28,1.00| 1|900001|1200000|15|1036|2|2.83,2.59,1.00| 1|1200001|1500000|12|995| 2|2.71,2.71,1.00|

The columns are Chromosome ID, start position of window, end position, number of SNPs from sample in a window, number of segregating SNPs, underlying genotype (0, 1, 2 for homozygous parent1, heterozygous and homozygous parent2), likelihood ratio test statistic for each genotype (or number of SNPs each genotype under HMM).

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Credits

  • Rahul Pisupati (rahul.pisupati[at]gmi.oeaw.ac.at)
  • Ümit Seren (uemit.seren[at]gmi.oeaw.ac.at)

Citation

Pisupati, R. et al.. Verification of Arabidopsis stock collections using SNPmatch, a tool for genotyping high-plexed samples. Nature Scientific Data 4, 170184 (2017). doi:10.1038/sdata.2017.184

Owner

  • Name: GMI: Gregor Mendel Institute of Molecular Plant Biology GmbH
  • Login: Gregor-Mendel-Institute
  • Kind: organization
  • Email: hpcadmin@gmi.oeaw.ac.at
  • Location: Vienna, Austria

GitHub Events

Total
  • Issue comment event: 1
Last Year
  • Issue comment event: 1

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 260
  • Total Committers: 5
  • Avg Commits per committer: 52.0
  • Development Distribution Score (DDS): 0.527
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Rahul r****p@g****m 123
Rahul Pisupati r****i@g****t 103
Pisupati r****i@l****t 30
Ümit Seren t****u 3
Pisupati r****i@l****t 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 17
  • Total pull requests: 3
  • Average time to close issues: 14 days
  • Average time to close pull requests: 15 days
  • Total issue authors: 9
  • Total pull request authors: 2
  • Average comments per issue: 2.76
  • Average comments per pull request: 0.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • rbpisupati (5)
  • timeu (3)
  • dukelheit (2)
  • wyim-pgl (2)
  • dovivi (1)
  • JoseMMuino (1)
  • blthree (1)
  • vinay104 (1)
  • davetang (1)
Pull Request Authors
  • timeu (2)
  • ellisztamas (2)
Top Labels
Issue Labels
question (1) enhancement (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 31 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 14
  • Total maintainers: 1
pypi.org: snpmatch

A simple python library to identify the most likely strain given the SNPs for a sample

  • Versions: 14
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 31 Last month
Rankings
Dependent packages count: 10.0%
Forks count: 15.3%
Average: 17.4%
Stargazers count: 17.7%
Dependent repos count: 21.7%
Downloads: 22.6%
Maintainers (1)
Last synced: 6 months ago

Dependencies

Dockerfile docker
  • continuumio/miniconda3 latest build
environment.yml pypi
setup.py pypi
  • hmmlearn *
  • numpy *
  • pandas *
  • scikit-allel *
  • scipy *