SNP Mutator is a single script called
snpmutator. After installation,
it will be on your path, ready to use.
Step 1 - Create a work directory:
$ mkdir workdir $ cd workdir
Step 2 - Gather a reference fasta file:
# For this example we will use a fasta file from our sister project, snp-pipeline $ wget https://raw.githubusercontent.com/CFSAN-Biostatistics/snp-pipeline/master/snppipeline/data/agonaInputs/reference/NC_011149.fasta
Step 3 - Generate the mutated sequences:
# The mutated sequence files are generated in the current working directory # -r 1, set random seed # -n 1000, generate 1000 mutated sequences # -s 900, nine hundred substitutions in each mutated sequence # -i 50, fifty insertion in each mutated sequence # -d 50, fifty deletions in each mutated sequence # -o summary.tsv, generate a mutation summary file called summary.tsv # -v variants.vcf, generate a VCF file of mutations # -p 100000, choose mutations from a pool of 100000 positions # -g 100, partition the 1000 replicates into 10 groups of 100 replicates, with each group having a separate pool of positions # -m, create monomorphic alleles within each pool # -M metrics, generate a metrics output file # -R seq.fasta, generate the contatenated reference fasta file # -F fasta, directory where the fasta replicates will be generated $ snpmutator -r 1 -n 1000 -s 900 -i 50 -d 50 -o summary.tsv -v variants.vcf -p 100000 -g 100 -m -M metrics -R seq.fasta -F fasta NC_011149.fasta
Step 4 - Examine the results:
$ ls NC_011149_mutated_*.fasta $ less summary.tsv $ cat metrics
The only input file is the reference fasta file.
Note: Multi-fasta files may produce unexpected results. All the sequences are concatenated into a single sequence. All description lines after the first are discarded.
An optional summary file in tab-delimited format lists the positions of the mutations for each of the replicates with the original base and the resulting mutation at each position.
An optional VCF file lists the mutations in Variant Call Format.
Multiple mutated replicate files are generated in a directory of your choice. Files are
named with the basename of the original reference file, suffixed with
For example, if the reference file name is
NC_011149.fasta, the first two replicate files
The defline (description) of the generated fasta files is copied from the original reference
fasta file, but with a suffix describing the mutations. For example, the defline suffix
(mutated s=2 i=1 d=0) indicates there are two substitutions, one insertion, and zero deletions.
An optional concatenated reference file can be generated. This is the original fasta file with all the sequences concatenated into a single sequence. All the replicates will be mutations of this file.
--metrics option, a file of metrics is created describing the mutated positions.
--pool option increases the likelihood of multiple replicates having mutations at the
same positions by limiting the number of positions along the genome where mutations will be
introduced. The positions in the pool are choosen randomly and uniformly from the positions
in the genome.
--group option partitions the replicates into groups with each group having a different pool
of eligible positions. This has the effect of creating more closely related replicates within
groups and more distant replicates between groups.
--mono option ensures that when multiple replicates have a mutation at the same position,
the mutation will be identical in each replicate. However, when used with the
--group option, the
monomorphic mutations are only within the group. Different groups of replicates may have polymorphic
alleles with respect to other groups of replicates.
usage: snpmutator [-h] [-o FILE] [-n INT] [-s INT] [-i INT] [-d INT] [-r INT] [-p INT] [-g INT] [-m] [-I SEQID] [-v FILE] [-M FILE] [--version] input_fasta_file Generate mutated sequence files from a reference genome. Takes a fasta file and creates a specified number of randomly generated base substitutions, insertions, and deletions. Outputs the mutated genomes, and optionally, a summary file listing the mutations by position. positional arguments: input_fasta_file Input fasta file. optional arguments: -h, --help show this help message and exit -n INT, --num-simulations INT Number of mutated sequences to generate. (default: 100) -s INT, --num-substitutions INT Number of substitutions. (default: 500) -i INT, --num-insertions INT Number of insertions. (default: 20) -d INT, --num-deletions INT Number of deletions. (default: 20) -r INT, --random-seed INT Random number seed; if not set, the results are not reproducible. (default: None) -p INT, --pool INT Choose variants from a pool of eligible positions of the specified size (default: 0) -g INT, --group INT Group size. When greater than zero, this parameter chooses a new pool of positions for each group of replicates. (default: None) -m, --mono Create monomorphic alleles (default: False) -I SEQID, --seqid SEQID Output fasta description line sequence ID. Each mutated output file has only one sequence. If not specified, the defline id will be the id of the first sequence in the input fasta file. The defline is always suffixed with an annotation in this format: (mutated s=900 i=50 d=50). The seq id is also written to the CHROM column of the output VCF file. (default: None) -R FILE, --ref FILE Output concatenanted reference file with no mutations, but all sequences concatenanted together. All the replicates will be mutations of this file. (default: None) -o FILE, --summary FILE Output positional summary file. (default: None) -v FILE, --vcf FILE Output VCF file. (default: None) -M FILE, --metrics FILE Output metrics file. (default: None) --version show program's version number and exit