Input files

It is pretty easy to set up your files for AccuSNV.

AccuSNV needs three things: a sample sheet, a folder of FASTQ files for each sample, and a directory of reference genome(s).

The sample sheet

The sample sheet contains all of the information for each sample in your set. It is a CSV with one row per sample:

Path,Sample,FileName,Reference,Group,Outgroup,Type
/my_project/raw_reads/,strain1,strain1,Cae_ref,pe_test,0,PE
/my_project/raw_reads/,strain2,strain2,Cae_ref,pe_test,0,PE
/my_project/raw_reads/,strain3,strain3,Cae_ref,pe_test,0,PE
/my_project/raw_reads/,strain4,strain4,Cae_ref,pe_test,0,PE

The header must have these seven columns for each sample:

Path: The folder containing the sample’s FASTQ files.

Sample: A unique name for the sample to use in the AccuSNV outputs.

FileName: The prefix of the sample’s FASTQ read files. Do not include any _1/_2 (or _R1/_R2) suffixes, or the extension. If your files are strainA_1.fastq.gz and strainA_2.fastq.gz, use strainA. Matching is exact, so strainA_1 will not accidentally also match strainA_10.

Reference: The name of a subfolder inside your reference genome directory that holds the genome FASTA this sample should be mapped to.

Group: Samples that share a Group value are analyzed together and separately from everything else. For each group there is one SNV table, one tree and one dN/dS number. Put isolates you want to compare with each other in the same group.

Outgroup: 0 for a normal (ingroup) sample, 1 for an outgroup sample.

Type: PE for paired-end reads or SE for single-end. Lower case works too.

Sample groups

Samples are grouped together into a shared analysis if they are part of the same Group in your SNV table. For example, Groups can refer to separate lineages. Each group can have only one reference FASTA. AccuSNV analyzes each group independently and writes one set of results per group. Your output files will be organized by group. Note that a group needs at least three isolates for the pipeline to be meaningful.

Outgroup samples

An outgroup sample is a distantly related isolate to be used to infer the ancestral allele at each position, and to root the parsimony tree. Outgroup samples are mapped and genotyped like any other sample, but they do not contribute candidate SNV positions. Only ingroup samples are searched for potential SNVs, and then the basecalls of these SNVs are compared to the outgroup(s) to infer the ancestral sequence. Without an outgroup, AccuSNV falls back to a very rough heuristic of taking the most common ingroup allele as the ancestor, so it is best to include at least one outgroup for accurate rooting.

The FASTQ files

AccuSNV does not take FASTQ paths directly. For each sample it looks in the Path folder for files whose name starts with FileName, and finds the FASTQ files that match it.

  • Accepted extensions are .fastq.gz, .fq.gz, .fastq and .fq.

  • For paired-end samples, the two mates have to be distinguishable by a 1 or 2 joined to the prefix with _, . or -, like strainA_1.fq.gz, strainA.R2.fastq, strainA-1.fastq.gz.

  • For single-end samples there must be exactly one matching file.

If two files could be the forward read, or none could, AccuSNV raises an error and tells you which sample and which folder it was looking in.

A typical layout:

/my_project/
├── raw_reads/
│   ├── strain1_1.fastq.gz
│   ├── strain1_2.fastq.gz
│   ├── strain2_1.fastq.gz
│   └── strain2_2.fastq.gz
├── reference_genomes/
│   └── Cae_ref/
│       ├── genome.fasta
│       └── genome.gff
└── samples.csv

Here Path is set to /my_project/raw_reads/ for both samples. One folder per sample also works, which is how the test data is set up.

The reference genome directory

There should be one subfolder per reference genome. Each subfolder needs a FASTA file, and should have a GFF annotation file next to it:

reference_genomes/
├── Cae_ref/
│   ├── genome.fasta
│   └── genome.gff
└── other_species_ref/
    ├── genome.fasta
    └── genome.gff
  • The FASTA can be named genome.fasta, genome.fa or genome.fna, optionally gzipped. AccuSNV looks for genome.* first, then for any other .fasta/.fa/.fna file in the folder.

  • Draft assemblies with many contigs are fine. AccuSNV keeps track of both a genome-wide coordinate, which counts straight through all contigs, and the per-contig coordinate, and reports both in the SNV table.

  • Avoid folder names that start with ref_ or contain _ref_. AccuSNV uses _ref_ as an internal filename separator, so clade1_ref is fine but ref_clade1 is not.

  • The mapping indexes (genome.fasta.bwt, .amb, .ann, .pac, .sa and .fai) are built during the first run. If the reference directory is read-only, build them yourself beforehand with bwa index genome.fasta and samtools faidx genome.fasta.

Annotation files

An annotated GFF is optional, but nearly always worth having. Without it, AccuSNV still finds SNVs and still builds a tree, but cannot identify the genes these SNVs are found in.

AccuSNV identifies the first gff file in a reference genome subdirectory as the annotation file for that genome.

Annotations produced by Prokka or Bakta work, as do the GFF files from NCBI genomes. AccuSNV reads the CDS features, their coordinates and strand, the locus tag, product description, protein ID, GO terms and the translated sequence, and it uses the FASTA to extract each gene’s nucleotide sequence.