-
Notifications
You must be signed in to change notification settings - Fork 0
4. Sample identification
Sample identification is performed using the following base command:
gpid identify
Sample identification takes the following arguments:
gpid identify -i <sample directory> -r <reference directory> [-g <gene performance file> -t <thresholds file> -c <confidence support file>] [-s <species groups file>] [-o <output directory>] [-f <output formats>] [--bypass_calibration] [--overwrite_outputs] [--remove_intermediates]
Required:
-
-iSample directory containing one FASTA file per gene for the sample to identify. See Sample directory. -
-rReference directory containing one FASTA file per gene and the corresponding BLAST databases. See Reference directory.
Required but with default file location:
-
-gGene performance file. If not specified, uses filecalibration/calibration_gene_performance.csvproduced bygpid calibrate. See Gene Performance. -
-tFiltering thresholds file. If not specified, uses filecalibration/calibration_filtering_thresholds.csvproduced bygpid calibrate. See Filtering thresholds. -
-cConfidence support file. If not specified, uses filevalidation/validation_confidence_support.csvproduced bygpid validate. See Confidence estimates.
Optional:
-
-sUser-defined groups of closely related species. See Species groups. -
-oOutput directory (default: identification/<sample_name>) -
-fComma-separated output formats:csv,jpg,svg,pdf, orall(default:csv,pdf). See Output formats. -
--bypass_calibrationBypass method calibration and validation by ignoring the-g/-t/-cand using dummy calibration files instead. See Bypass method calibration and validation. -
--overwrite_outputsAllow existing output files in the output directory to be overwritten -
--remove_intermediatesDo not save intermediate files; only keep final output files -
-h,--helpShow this help message
Outputs
GPID represents a sample identification as a Gene Parliament that represents the percentage of genes supporting all competing identifications. By default, two files are produced:
- A table
<Sample_name>_gpid.csvthat summarises the Gene Parliament in tabular form and includes the estimated accuracy of identification. - A figure
<Sample_name>_gpid.pdfthat summarises the Gene Parliament as a type of bar plot called a "lollipop plot". Other output file formats can be specified using the flag-f, see Output formats.
For interpretation of the results, see 5. Interpretation.
GPID analyses one sample at a time. The sample directory needs to contain one file per gene for the sample to be identified. Each file contains a single corresponding gene sequence for the sample.
Requirements:
- Gene sequences need to be in fasta format and ending with an
.FNA,.fastaor.fasuffix - The gene files need to be named with the gene name, and nothing else than the gene name should be included before the
.FNA/.fasta/.fasuffix - Gene names need to match the gene names in the reference dataset.
- Sample names in each file need to be identical.
Example contents of sample directory
Gene1.FNA:
>Sample1
TTGGGAGAAAGGCTGCTGTGGCAGCATGTGGGTGATTATGAGGGTTCAAGAGGGAAAAAT
GGGGATATTAAGATGTTGGTTGCCACGCAGAGGTCGGGGACTGCTGCTGATAAAGTGTTT
GCCTTTTGTGTTATGGTCAGGGATAATCCCGCGGCCAATTTGAGGTCGCTAGTTGCGCTT
Gene2.FNA:
>Sample1
AAAACAAAGCAGCCCGATATTGTAAAAGCAGGTGACCCGGTTCTGCATGAACCGGCAGGA
Gene3.FNA:
>Sample1
AATTACGACCCGAATCTTAGACCGCAAGAGAAGGCGGTGGAGTATGTGCGGGCTCTTACT
GCGGCCAAATTAGAGAAGATTTTTGCAAGACCGTTTATTGGAGCAATGGATGGTCATAGA
Directory containing BLAST databases of the same genes that were retrieved for the sample of interest. Each database contains representative samples of the lineage of interest. The genes retrieved for the sample may only be a subset of the genes in the reference dataset. For example, the reference directory may contain 353 genes, of which 200 were retrieved for a sample. See 1. Reference construction.
Requirements:
- Gene sequences need to be unaligned fasta files that end with a
.FNA,.fastaor.fasuffix. - Each reference sample name needs to start with genus and species name
<Genus>_<species>, followed by a unique identifier for the sample. - Use underscores
_as separators in the sample names. - Sample names in each file need to be identical.
File detailing gene performance, i.e. the percentage of samples correctly identified during method calibration, for all genes.
This file is automatically produced during 2. Method calibration, with the file name calibration/calibration_gene_performance.csv.
Requirements:
- Comma-separated
.csvfile - First column contains gene name, exactly as for the reference and samples to be identified, e.g.
Gene1 - Second column contains gene performance as a percentage, e.g.
58.82
Example gene performance file:
| gene | performance |
|---|---|
| Gene1 | 88.89 |
| Gene2 | 45.16 |
| Gene3 | 62.96 |
| ... | ... |
| Gene353 | 72.48 |
File containing thresholds for gene performance, alignment filtering and parliament size.
This file is automatically produced during 2. Method calibration, with the file name calibration/calibration_filtering_thresholds.csv.
Requirements:
- Comma-separated
.csvfile - First row contains variable names
- Second row contains variable thresholds
Example filtering thresholds file:
| min_similarity | min_length | max_gapopens | max_mismatches | max_evalue | min_bitscore | min_gene_performance | min_parliament_size |
|---|---|---|---|---|---|---|---|
| 98 | 100 | 1 | 5 | 1e-60 | 200 | 30 | 10 |
File containing confidence estimates depending on the percentage of genes supporting the identification.
This file is automatically produced during 3. Method validation, with the file name validation/validation_confidence_support.csv.
Requirements:
- Comma-separated
.csvfile - First column contains the range of percentage of support
- Columns two to four contain the probability of the identification being
correct,closeorwrongfor this range-
correct: correct identification to species -
close: correct identification to species group but not to species (if species groups were specified using-s) -
wrong: incorrect identification to species (and species group, if specified using-s)
-
Example confidence estimates file:
| support | correct | close | wrong |
|---|---|---|---|
| [0,20] | 0 | 0 | 100 |
| (20,40] | 78.57 | 21.43 | 0 |
| (40,60] | 82.14 | 17.86 | 0 |
| (60,80] | 100 | 0 | 0 |
| (80,100] | 100 | 0 | 0 |
File specifying for each species to which user-defined group of closely-related species it belongs, such as species complex or genus.
Requirements:
- Comma-separated
.csvfile - Each row corresponds to a reference species and the corresponding species group
- First column contains genus and species name
- Use underscores
_as separator - Spelling needs to be exactly as for the reference species
- Use underscores
- Second column contains name of species group
Example species group file
File species_groups.csv:
| genus_species | species_group |
|---|---|
| Entandrophragma_angolense | Group_A |
| Entandrophragma_congoense | Group_A |
| Entandrophragma_bussei | Group_B |
| Entandrophragma_candollei | Group_B |
| Entandrophragma_delevoyi | Group_B |
This allows to specify the formats for the output files produced by sample identification. By default, a .csv table and a figure in .pdf format are produced as outputs. The figure can also be saved in .jpg or .svg format.
The selected formats needs to be separated by commas, with no whitespace. For example, -f csv,jpg,svg.
Use --bypass_calibration to ignore the -g, -t and -c flags and instead use dummy calibration files with maximally lenient thresholds that pass all filtering steps.
WARNING: This will most likely result in considerably reduced accuracy of identification. However, doing this may be justified e.g. if a calibration dataset is not available or when conducting a first explorative analysis.
Bypassing method calibration will create the following dummy calibration files:
Dummy gene performance table:
To include all genes in the analyses, set performance to 100 for all genes.
| gene | performance |
|---|---|
| Gene1 | 100 |
| Gene2 | 100 |
| Gene3 | 100 |
| ... | 100 |
| Gene353 | 100 |
Dummy filtering thresholds table:
To disable all filtering, set minimum thresholds to 0 and maximum thresholds to 99999:
| min_similarity | min_length | max_gapopens | max_mismatches | max_evalue | min_bitscore | min_gene_performance | min_parliament_size |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 99999 | 99999 | 99999 | 0 | 0 | 0 |
Dummy confidence estimates table:
To include dummy confidence estimates, specify a single bin from 0 to 100, with NA for all categories:
| range_support | probability_correct | probability_close | probability_wrong |
|---|---|---|---|
| [0,100] | NA | NA | NA |
Upon completion of Sample identification, continue to 5. Interpretation.