Package: haystac
HAYSTAC: A Bayesian framework for robust and rapid species identification in high-throughput sequencing dataIntroductionhaystacis a light-weight, fast, and user-friendly species identification tool. It evaluates the presence of a
particular species of interest in a metagenomic sample, and provides statistical support for the species assignment.
The method is designed to estimate the probability that a specific taxon is present in a metagenomic sample given a set
of sequencing reads and a database of reference genomes. It works equally well with both modern and ancient DNA sequence
data.Setuphaystaccan be run on either macOS or Linux based systems.The recommended way to installhaystac, and all if its dependencies, is via themambapackage manager (a fast replacement forconda).You can installhaystacusingconda, however, it will take significantly longer to install and analyses will run slower.Install mambaIf you do not have eithermambaorcondaalready installed, please refer to theinstall instructionsformambaforge.If you havecondainstalled, but notmamba, then installmambainto the base environment:condainstall-nbase-cconda-forgemambaInstall haystacThen usemambato installhaystacinto a new environment:mambacreate-cconda-forge-cbioconda-nhaystachaystacAnd activate the environment:condaactivatehaystacWe recommend that you installhaystacinto a new environment to avoid dependency conflicts with other software.Quick Starthaystacconsists of three main modules:databasefor building a database of reference genomessamplefor pre-processing of samples prior to analysisanalysefor analysing a sample against a database1. Build a databaseTo begin usinghaystacwe firstly need to construct a database containing all species of interest to our study. In ourpreprint, we show thathaystacmakes robust species
identifications with genus specific databases (for prokaryotes), allowing for very fast hypothesis driven analyses.In this example, we will build a database containing all species in theYersiniagenus, by supplyinghaystacwith a
simple NBCI search query.haystac database \
    --mode build \
    --query '"Yersinia"[Organism] AND "complete genome"[All Fields]' \
    --output yersinia_dbTo construct an NCBI search query for your area of interest, visit theNCBI Nucleotide databaseand use the search feature to obtain a correctly formatted query string from
the "Search details" box. This search query can be used directly withhaystacto automatically download and build
a reference database based on the accession codes present in the resultset returned by the query.For more exhaustive analyses, you can build a database containing the 5,681 species present in theRefSeq
representativedatabase of prokaryotic species by running:haystac database \
    --mode build \
    --refseq-rep prokaryote_rep \
    --output refseq_dbNote: Building a database this big is not recommended on a laptop computer.2. Prepare a sample for analysisThe second step in usinghaystacis to prepare a sample for analysis.In this example, we will download an aDNA library fromRasmussenet al.(2015),
by givinghaystacthe SRA accession codeERR1018966.
Most published genomics papers include a BioProject code (e.g.PRJEB10885), from which you can obtain SRA accessions for each sequencing
library.haystac sample \
    --sra ERR1018966 \
    --output ERR1018966To prepare a sample of your own, you will need either single-end or paired-end short read sequencing data infastqformat.For a paired-end library, you specify the location of thefastqfiles and the name of
the output directory. You may also choose to collapse overlapping mate pairs (e.g. for an aDNA library).haystac sample \
    --fastq-r1 /path/to/sample1_R1.fq.gz \
    --fastq-r2 /path/to/sample1_R2.fq.gz \
    --collapse True \
    --output sample1By default,haystacwill scan the supplied library, identify adapter sequences, and automatically remove them.3. Analyse a sample against a databaseThe third step in usinghaystacis to perform an analysis of a sample against a database.Here, we will usehaystacto calculate the mean posterior abundance of all species in theYersiniagenus found within
the sampleERR1018966.haystac analyse \
    --mode abundances \
    --database yersinia_db\
    --sample ERR1018966 \
    --output yersinia_ERR1018966When the analysis is complete, there will be several new sub-folders in the output directoryyersinia_ERR1018966/. To
determine if sampleERR1018966containsYersinia pestis(i.e. the plague) we can consult the spreadsheet containing
the mean posterior abundance estimates for all species in theYersiniadatabase (i.e.,yersinia_ERR1018966/probabilities/ERR1018966/ERR1018966_posterior_abundance.tsv). From this, we can see that 3,266
reads were uniquely assigned toYersinia pestis, with an overall abundance of 0.047%, and that the chi-squared test
indicates that the reads are spread evenly across the genome.Before we can confidently conclude thatERR1018966contains ancientYersinia pestis, we may want to perform a
damage pattern analysis.haystac analyse \
    --mode abundances \
    --database yersinia_db\
    --sample ERR1018966 \
    --output yersinia_ERR1018966 \
    --mapdamage TrueUser documentationhaystachas many features and potential uses, and we encourage you to use module help menus (e.g.haystac database --help)
to explore these options. The full user documentation is available here:https://haystac.readthedocs.io/en/master/Reporting errorshaystacis under active development and we encourage you to report any issues you encounter via theGitHub issue
tracker.CitationA preprint describinghaystacis available onbioRxiv:Dimopoulos, E.A.*, Carmagnini, A.*, Velsko, I.M., Warinner, C., Larson, G., Frantz, L.A.F., Irving-Pease, E.K., 2020.
HAYSTAC: A Bayesian framework for robust and rapid species identification in high-throughput sequencing data.bioRxiv2020.12.16.419085.https://www.biorxiv.org/content/10.1101/2020.12.16.419085v1LicenseMIT