Package: beastify
beastify: Generate input file for BEAST from whole-genome alignmenntBackgroundSometimes you want to partiion your alignment in to distinct codon positions
(i.e., 1, 2, and 3), and you want to also model non-coding positions in your
BEAST analysis.beastifydoes that for you. It will:Figure out all the codon positions in your reference (including overlapping positions)Optionally, label your sequences with any metadata (e.g., dates)Optionally, allows you to remove one or more positions from the alignmentOptionally, allows you to mask positions form the alignmentOptionally, allows you to sub-sample the alignment (if you want to work on a smaller dataset to test your models before throwing the whole kitchen at BEAST).Output a NEXUS files with the partitions ready for running BEAUTi.Partitions are labelled:For the first codon positionFor the second codon positionFor the third codon positionFor any overlapping codons (sometimes CDS annotations overlap because sometimes bacterial genes will share codons)If position is not found in a CDS.InstallationDependenciesPython >=3.6ClickPandasNumpyBioPythonUsing pippip3 install beastifyTesting your installationbeastify --testInputGenbank referencesnippy*.consensus.subs.fa filesList of genes to include in the final alignmentN (optional) --- random number of genes to select and includeCommand list--out TEXT                Outfile name (default: out.nexus)
  --info TEXT               Path to a tab-delimited file with two or more
                            columns. The first column has the isolate ID, and
                            other columns have dates, location, etc. The
                            information will be added to the isolate ID in the
                            same order as the columns
  --inc_ref                 Whether to include the reference in the final out
                            file (default: False)
  --aln_file TEXT           A sequence alignment file to give in lieu of
                            folder with snippy output.
  --aln_file_format TEXT    If providing an alignment file with --aln_file,
                            set the format of the alignment. Any format
                            supported by BioPython:AlignIO could be valid.
                            Default: fasta. Tested: fasta.
  --subsample INTEGER       Subsample X number of bases at random from each
                            partition. default: all bases
  --subsample_seed INTEGER  Set the seed when subsampling sites. Default:42
  --parts TEXT              Comma-separated list of partitions to include.
                            default:1,2,3,4,5
  --test                    Run beastify tests and exit
  --mask TEXT               A BED file indicating regions to mask from the
                            genome
  --version                 Show the version and exit.
  --help                    Show this message and exit.OutputAnexusformatted file ready forbeast.Script outlineParse coordinates of genes from Genbank into aGenesClassMethods:load_features: a method to load the Genbank features into a
dictionary.Method should check that there
the length is a multiple of 3, and that thestartandendcodons are in place.stopcodon should be stripped.parse_snippycore: a method to load the snippy core.tab data
and identify all variable SNPs among the data that are in
coding regions --- has options to return a 'random' sample
of size N genes, 'top' genes with the most SNPs, with the
N top genes with most SNPs.Data:features: a dictionary with key = genename and value
set by seqFeature object ---IFN is provided, only
keep a random set of genecoords of size _NLoadsnippyalignment into anIsolateClassMethods:load_fasta: will load the sequence into the objectcat_genes: given an isolate id, and a genes object,
return a concatenated sequence (NOT IMPLEMENTED YET)get_gene: return a string with the sequence for the gene specified
by gene_id using aGenesobjectstr: print the sequence ID and length, if there is onegetitem: return the sequence string associated with the keyadd_dates: the user supplies a table of isolate IDs, and dates in
a format suitable for BEAST, and the script adds them to the
identifierData:seq: A SeqRecordid: The isolate idgenes: a dictionary with 'gene_name' as keys and sequence string as
valueCollectionclass to store all theIsolateobjectsMethods:load_isolates: given a list of isolate files, creates
and stores individualIsolateobjects for each.gen_align: given aGenesobject, generate the
alignment --- usescat_genesgetitem: given an isolate ID as a key, return theIsolateobjectData:isolates: a dictionary with isolate id as keys andIsolateobjects as values