BACKGROUND
whole genome sequencing  now allows researchers to trace ancestry among samples that differ by only a few mutations.
phylogenetic trees inferred from wgs data are a valuable tool for tracing the ancestry of closely related lineages in bacterial pathogen outbreaks.
however, these estimates of shared ancestry may rely on only a handful of data points.
when the resulting phylogenetic trees are used by public health agencies to make public health decisions, such as to define the scope of foodborne outbreaks  <cit> , to identify the source of these outbreaks  and where appropriate to follow-up with regulatory or legal actions, it is particularly important to ensure that the wgs analysis methods used are validated.
one potential source of error is biases in which variable sites  are detected from analysis of the sequencing read data.
snp ascertainment biases can be caused by various factors.
these biases can be affected by analysis parameters, such as using missing data cutoffs  <cit>  or read filtering artifacts  <cit> .
read mapping issues due to choice of reference genome  <cit>  and different mapping algorithms  <cit>  can also result in biases in which variable sites are detected.
phylogenetic error can be exacerbated by interaction among dataset biases and analytic choices; for example, using a model of evolution developed for sequence data on a panel of exclusively variable sites  <cit> , or choosing an inappropriate model of evolution  <cit> .
despite the sheer quantities of genomic data, it is possible that these types of biases could affect phylogenetic conclusions.
if these errors are systematic, analyses can converge to support an incorrect result with high bootstrap confidence.
in order to adopt data analysis pipelines for the regulatory environment it is necessary to understand potential biases in sequence analysis pipelines and validate their use.
simulations are a useful approach to investigating potential biases.
without validated in silico modeling, scientists have to rely on benchmark datasets where the truth can never be truly known.
to help solve this problem, we present treetoreads, a software tool for simulating realistic patterns of sequence variation across phylogenies.
this pipeline may be used to assess the robustness of evolutionary inferences from whole genome data against potential biases inherent in data collection and analysis pipelines.
two key aspects of treetoreads differentiate it from existing simulation alternatives.
first, the variable sites follow a user-specified phylogeny, resulting in more realistic evolutionary patterns.
second, those variable sites are placed in the context of an observed or ‘anchor genome’, which is represented as the tip on that phylogeny.
together, this combination allows researchers to make direct comparisons of wgs read mapping between their observed and simulated reads, and thus makes treetoreads appropriate for testing the effects of distance to a reference genome on phylogenetic inference from genomic data.
that anchor genome can be used as a reference genome for read mapping, or mapping can be tested against other empirically-observed genomes.
in the case of empirically-observed genomes, what separates the reference data from the simulated data constitutes real evolutionary history.
making direct read mapping comparisons to assess reference genome effects cannot be done using alternative simulation software.
implementation
the treetoreads pipeline generates short read data from genomes simulated along an input phylogeny .
the software is written in python and requires a configuration file and two input files - a phylogeny with branch lengths and a fasta formatted genome sequence that serves as the anchor genome.
the user specifies parameter settings  in a configuration file.
the branch lengths of the user-provided phylogeny determine the relative number of mutations on each branch and the probability that a single site is affected by multiple mutational events.
base frequencies are calculated from the composition of the anchor genome.
to account for the ascertainment bias inherent in estimating phylogenies from panels of variable sites, the total number of variable sites is determined by a user input parameter, not the branch lengths.
the pipeline uses seq-gen  <cit>  to simulate variable sites along the input phylogeny under the selected model of evolution.
the locations of mutations in the genome are either drawn from a uniform distribution, or clustered according to parameters of an exponential distribution specified in the configuration file.
for each mutation site, an alignment column is drawn from the seq-gen simulation which has the correct base at the anchor genome, and at least one alternate base at another tip, and the simulated bases are assigned to each tip.
therefore the pattern of evolution at the site fits the phylogeny and model of evolution, but the anchor genome remains unchanged.
this procedure requires the use of a single model of evolution across the genome.
insertions and deletions can be included in the simulation, using indelible  <cit> .
which requires an indel rate parameter and distribution.
the indel rate is scaled per expected substation per site, and therefore the number of insertions and deletion scales with the simulated number of snps.
all insertions are with respect to the reference genome, so the reference remains unchanged, although there are apparent deletions, caused by insertions in other lineages.
the inserted sequences are generated from scratch according to the parameters of the evolutionary model.
the pipeline creates an output folder for each tip in the tree that contains the simulated genomes .
a user-specified tip will consist of the input anchor genome without any mutations.
using these simulated genomes, treetoreads calls the read simulation software, art,  <cit>  to generate illumina miseq paired-end reads.
the user can apply a default sequence error model, or use the configuration file to specify an error model generated for observed data.
treetoreads currently supports automated generation of illumina paired end reads.
for other read types, the simulated genome files may be used outside of treetoreads with any art parameter configuration.
alternatively, if rad-seq like data are desired other raw-read generators such as simrad  <cit>  can be used on the simulated genomes from treetoreads.
if art is invoked in treetoreads the program will output a folder labeled ‘fastq’ containing directories labeled with the names of each tip from the simulation tree, in which the simulated reads are deposited in.fastq.gz formats.
a vcf file with the location and nucleotide state of each mutation as mapped to the anchor genome is also output.
fig.
<dig> schematic of the treetoreads procedure.
a input newick tree file and background/anchor genome.
b simulate mutations across taxa according to defined set of parameters.
c simulate raw reads
RESULTS
to validate the performance of treetoreads, we performed  <dig> replicate analyses under each of two case study conditions then compared the inferences to the simulation parameters.
in the first case study we also assessed the effects of distance to reference genome on inference.
all validation configuration files, input files, analysis scripts and output files are available with the software on github https://github.com/snacktavish/treetoreads.
the first case study used whole genome read data from ten salmonella enterica sequences associated with a  <dig> outbreak, and the observed phylogeny inferred from those data  <cit> .
we used a completed salmonella enterica genome  as the anchor sequence, and simulated  <dig> variable sites under the generalized time reversible  model at an average coverage of  <dig> reads per site.
based on the locations of variable sites in the observed sequence data, the distances between locations for 20% of the variable sites were drawn from an exponential distribution with a 125bp mean.
the locations for the rest of the variable sites were drawn from a uniform distribution across the genome.
the read error profile was based on the observed outbreak sequence data.
for the second case study we simulated data using the reference genome and phylogeny from a listeria outbreak.
the tree and associated metadata are available in the open tree of life data store   <cit> ).
for the validation tests we pruned out multiple replicates of clonal lineages, to create a resolved tree.
we used a completed genome from the outbreak, listeria monocytogenes  as the anchor sequence.
<dig> variable sites were distributed uniformly across the genome.
insertions and deletions were simulated under the lavalette distribution, with a =  <dig>  and a maximum size of  <dig> base pairs  <cit> .
the insertion and deletion rates were equal and  <dig>  times the nucleotide substitution rate.
to demonstrate that sequence data can be simulated without empirical data in hand, for this case study the sequencing error rate was drawn from the defaults provided with art.
reads were simulated at an average coverage of  <dig> reads per site  <cit> .
for each replicate we analyzed the resulting short read datasets using the snp pipeline from the food and drug administration, center for food safety and nutrition  to identify snps in each simulated dataset  <cit> .
the cfsan snp pipeline uses reference-based alignments to create a matrix of snps for a given set of samples.
we used the anchor genomes as the reference genomes for both case studies.
for the first case study, salmonella, we also ran these analyses using a distant reference genome, salmonella enterica typhimurium str.
lt <dig> .
this reference differs from the anchor genome at around  <dig> % percent of sites; approximately  <dig>  nucleotide sites, across the  <dig> , <dig> base pair bareilly outbreak anchor genome , although the exact count depends on alignment choices.
using the called snps we inferred the maximum likelihood phylogeny for each data set using raxml  <cit> .
for the analyses using closely related reference genomes we applied the asc gtrgamma model with a lewis ascertainment bias correction, which corrects for including only variable sites in the analysis  <cit> .
for the analyses using the distant reference genome many called snps were actually fixed differences from the reference and not variable within the alignment.
we used the gtrgamma model with no ascertainment bias correction for phylogenetic analyses on these data.
we then compared the inferences from the data simulated using treetoreads to the input parameters for the topology, number of variable sites, base frequencies, and gtr model of evolution.
we compared the inferred topology to the input topology using robinson–foulds  distances  <cit>  - the symmetric difference in partitions between the input and inferred trees using dendropy  <cit> .
for the listeria example we also compared the indel locations in the simulated alignment to that generated by indelible  <cit> .
we do not independently test the correctness of the results of indelible, but the indel locations were in all cases were identical to those output by indelible.
the input parameters and the mean and standard deviation for inferred parameters across  <dig> replicates are reported in table  <dig>  a representative tree inferred in a single replicate for each parameter set is shown in fig.
<dig>  in all replicates the simulated number of variable sites was exactly the input number of snps, and using closely related reference genomes resulted in correct inferences of nearly all simulated snps.
on average the snp caller misses 1% of variable sites, and there were no false positive snp calls when using closely related references.
using a distant reference genome in the salmonella case study resulted in inference of many ‘variable’ sites  which were actually fixed differences between the reference and the anchor genome.
including these sites which are invariant within the sampled lineages should not be problematic for inference.
however, using this distant reference genome also resulted in inference of at least  <dig> false positive variable sites within the sampled lineages.
these false positives are likely due to mis-mapping of reads onto the divergent reference genome, creating the appearance of variable sites.
these incorrect snp calls resulted in incorrect inferences of phylogenetic structure within the clonal outbreak group .
nonetheless, the key branch, leading to the outbreak lineages, was reconstructed correctly in every replicate, even when reads were mapped to the distant reference.
mapping to the close reference, the resolution of very short branches among the clonal species was effectively arbitrary, as would be expected by inferring bifurcating relationships at a hard polytomy.
no inferred topology exactly matched that of the input tree for the salmonella case study.
as rf distance treats bifurcations equally without respect to branch length, rf distances between the input and inferred trees are high across all of the salmonella replicates.
in the listeria case study every inferred topology matched the input topology exactly.
we do not directly compare branch lengths, as in analyses of exclusively variable sites, branch lengths are challenging to estimate even under an ascertainment bias correction.
nonetheless, when snps were called using a closely related reference genome, the relative branch lengths of the inferred tree reflect those of the input tree.
fig.
<dig> input and inferred trees for two case studies, salmonella enterica bareilly and listeria monocytogenes.
variable sites called for salmonella enterica bareilly by mapping reads to the anchor genome as a reference , and to a reference genome outside of the sampled tree .
listeria monocytogenes reads were mapped to the anchor genome
standard deviations of parameter values shown in parentheses
in the salmonella case study, where there were only  <dig> variable sites, inferences of base frequencies and gtr rate parameters did not match the simulated conditions .
evolutionary rate parameters are difficult to estimate when the observed number of mutations in a single category are rare, and some of the relative rate parameters made certain rate categories  very rare, resulting in high variance across replicates in inferred rates.
however, in the listeria case study, where  <dig> variable sites were simulated, providing sufficient data to accurately infer rates, the simulated input parameters were within one standard deviation of the mean inferences of parameter values .
these examples demonstrate that treetoreads is effectively simulating data under complex evolutionary scenarios.
in straightforward analysis cases, the inferred parameters match almost exactly the input parameters, although this is subject to data set size, and ability to resolve relationships of interest.
although many software tools can simulate sequence data, no existing tools combine phylogenetic relationships with observed genomic sequences.
treetoreads is designed to test the effects of multiple parameters on phylogenetic inference and provides a pipeline to simulate next-gen sequencing reads from a phylogenetic tree using an observed error model.
using an anchor genome as a tip in the simulated tree means that simulated and empirical data can be mapped to the same reference genome, providing direct comparisons of inferences.
in addition, the reference genome does not need to be the anchor genome on which the simulations are based.
if a different reference is used, as in the salmonella analyses with a distance reference, the biological evolution separating the anchor genome from the reference genome includes real evolutionary processes affecting read mapping to genomes in a testable framework.
this provides a greater realism than can be provided by even the most complex available models for simulating sequence evolution.
alternatively, the user can use the simulated data to test reference-free methods for phylogenetic inference, such as multi locus sequence typing   <cit> , or the k-mer based method ksnp  <cit> .
seq-gen  <cit> , used to generate the variable sites in the treetoreads pipeline, uses a full gtr model of evolution with parameters specified by the user.
however, on its own, seq-gen generates random sequences based on the model of evolution and therefore does not incorporate observed genomic context.
consequently, reads from seq-gen-simulated genomes cannot be mapped to observed reference genomes.
this is also true for other simulators of more complex evolutionary processes, such as swge  <cit> .
other sequence simulation software, such as alf  <cit>  and indel seq-gen  <cit> , simulate evolution forward in time, starting from an input genome representing the root of the phylogeny.
however, in empirical data the reference genome is not an ancestor - it is always a present day relative.
anchoring an observed genome to a tip in a tree using treetoreads allows us to test choices about selection of reference genomes in a way that is directly comparable to empirical data.
swge and alf include complex evolutionary processes not simulated in treetoreads, such as recombination across lineages and heterogeneity of the evolutionary model across the genome.
while recombination and horizontal gene transfer  can be important processes, the expectations are challenging to parameterize, as even a few hgt events can lead to phylogenetic networks generating extremely complex ancestral recombination graphs  <cit> .
in order to simulate shifts in relationships along chromosomes it is possible to independently input into treetoreads different tree topologies for different genomic regions, and then combine the reads for these simulations and attempt inference.
treetoreads is designed for testing the robustness of pipelines for estimating bifurcating relationships from next generation sequencing read data.
while inference of branch lengths can be biased by recombination  <cit> , as well as by selection and use of exclusively variable sites to infer phylogenies  <cit> , inference of topology is often robust to recombination  <cit> .
CONCLUSIONS
existing genomic simulation software packages cannot provide a phylogenetic perspective in simulation testing of assembly and alignment tools.
treetoreads allows researchers to test the joint effects of multiple parameter values on the ability of any analysis pipeline to recover the signal and infer the correct tree.
simulating data that spans these parameters can validate methods for reconstructing phylogenies directly from short-read data, which is especially useful for public health agencies tracking emerging pathogens.
availability and requirements
project name: treetoreads
project home page:
https://github.com/snacktavish/treetoreads
operating system: linux, osx
programming language: python
other requirements: dependencies, seq-gen  <cit> , art  <cit> , dendropy  <cit>
licence: this project constitutes a work of the united states government and is not subject to domestic copyright protection under  <dig> usc §  <dig>
abbreviations
snpsingle nucleotide polymorphism
wgswhole genome sequence

 whole genome sequencing now allows researchers to trace ancestry among samples that differ by only a few mutations. phylogenetic trees inferred from wgs data are a valuable tool for tracing the ancestry of closely related lineages in bacterial pathogen outbreaks. however, these estimates of shared ancestry may rely on only a handful of data points. when the resulting phylogenetic trees are used by public health agencies to make public health decisions, such as to define the scope of foodborne outbreaks, to identify the source of these outbreaks and where appropriate to follow-up with regulatory or legal actions, it is particularly important to ensure that the wgs analysis methods used are validated. one potential source of error is biases in which variable sites are detected from analysis of the sequencing read data. snp ascertainment biases can be caused by various factors. these biases can be affected by analysis parameters, such as using missing data cutoffs or read filtering artifacts. read mapping issues due to choice of reference genome and different mapping algorithms can also result in biases in which variable sites are detected. phylogenetic error can be exacerbated by interaction among dataset biases and analytic choices; for example, using a model of evolution developed for sequence data on a panel of exclusively variable sites, or choosing an inappropriate model of evolution. despite the sheer quantities of genomic data, it is possible that these types of biases could affect phylogenetic conclusions. if these errors are systematic, analyses can converge to support an incorrect result with high bootstrap confidence. in order to adopt data analysis pipelines for the regulatory environment it is necessary to understand potential biases in sequence analysis pipelines and validate their use. simulations are a useful approach to investigating potential biases. without validated in silico modeling, scientists have to rely on benchmark datasets where the truth can never be truly known. to help solve this problem, we present treetoreads, a software tool for simulating realistic patterns of sequence variation across phylogenies. this pipeline may be used to assess the robustness of evolutionary inferences from whole genome data against potential biases inherent in data collection and analysis pipelines. two key aspects of treetoreads differentiate it from existing simulation alternatives. first, the variable sites follow a user-specified phylogeny, resulting in more realistic evolutionary patterns. second, those variable sites are placed in the context of an observed or ‘anchor genome’, which is represented as the tip on that phylogeny. together, this combination allows researchers to make direct comparisons of wgs read mapping between their observed and simulated reads, and thus makes treetoreads appropriate for testing the effects of distance to a reference genome on phylogenetic inference from genomic data. that anchor genome can be used as a reference genome for read mapping, or mapping can be tested against other empirically-observed genomes. in the case of empirically-observed genomes, what separates the reference data from the simulated data constitutes real evolutionary history. making direct read mapping comparisons to assess reference genome effects cannot be done using alternative simulation software. implementation the treetoreads pipeline generates short read data from genomes simulated along an input phylogeny. the software is written in python and requires a configuration file and two input files - a phylogeny with branch lengths and a fasta formatted genome sequence that serves as the anchor genome. the user specifies parameter settings in a configuration file. the branch lengths of the user-provided phylogeny determine the relative number of mutations on each branch and the probability that a single site is affected by multiple mutational events. base frequencies are calculated from the composition of the anchor genome. to account for the ascertainment bias inherent in estimating phylogenies from panels of variable sites, the total number of variable sites is determined by a user input parameter, not the branch lengths. the pipeline uses seq-gen to simulate variable sites along the input phylogeny under the selected model of evolution. the locations of mutations in the genome are either drawn from a uniform distribution, or clustered according to parameters of an exponential distribution specified in the configuration file. for each mutation site, an alignment column is drawn from the seq-gen simulation which has the correct base at the anchor genome, and at least one alternate base at another tip, and the simulated bases are assigned to each tip. therefore the pattern of evolution at the site fits the phylogeny and model of evolution, but the anchor genome remains unchanged. this procedure requires the use of a single model of evolution across the genome. insertions and deletions can be included in the simulation, using indelible. which requires an indel rate parameter and distribution. the indel rate is scaled per expected substation per site, and therefore the number of insertions and deletion scales with the simulated number of snps. all insertions are with respect to the reference genome, so the reference remains unchanged, although there are apparent deletions, caused by insertions in other lineages. the inserted sequences are generated from scratch according to the parameters of the evolutionary model. the pipeline creates an output folder for each tip in the tree that contains the simulated genomes. a user-specified tip will consist of the input anchor genome without any mutations. using these simulated genomes, treetoreads calls the read simulation software, art, to generate illumina miseq paired-end reads. the user can apply a default sequence error model, or use the configuration file to specify an error model generated for observed data. treetoreads currently supports automated generation of illumina paired end reads. for other read types, the simulated genome files may be used outside of treetoreads with any art parameter configuration. alternatively, if rad-seq like data are desired other raw-read generators such as simrad can be used on the simulated genomes from treetoreads. if art is invoked in treetoreads the program will output a folder labeled ‘fastq’ containing directories labeled with the names of each tip from the simulation tree, in which the simulated reads are deposited in.fastq.gz formats. a vcf file with the location and nucleotide state of each mutation as mapped to the anchor genome is also output. fig. schematic of the treetoreads procedure. a input newick tree file and background/anchor genome. b simulate mutations across taxa according to defined set of parameters. c simulate raw reads  to validate the performance of treetoreads, we performed replicate analyses under each of two case study conditions then compared the inferences to the simulation parameters. in the first case study we also assessed the effects of distance to reference genome on inference. all validation configuration files, input files, analysis scripts and output files are available with the software on github https://github.com/snacktavish/treetoreads. the first case study used whole genome read data from ten salmonella enterica sequences associated with a outbreak, and the observed phylogeny inferred from those data. we used a completed salmonella enterica genome as the anchor sequence, and simulated variable sites under the generalized time reversible model at an average coverage of reads per site. based on the locations of variable sites in the observed sequence data, the distances between locations for 20% of the variable sites were drawn from an exponential distribution with a 125bp mean. the locations for the rest of the variable sites were drawn from a uniform distribution across the genome. the read error profile was based on the observed outbreak sequence data. for the second case study we simulated data using the reference genome and phylogeny from a listeria outbreak. the tree and associated metadata are available in the open tree of life data store ). for the validation tests we pruned out multiple replicates of clonal lineages, to create a resolved tree. we used a completed genome from the outbreak, listeria monocytogenes as the anchor sequence. variable sites were distributed uniformly across the genome. insertions and deletions were simulated under the lavalette distribution, with a = and a maximum size of base pairs. the insertion and deletion rates were equal and times the nucleotide substitution rate. to demonstrate that sequence data can be simulated without empirical data in hand, for this case study the sequencing error rate was drawn from the defaults provided with art. reads were simulated at an average coverage of reads per site. for each replicate we analyzed the resulting short read datasets using the snp pipeline from the food and drug administration, center for food safety and nutrition to identify snps in each simulated dataset. the cfsan snp pipeline uses reference-based alignments to create a matrix of snps for a given set of samples. we used the anchor genomes as the reference genomes for both case studies. for the first case study, salmonella, we also ran these analyses using a distant reference genome, salmonella enterica typhimurium str. lt. this reference differs from the anchor genome at around % percent of sites; approximately nucleotide sites, across the, base pair bareilly outbreak anchor genome, although the exact count depends on alignment choices. using the called snps we inferred the maximum likelihood phylogeny for each data set using raxml. for the analyses using closely related reference genomes we applied the asc gtrgamma model with a lewis ascertainment bias correction, which corrects for including only variable sites in the analysis. for the analyses using the distant reference genome many called snps were actually fixed differences from the reference and not variable within the alignment. we used the gtrgamma model with no ascertainment bias correction for phylogenetic analyses on these data. we then compared the inferences from the data simulated using treetoreads to the input parameters for the topology, number of variable sites, base frequencies, and gtr model of evolution. we compared the inferred topology to the input topology using robinson–foulds distances - the symmetric difference in partitions between the input and inferred trees using dendropy. for the listeria example we also compared the indel locations in the simulated alignment to that generated by indelible. we do not independently test the correctness of the results of indelible, but the indel locations were in all cases were identical to those output by indelible. the input parameters and the mean and standard deviation for inferred parameters across replicates are reported in table a representative tree inferred in a single replicate for each parameter set is shown in fig. in all replicates the simulated number of variable sites was exactly the input number of snps, and using closely related reference genomes resulted in correct inferences of nearly all simulated snps. on average the snp caller misses 1% of variable sites, and there were no false positive snp calls when using closely related references. using a distant reference genome in the salmonella case study resulted in inference of many ‘variable’ sites which were actually fixed differences between the reference and the anchor genome. including these sites which are invariant within the sampled lineages should not be problematic for inference. however, using this distant reference genome also resulted in inference of at least false positive variable sites within the sampled lineages. these false positives are likely due to mis-mapping of reads onto the divergent reference genome, creating the appearance of variable sites. these incorrect snp calls resulted in incorrect inferences of phylogenetic structure within the clonal outbreak group. nonetheless, the key branch, leading to the outbreak lineages, was reconstructed correctly in every replicate, even when reads were mapped to the distant reference. mapping to the close reference, the resolution of very short branches among the clonal species was effectively arbitrary, as would be expected by inferring bifurcating relationships at a hard polytomy. no inferred topology exactly matched that of the input tree for the salmonella case study. as rf distance treats bifurcations equally without respect to branch length, rf distances between the input and inferred trees are high across all of the salmonella replicates. in the listeria case study every inferred topology matched the input topology exactly. we do not directly compare branch lengths, as in analyses of exclusively variable sites, branch lengths are challenging to estimate even under an ascertainment bias correction. nonetheless, when snps were called using a closely related reference genome, the relative branch lengths of the inferred tree reflect those of the input tree. fig. input and inferred trees for two case studies, salmonella enterica bareilly and listeria monocytogenes. variable sites called for salmonella enterica bareilly by mapping reads to the anchor genome as a reference, and to a reference genome outside of the sampled tree. listeria monocytogenes reads were mapped to the anchor genome standard deviations of parameter values shown in parentheses in the salmonella case study, where there were only variable sites, inferences of base frequencies and gtr rate parameters did not match the simulated conditions. evolutionary rate parameters are difficult to estimate when the observed number of mutations in a single category are rare, and some of the relative rate parameters made certain rate categories very rare, resulting in high variance across replicates in inferred rates. however, in the listeria case study, where variable sites were simulated, providing sufficient data to accurately infer rates, the simulated input parameters were within one standard deviation of the mean inferences of parameter values. these examples demonstrate that treetoreads is effectively simulating data under complex evolutionary scenarios. in straightforward analysis cases, the inferred parameters match almost exactly the input parameters, although this is subject to data set size, and ability to resolve relationships of interest. although many software tools can simulate sequence data, no existing tools combine phylogenetic relationships with observed genomic sequences. treetoreads is designed to test the effects of multiple parameters on phylogenetic inference and provides a pipeline to simulate next-gen sequencing reads from a phylogenetic tree using an observed error model. using an anchor genome as a tip in the simulated tree means that simulated and empirical data can be mapped to the same reference genome, providing direct comparisons of inferences. in addition, the reference genome does not need to be the anchor genome on which the simulations are based. if a different reference is used, as in the salmonella analyses with a distance reference, the biological evolution separating the anchor genome from the reference genome includes real evolutionary processes affecting read mapping to genomes in a testable framework. this provides a greater realism than can be provided by even the most complex available models for simulating sequence evolution. alternatively, the user can use the simulated data to test reference-free methods for phylogenetic inference, such as multi locus sequence typing, or the k-mer based method ksnp. seq-gen, used to generate the variable sites in the treetoreads pipeline, uses a full gtr model of evolution with parameters specified by the user. however, on its own, seq-gen generates random sequences based on the model of evolution and therefore does not incorporate observed genomic context. consequently, reads from seq-gen-simulated genomes cannot be mapped to observed reference genomes. this is also true for other simulators of more complex evolutionary processes, such as swge. other sequence simulation software, such as alf and indel seq-gen, simulate evolution forward in time, starting from an input genome representing the root of the phylogeny. however, in empirical data the reference genome is not an ancestor - it is always a present day relative. anchoring an observed genome to a tip in a tree using treetoreads allows us to test choices about selection of reference genomes in a way that is directly comparable to empirical data. swge and alf include complex evolutionary processes not simulated in treetoreads, such as recombination across lineages and heterogeneity of the evolutionary model across the genome. while recombination and horizontal gene transfer can be important processes, the expectations are challenging to parameterize, as even a few hgt events can lead to phylogenetic networks generating extremely complex ancestral recombination graphs. in order to simulate shifts in relationships along chromosomes it is possible to independently input into treetoreads different tree topologies for different genomic regions, and then combine the reads for these simulations and attempt inference. treetoreads is designed for testing the robustness of pipelines for estimating bifurcating relationships from next generation sequencing read data. while inference of branch lengths can be biased by recombination, as well as by selection and use of exclusively variable sites to infer phylogenies, inference of topology is often robust to recombination.  existing genomic simulation software packages cannot provide a phylogenetic perspective in simulation testing of assembly and alignment tools. treetoreads allows researchers to test the joint effects of multiple parameter values on the ability of any analysis pipeline to recover the signal and infer the correct tree. simulating data that spans these parameters can validate methods for reconstructing phylogenies directly from short-read data, which is especially useful for public health agencies tracking emerging pathogens. availability and requirements project name: treetoreads project home page: https://github.com/snacktavish/treetoreads operating system: linux, osx programming language: python other requirements: dependencies, seq-gen, art, dendropy licence: this project constitutes a work of the united states government and is not subject to domestic copyright protection under usc § abbreviations snpsingle nucleotide polymorphism wgswhole genome sequence 
this simulation pipeline allows direct comparisons of simulated and observed data in a controlled environment. using the same raw read genomic data as input, there are several different approaches being used to infer phylogenetic tree. using phylogenomic analysis tools for tracking pathogens has become standard practice in academia, public health agencies, and large industries. genomicsphylogeneticssimulationoak ridge institute for science and education center for food safety and applied nutrition at the us food and drug administrationissue-copyright-statement© the author 2017 however, despite extensive validation on benchmark datasets and comparison with other pipelines, we lack methods for fully exploring the effects of multiple parameter values in each pipeline that can potentially have an effect on whether the correct phylogenetic tree is recovered.
 using phylogenomic analysis tools for tracking pathogens has become standard practice in academia, public health agencies, and large industries. using the same raw read genomic data as input, there are several different approaches being used to infer phylogenetic tree. these include many different snp pipelines, wgmlst approaches, k-mer algorithms, whole genome alignment and others; each of these has advantages and disadvantages, some have been extensively validated, some are faster, some have higher resolution. a few of these analysis approaches are well-integrated into the regulatory process of us federal agencies. however, despite extensive validation on benchmark datasets and comparison with other pipelines, we lack methods for fully exploring the effects of multiple parameter values in each pipeline that can potentially have an effect on whether the correct phylogenetic tree is recovered.  to resolve this problem, we offer a program, treetoreads, which can generate raw read data from mutated genomes simulated under a known phylogeny. this simulation pipeline allows direct comparisons of simulated and observed data in a controlled environment. at each step of these simulations, researchers can vary parameters of interest to assess the effects of various parameter values on correctly calling snps and reconstructing an accurate tree.  such critical assessments of the accuracy and robustness of analytical pipelines are essential to progress in both research and applied settings. keywords genomicsphylogeneticssimulationoak ridge institute for science and education center for food safety and applied nutrition at the us food and drug administrationissue-copyright-statement© the author 2017 