snp-search: simple processing, manipulation and searching of SNPs from high-throughput sequencing
© Al-Shahib and Underwood; licensee BioMed Central Ltd. 2013
Received: 11 June 2013
Accepted: 18 November 2013
Published: 19 November 2013
A typical bacterial pathogen genome mapping project can identify thousands of single nucleotide polymorphisms (SNP). Interpreting SNP data is complex and it is difficult to conceptualise the data contained within the large flat files that are the typical output from most SNP calling algorithms. One solution to this problem is to construct a database that can be queried using simple commands so that SNP interrogation and output is both easy and comprehensible.
Here we present snp-search, a tool that manages SNP data and allows for manipulation and searching of SNP data. After creation of a SNP database from a VCF file, snp-search can be used to convert the selected SNP data into FASTA sequences, construct phylogenies, look for unique SNPs, and output contextual information about each SNP. The FASTA output from snp-search is particularly useful for the generation of robust phylogenetic trees that are based on SNP differences across the conserved positions in whole genomes. Queries can be designed to answer critical genomic questions such as the association of SNPs with particular phenotypes.
snp-search is a tool that manages SNP data and outputs useful information which can be used to test important biological hypotheses.
KeywordsSingle Nucleotide Polymorphisms (SNP) Variant Call Format (VCF) SQL database High-throughput Sequencing Next Generation Sequencing (NGS) Ruby Phylogeny
Next Generation Sequencing (NGS) technologies have facilitated large scale resequencing of genomes for the purpose of Single Nucleotide polymorphism (SNP) discovery. The thousands of discovered SNPs during such projects can cause some difficulty for biological interpretation and computational analyses.
While these tools have excelled at the management of the SNP data, less attention has been directed towards simple processing and searching of the stored data. For example, the tool developed by Wang et al for SNP management includes limited search functions and does not allow for advanced user database querying. Some databases like that described by Dereeper et al have implemented a web tool for SNP discovery and analysis. However, it does not accept Variant Call Format (VCF) files as input and is only applicable to diploid species. Another tool is SNPpy by Mitha et al which provides a database management system that allows for SQL querying and data manipulation. The SNPpy system is dependent on a relational database (PostgreSQL) that requires considerable expertise to administer and does not accept VCF. VCF files were an initiative from the 1000 Genomes Project  and are an output produced by many SNP calling programs such as dbSNPs , Samtools mpileup  and GATK .
ST315 clade unique SNP information - typical snp-search output for -u option
putative amino acid permease
putative sugar ABC transporter (ATP-binding protein)
putative N-acetylglucosamine-6-phosphate isomerase
putative amino acid ABC transporter (ATP-binding protein)
putative sucrose operon repressor
snp-search is written in Ruby, a popular scripting language, and uses the Ruby ActiveRecord library that maps database tables to Ruby objects. It will run on most modern Unix-based architectures and can be installed with the command gem install snp-search.
Creation of a local SQLite database and schema
To create the database, data is sourced from two input files: reference genome (in genbank or EMBL format) and a VCF file. snp-search requires the reference genome used in the mapping process to import the features (genes, etc) and annotations into the database and requires the VCF file to populate the database tables with the SNP information.
Output requested objects from database
Once the database has been populated, snp-search provides several filtering and output options (Figure 2).
Concatenated FASTA file
SNPs for each sample are collected from the database and concatenated and converted to FASTA format.
Tab-delimited tabular file
Information for individual SNPs are provided in tab-delimited tabular format.
snp-search uses FastTree 2  to generate a Newick file for SNP phylogeny.
Filter SNPs according to the SNP Quality
A Phred-scaled score that the SNP exists at the given site (default 90).
Filter SNPs according to the Genotype Quality
A Phred-scaled score that the genotype is true (also known as Genotype quality score, default 30).
Filter SNPs according to the AD ratio
The ratio of the unfiltered count of all reads that carried that specific allele compared to other REF and ALT alleles in that site (default 0.9).
Ignore SNPs from feature
Ignoring particular SNP calls in features, such as phages, transposases, and insertion sequences to remove horizontally transferred DNA as a result of a recombination event.
Ignore SNPs in specified range
SNPs in a defined specified range will be ignored.
Certain samples can be excluded from the SNP output.
Ignore non-informative SNPs
A SNP that is found in all samples is not included in the output.
Unique SNPs for a set of strains
Given a set of defined strains as input, snp-search queries the database for unique SNPs shared by the defined strains and outputs the results in concatenated FASTA or tabular format.
Concatenated FASTA files are used to generate robust phylogenetic trees that are based on SNP differences across whole core genomes.
Synonymous or non-synonymous SNP. This is calculated by translating the coding sequence and report if the SNP has whether caused an amino acid change or not.
Function of coding region at the SNP position. This is extracted from the annotated genbank file.
Possible pseudogene. If a stop codon is detected in the coding region (other than the end of the sequence).
Original amino acid. Provide the amino acid for the SNP region in the non-mutated sequence.
Has amino acid has changed due to the mutation? An answer of ‘yes’ will be given if there are at least one amino acid changes between the original non-mutated sequence and the mutated sequence.
Is there a change in hydrophobicity of the amino acid? The answer to this question is based on the pre-defined set of hydrophobic and non-hydrophobic amino acids taken from Livingstone et al., : hydrophobic as [I,L,V,C,A,G,M,F,Y,W,H,T] and the non-hydrophobic amino acids as [K,E,Q,D,N,S,P,B].
Is there a change in the polarity of the amino acid? The answer to this question is based on the pre-defined set of polarised and non-polarised amino acids taken from Hausman et al., : polar as [R,N,D,E,Q,H,K,S,T,Y] and non-polar as [A,C,G,I,L,M,F,P,W,V].
Is there a change in size of the amino acid? The answer to this question is based on the pre-defined set of small or non-small set of amino acids taken from Livingstone et al., : small as [V,C,A,G,D,N,S,T,P] and non-small as [I,L,M,F,Y,W,H,K,R,E,Q].
SQLite database can be interrogated by user defined queries (requires some knowledge of SQL). To view, administer and query the database, one may download a SQL GUI tool or simply use the Unix version of sqlite3.
Results and discussions
The snp-search tool was used to generate a SNP database of 200 Group A Streptococcus pyogenes strains (GAS) sequenced using 50 bp reads on the Illumina HiSeq platform. The reads were mapped onto the MGAS315 core genome using the bowtie tool. Samtools mpileup  was used for SNP discovery. The resulting VCF file and the GenBank file from the MGAS315 reference genome were used by snp-search to generate the SNP database. snp-search -output -all_or_filtered_snps was used to generate an ‘alignment’ of the concatenated SNPs from each strain in FASTA format. These SNPs represent positions found in positions conserved in all the genomes, sometimes described as the core genome.
As shown in Figure 4, ST315 clade has 7 unique SNPs, ST406 has 9 and ST15 clades has 1,13 and 33 unique SNPs. The snp-search output for ST315 clade strains is shown in Table 1. For each unique SNP, snp-search identifies whether it is in a coding region or not, and if it is then it reports whether the SNP is synonymous or non-synonymous. Additional information such as the gene and amino acid information is also given.
Create the database:
Now that you have the database plasmid_test_set.sqlite3, you may want to query it. With a simple command it is possible to:
Generate a concatenated FASTA file
Generate a phylogenetic tree to view the evolutionary relationships between your samples
Ignore SNPs that occur in mobile elements
Ignore SNPs in between nucleotide positions 2000 and 2500
Ignore SNPs in samples plasmid1, plasmid4 and plasmid8
Remove non-informative SNPs (SNPs that are found in all samples)
Only select SNPs with a GQ quality cuttoff of greater than 25
Only select SNPs with a SNP QUAL cuttoff of greater than 90 (both GQ and QUAL are quality values derived from the VCF file)
snp-search -output -all_or_filtered_snps -name_of_databaseplasmid_test_set.sqlite3 -fasta -cuttoff_genotype 25 -cuttoff_snp_qual 90 -remove_non_informative_snps -ignore_snps_in_range 2000..2500 -ignore_strains plasmid1,plasmid4,plasmid9 -ignore_snps_on_annotation phage,transposase,transposon,insertion - out plasmid_SNPs_concatenated_file.fasta -tree -fasttree_path /usr/local/bin/fastTree
You may then use any phylogenetic tree viewing software to view your tree.
Further note: In addition to the concatenated FASTA file, SNP positions are provided in two formats: a simple text file and a tsv file.
3 To select SNPs that are shared only between a set of samples, example samples plasmid2, plasmid7, plasmid10, and GQ quality cuttoff of greater than 25 and SNP QUAL cuttoff of greater than 90 you may run the following command (list the sample names on separate in a file called for example ‘samples.txt’):
snp-search -output -name_of_database plasmid_test_set.sqlite3 -unique_snps -strain samples.txt -cuttoff_genotype 25 -cuttoff_snp_qual 90 -out unique_snps. tx.t
4 If you like to output all SNPs, with information about each SNP (e.g. if it is a synonymous or non-synonymous SNP) and with the quality cuttoff values used in the previous commands, you may run the following command:
snp-search -output -name_of_database plasmid_test_set.sqlite3 -info -cuttoff_genotype 25 -cuttoff_snp_qual 90 -out plasmid_info_for_my_snps. txt.
5 Furthermore, if you like to query the database, you may do so by opening the SQLite3 database generated by snp-search with sqlite3 in your Unix environment. The following is an example of a SQL query that can be performed on the snp-search database to select all snps that are associated with features annotated with a term containing the phrase ‘antibiotic’:
SELECT * FROM snps INNER JOIN features_snps ON snps.id = features_snps.snp_id INNER JOIN features ON features.id = features_snps.feature_id WHERE features.id IN (SELECT features.id FROM features WHERE id IN (SELECT DISTINCT features.id FROM features INNER JOIN annotations ON annotations.feature_id = features.id WHERE annotations.value LIKE '%antibiotic%'));
SNP data is now commonly generated, at least for smaller genomes, by mapping whole genome sequencing reads to a reference where both known and novel SNPs can be found. To facilitate and understand these findings, we have developed snp-search, a tool that manages SNP data from high throughput haploid sequence datasets and outputs useful information which in turn can be used to test important biological hypotheses. The main advantages of snp-search are:
- Parses VCF file and stores SNPs in a database
- Designed simple database schema but powerful in answering complex biological queries
- Provides detailed information about each SNP
- Multiple SNPs filtering steps provided including filtering on the function of genes within which the SNPs are found.
- Has no size limit
- Only dependent on sqlite3 to build the database.
Sub-populations of SNPs can be extracted from the database to address specific biological questions, such as whether variation in specific genes is linked to phenotypic differences or does the exclusion of SNPs from horizontally transferred elements generate more reliable phylogenetic inferences.
Availability and requirements
Project name: snp-search
Project home page:https://github.com/phe-bioinformatics/snp-search.
Operating system(s): Unix
Programming language: Ruby
Other requirements: SQLite, Ruby 1.8.7 or greater and optionally FastTree 2 for phylogenetic tree construction
License: GNU General Public License (GPL)
This report is work commissioned by the National Institute of Health Research. The views expressed in this publication are those of the author(s) and not necessarily those of the NHS, the National Institute for Health Research, or the Department of Health. We gratefully acknowledge the support of NIHR for this study. We also like to acknowledge the support of our colleagues in the bioinformatics unit including Jonathan Green, Richard Myers and Kieren Lythgow.
- Dereeper A, Nicolas S, Le Cunff L, Bacilieri R, Doligez A, Peros JP, Ruiz M, This P: SNiPlay: a web-based tool for detection, management and analysis of SNPs. Application to grapevine diversity projects. BMC Bioinformatics. 2011, 12: 134-10.1186/1471-2105-12-134.PubMed CentralView ArticlePubMedGoogle Scholar
- Muñiz-Fernandez F, Carreño-Torres A, Morcillo-Suarez C, Navarro A: Genome-wide association studies pipeline (GWASpi): a desktop application for genome-wide SNP analysis and management. Bioinformatics. 2011, 27: 1871-1872. 10.1093/bioinformatics/btr301.View ArticlePubMedGoogle Scholar
- Mitha F, Herodotou H, Borisov N, Jiang C, Yoder J, Owzar K: SNPpy - database management for SNP data from Genome wide association studies. PLoS One. 2011, 6: 10-View ArticleGoogle Scholar
- Orro A, Guffanti G, Salvi E, Macciardi F, Milanesi L: SNPLims: a data management system for genome wide association studies. BMC Bioinformatics. 2008, 26 (Suppl 2): S13-View ArticleGoogle Scholar
- Wang L, Liu S, Niu T, Xu X: SNPHunter: a bioinformatic software for single nucleotide polymorphism data acquisition and management. BMC Bioinformatics. 2005, 6: 60-10.1186/1471-2105-6-60.PubMed CentralView ArticlePubMedGoogle Scholar
- Zhao LJ, Li MX, Guo YF, Xu FH, Li JL, Deng HW: SNPP: automating large-scale SNP genotype data management. Bioinformatics. 2005, 21: 266-268. 10.1093/bioinformatics/bth486.View ArticlePubMedGoogle Scholar
- López-Fernández H, Glez-Peña D, Reboiro-Jato M, Gómez-López G, Pisano DG, Fdez-Riverola F: PileLineGUI: a desktop environment for handling genome position files in next-generation sequencing studies. Nucl Acids Res. 2011, 39: W562-6. 10.1093/nar/gkr439.PubMed CentralView ArticlePubMedGoogle Scholar
- The 1000 Genomes Project Consortium: A map of human genome variation from population-scale sequencing. Nature. 2010, 467: 1061-1073. 10.1038/nature09534.PubMed CentralView ArticleGoogle Scholar
- Sherry ST, Ward M, Sirotkin K: dbSNP-database for single nucleotide polymorphisms and other classes of minor genetic variation. Genome Res. 1999, 9: 677-679.PubMedGoogle Scholar
- Li H, Handsaker B, Wysoker A, Fennell T, Ruan J, Homer N, Marth G, Abecasis G: Durbin R; 1000 Genome project data processing subgroup. The sequence alignment/Map format and SAMtools. Bioinformatics. 2009, 25: 2078-2079. 10.1093/bioinformatics/btp352.PubMed CentralView ArticlePubMedGoogle Scholar
- McKenna A, Hanna M, Banks E, Sivachenko A, Cibulskis K, Kernytsky A, Garimella K, Altshuler D, Gabriel S, Daly M, DePristo MA: The genome analysis toolkit: a MapReduce framework for analyzing next-generation DNA sequencing data. Genome Res. 2010, 20: 1297-303. 10.1101/gr.107524.110.PubMed CentralView ArticlePubMedGoogle Scholar
- Price MN, Dehal PS, Arkin AP: FastTree 2-approximately maximum-likelihood trees for large alignments. PLoS One. 2010, 10: 5-Google Scholar
- Livingstone CD, Barton GJ: Protein sequence alignments: a strategy for the hierarchical analysis of residue conservation. Comp. Appl. Bio. Sci. 1993, 9: 745-756.Google Scholar
- Hausman RE, Cooper GM: The cell: A Molecular Approach. 2004, Washington, D.C: ASM Press, 51-Google Scholar
- Huson DH, Scornavacca C: Dendroscope 3: an interactive tool for rooted phylogenetic trees and networks. Systematic Biology. 2012Google Scholar
This article is published under license to BioMed Central Ltd. This is an open access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.