PyCogent CookbookΒΆ
Contents:
- Introduction
- Tips for using python
- Manipulating biological data
- Sequences
- Genetic code
- Getting a genetic code
- Translate DNA sequences
- Translate all six frames
- Find out how many stops in a frame
- Translate a codon
- Look up the amino acid corresponding to a single codon
- Or get all the codons for one amino acid
- For a group of amino acids
- Converting the
CodonAlphabet
to codon series - Obtaining the codons from a
DnaSequence
object
- Trees
- Tables
- Structures
- Accessing databases
- Analysis of sequence composition
- Controlling third party applications
- Controlling BLAST
- Building alignments
- Building a tree of life
- Building a tree of life with PyCogent
- Step 0. Set up your python environment
- Step 1: Download sequences from NCBI
- Step 2: Load the sequences
- Step 3: Select a random subset of the sequences
- Step 4: Load the sequences into a SequenceCollection object
- Step 5: Align the sequences using muscle
- Step 6: Build a tree from the alignment using FastTree
- Step 7: Visualize the tree
- Step 8: Save the tree as a PDF
- Extra credit: Alignment filtering
- Starting with Silva sequences (to skip steps of obtaining sequences from NCBI)
- Building a tree of life with PyCogent
- Building phylogenies
- Evolutionary analysis using likelihood
- Specifying substitution models
- Specifying likelihood functions
- Fitting likelihood functions
- Getting statistics out of likelihood functions
- Testing hypotheses
- Determining confidence intervals on MLEs
- Saving results
- Visualising statistics on trees
- Reconstructing ancestral sequences
- Tips for improved performance
- Standard statistical analyses
- Multivariate data analysis
- Community analysis
- alpha diversity
- beta diversity
- Unifrac
- Calculate a UniFrac Distance Matrix and apply PCoA and UPGMA
- Perform pairwise tests of whether samples are significantly different with UniFrac
- Perform a single UniFrac significance test on the whole tree
- P-test
- Perform pairwise tests of whether samples are significantly different with the P-test (Martin, 2002)
- Taxon-based
- Dealing with HTS data
- HPC environments
- Useful Utilities
- Using PyCogent’s optimisers for your own functions
- Fitting a function to a giving set of x and y values
- Identity testing
- One-line if/else statement
- Force a variable to be iterable
- Obtain the index of the largest item
- Obtain the index of the smallest item
- Remove a nesting level
- Convert a nested tuple into a list
- Convert a nested list into a tuple
- Testing if an item is between two values
- Return combinations of items
- Save and load gzip’d files
- Curry a function
- Test to see if an object is iterable
- Test to see if an object is a single char
- Flatten a deeply nested iterable
- Test to determine if
list
oftuple
- Unflatten items to row-width
- Unzip items
- Select items in order
- Obtain the index sort order
- Find overlapping pattern occurrences
- Find multiple pattern occurrences
- Safely remove a trailing underscore
- Create a case-insensitive iterable
- Extract data delimited by differing left and right delimiters
- Invert a dictionary
- Invert a dictionary with multiple keys having the same value
- Get mapping from sequence item to all positions
- Get the first index of occurrence for each item in a sequence
- Get the last index of occurrence for each item in a sequence
- Construct a distance matrix lookup function
- Get all pairs from groups
- Check class types
- Delegate to a separate object
- Wrap a function to hide from a class
- Construct a constrained container
- Check the location of an application