{"id":18562790,"url":"https://github.com/gregor-mendel-institute/snpmatch","last_synced_at":"2025-04-10T03:32:13.437Z","repository":{"id":57469010,"uuid":"66452583","full_name":"Gregor-Mendel-Institute/SNPmatch","owner":"Gregor-Mendel-Institute","description":"A simple python library to identify the most likely strain from the population","archived":false,"fork":false,"pushed_at":"2024-01-11T11:34:43.000Z","size":96919,"stargazers_count":9,"open_issues_count":2,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-24T15:52:37.787Z","etag":null,"topics":["1001genomes","arabidopsis","arageno","genotype","genotyping","genotyping-by-sequencing","pipeline","snpmatch","snps"],"latest_commit_sha":null,"homepage":"https://arageno.gmi.oeaw.ac.at/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gregor-Mendel-Institute.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-24T09:52:25.000Z","updated_at":"2023-10-26T09:18:18.000Z","dependencies_parsed_at":"2024-01-11T14:16:12.906Z","dependency_job_id":null,"html_url":"https://github.com/Gregor-Mendel-Institute/SNPmatch","commit_stats":{"total_commits":260,"total_committers":5,"mean_commits":52.0,"dds":0.5269230769230769,"last_synced_commit":"3b69db65ebda0895e872116500fff4a51bf32304"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gregor-Mendel-Institute%2FSNPmatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gregor-Mendel-Institute%2FSNPmatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gregor-Mendel-Institute%2FSNPmatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gregor-Mendel-Institute%2FSNPmatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gregor-Mendel-Institute","download_url":"https://codeload.github.com/Gregor-Mendel-Institute/SNPmatch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248151180,"owners_count":21056037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["1001genomes","arabidopsis","arageno","genotype","genotyping","genotyping-by-sequencing","pipeline","snpmatch","snps"],"created_at":"2024-11-06T22:10:56.409Z","updated_at":"2025-04-10T03:32:08.426Z","avatar_url":"https://github.com/Gregor-Mendel-Institute.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![DOI](https://zenodo.org/badge/66452583.svg)](https://zenodo.org/badge/latestdoi/66452583)\n\n# SNPmatch\n\nSNPmatch 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.\n\n## Installation \u0026 Usage\n\nThe 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](https://github.com/rbpisupati/nf-snpmatch).\n\n### Installation using conda\n\nSNPmatch can be easily installed either by conda (provided yml file) or pip. SNPmatch uses various python packages (NumPy, pandas, [scikit-allel](https://github.com/cggh/scikit-allel)), which are automatically downloaded. Follow the commands below for successful installation.\n\n```bash\n## Conda installation, after cloning the repo\nconda env create -f environment.yml\n## or installing SNPmatch from git hub repository\npip install git+https://github.com/Gregor-Mendel-Institute/SNPmatch.git\n## or PyPi\npip install SNPmatch\n```\n\n### Database files\n\nDatabase 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.\n\nThe 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.\n\n```bash\nsnpmatch makedb -i input_database.vcf -o db\n```\n\nThe above command generates three files,\n  * db.csv\n  * db.hdf5\n  * db.acc.hdf5\n  * db.csv.json\n\nThe 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.\n\nFor *Arabidopsis thaliana* users, we have made SNP database files for the `RegMap` and `1001Genomes` panel available and can be downloaded [here](https://figshare.com/collections/_/3722743).\n\nIf 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.\n\n### Input file\n\nAs the input file, SNPmatch takes genotype information in two file formats (BED and VCF). Example input files are given in the folder [sample_files](https://github.com/Gregor-Mendel-Institute/SNPmatch/tree/master/sample_files). Briefly, BED files should be three tab-separated column with chromosome, position and genotype shown below.\n\n```\n1 125 0/0\n1 284 0/0\n1 336 0/0\n1 346 1/1\n1 353 0/0\n1 363 0/0\n1 465 0/0\n1 471 0/1\n1 540 0/0\n1 564 0/0\n1 597 0/0\n1 612 1/1\n1 617 0/1\n```\nVCF file in a default format in the [link](http://gatkforums.broadinstitute.org/gatk/discussion/1268/what-is-a-vcf-and-how-should-i-interpret-it). 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.\n\n### Usage\n\nSNPmatch can be run as bash commands given below. A detailed manual for each command with -h.\n\n```bash\nsnpmatch inbred -v -i input_file -d db.hdf5 -e db.acc.hdf5 -o output_file\n# or\nsnpmatch parser -v -i input_file -o input_npz\nsnpmatch inbred -v -i input_npz -d db.hdf5 -e db.acc.hdf5 -o output_file\n```\n\n### AraGeno\n\nSNPmatch can be run directly for *A. thaliana* researchers as a web tool, [AraGeno](http://arageno.gmi.oeaw.ac.at)\n\n### Output files for inbred\n\nSNPmatch outputs two file,\n1. `output_file.scores.txt` --- tab-separated file\n\n\n|1|2|3|4|5|6|7|8|\n|---|---|---|---|---|---|---|---|\n|8426|4946|4987|0.99|517.57|1.0|5525|4.55|\n|8427|4861|5194|0.93|4897.21|9.46|5525|4.55|\n|6191|4368|4933|0.88|8652.07|16.72|5525|4.55|\n\nThe 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.\nYou can filter the strains that do not match the sample by the likelihood ratio value which is chi-square distributed.\n\n2. `output_file.matches.json` --- JSON file\nIt might be easier to parse this file using [json editor](https://docs.python.org/2/library/json.html). 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.\n\n## Genotyping a hybrid\n\nSNPmatch 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\n\n```bash\nsnpmatch cross -v -d db.hdf5 -e db.acc.hdf5 -i input_file -b window_size_in_bp -o output_file\n#to identify the windows matching to each parent in a hybrid\n```\n\nThese scripts are implemented based on the *A. thaliana* genome sizes. But please change `--genome` option by providing JSON file [generated](###Database-files) while working with other genomes.\n\n### Output files for cross\nWe have three output files for the cross match in SNPmatch\n1. `output_file.scores.txt` --- tab-separated file\nThe file is exactly same as explained [before](#Output-files-for-inbred). Additionally, F1 simulated results are appended to the file.\n2. `output_file.windowscore.txt` --- tab-separated file\nThe file provides information on the strains that match to input sample for each window across the genome.\n\n|1|2|3|4|5|6|7|8|\n|---|---|---|---|---|---|---|---|\n|1006|11|11|1.0|1.0|1|222|1|\n|1158|11|11|1.0|1.0|1|222|1|\n|1166|11|11|1.0|1.0|1|222|1|\n\nHere 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).\nFiltering this table by column 7 having 1 would result in homozygous windows.\n\n3. `output_file.matches.json` --- JSON file\n\nThe file containing the list of matched strains, list of homozygous windows and strains matched to them and along with a simple interpretation.\n\n\n## Identifying underlying haplotype for a experimental cross\n\nFor a given hybird sample and its parents, SNPmatch can determine the underlying haplotype structure (homozygous or heterozygous).\n\n```bash\nsnpmatch genotype_cross -v -e db.acc.hdf5 -p \"parent1xparent2\" -i input_file -o output_file -b window_size\n# or if parents have VCF files individually\nsnpmatch genotype_cross -v -p parent1.vcf -q parent2.vcf -i input_file -o output_file -b window_size\n```\n\nOne can implement this by considering a Markhof chain (HMM, requires [hmmlearn](https://github.com/hmmlearn/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).\n\nThe output file is a tab delimited file as below.\n\n|1|2|3|4|5|6|7|\n|---|---|---|---|---|---|---|\n1|1|300000|14|1114|NA|1.47,1.64,1.00|\n1|300001|600000|19|1248|2|2.46,2.29,1.00|\n1|600001|900000|8|1018|2|nan,3.28,1.00|\n1|900001|1200000|15|1036|2|2.83,2.59,1.00|\n1|1200001|1500000|12|995| 2|2.71,2.71,1.00|\n\nThe 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).\n\n## Contributing\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request :D\n\n## Credits\n\n- Rahul Pisupati (rahul.pisupati[at]gmi.oeaw.ac.at)\n- Ümit Seren (uemit.seren[at]gmi.oeaw.ac.at)\n\n## Citation\n\nPisupati, R. *et al.*. Verification of *Arabidopsis* stock collections using SNPmatch, a tool for genotyping high-plexed samples.  *Nature Scientific Data*  **4**, 170184 (2017).\n[doi:10.1038/sdata.2017.184](https://www.nature.com/articles/sdata2017184)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregor-mendel-institute%2Fsnpmatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregor-mendel-institute%2Fsnpmatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregor-mendel-institute%2Fsnpmatch/lists"}