Difference between revisions of "BIO Assignment Week 7"

From "A B C"
Jump to navigation Jump to search
m
m
 
(33 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<div id="BIO">
 
<div id="BIO">
 
<div class="b1">
 
<div class="b1">
Assignment for Week 8<br />
+
Assignment for Week 7<br />
<span style="font-size: 70%">Homology Modeling</span>
+
<span style="font-size: 70%">Phylogenetic Analysis</span>
 
</div>
 
</div>
 +
<table style="width:100%;"><tr>
 +
<td style="height:30px; vertical-align:middle; text-align:left; font-size:80%;">[[BIO_Assignment_Week_6|&lt;&nbsp;Assignment&nbsp;6]]</td>
 +
<td style="height:30px; vertical-align:middle; text-align:right; font-size:80%;">[[BIO_Assignment_Week_8|Assignment&nbsp;8&nbsp;&gt;]]</td>
 +
</tr></table>
  
 
{{Template:Inactive}}
 
{{Template:Inactive}}
  
Concepts and activities (and reading, if applicable) for this assignment will be topics on next week's quiz.  
+
<!-- Concepts and activities (and reading, if applicable) for this assignment will be topics on next week's quiz. -->
  
  
Line 13: Line 17:
  
  
&nbsp;
+
{{vspace}}
==Introduction==
+
 
 +
 
 +
 
 +
<div class="quote-box">
 +
{{Vspace}}
 +
 
 +
;Nothing in Biology makes sense except in the light of evolution.
 +
:''Theodosius Dobzhansky''
 +
</div>
 +
 
 +
... but does evolution make sense in the light of biology?
 +
 
 +
{{Vspace}}
 +
----
 +
{{Vspace}}
 +
 
 +
<div class="colmask doublepage">
 +
  <div class="colleft">
 +
    <div class="col1">
 +
      <!-- Column 1 start -->
 +
 
 +
As we have seen in the previous assignments, the Mbp1 transcription factor has homologues in all other fungi, yet there is not always a clear one-to-one mapping between members of a family in distantly related species. It appears that various systems of APSES domain transcription factors have evolved independently. Of course this bears directly on our notion of function - what it means to say that two genes in different organisms have the "same" function. In case two organisms both have an orthologous gene for the same, distinct function, calling these functions "the same" may be warranted. But what if that gene has duplicated in one species, and the two paralogues now perform different, related functions in one organism? Theses two are still orthologues to both their homologues in the other species, but now we expect functionally significant residues to have adapted to the new - and possibly distinct - roles of each paralogue. In order to be able to even ask such questions, we need to make the evolutionary history of gene families explicit. This is the domain of '''phylogenetic analysis'''. We can ask questions like: how many paralogues did the cenancestor of a clade possess? Which of these underwent additional duplications in the phylogenesis of the organism I am studying? Did any genes get lost? And - adding additional biological insight to the picture - did the observed duplications lead to the "invention" of new biological systems? When was that? And perhaps even: how did the species benefit from this event?
 +
 
 +
We will develop this kind of analysis in this assignment. In the previous assignment you have established which gene in your species is the reciprocally most closely related orthologue to yeast Mbp1 (with ''reciprocal best match'') and you have identified the full complement of APSES domain genes in your assigned organism (as a result of your PSI-BLAST search). In this assignment, we will analyse these genes' evolutionary relationship and compare it to the evolutionary relationship of other fungal APSES domains. The goal is to define families of related transcription factors and their evolutionary history. All APSES domain annotations are now available in your protein "database". Now we will attempt to compute the phylogram for these proteins. The goal is to identify orthologues and paralogues. <!-- Optionally, you will look at structural and functional conservation of residues. Future: add ankyrin domains to APSES domains. -->
 +
 
 +
A number of excellent tools for phylogenetic analysis exist; ''general purpose packages'' include the (free) [http://evolution.genetics.washington.edu/phylip.html '''PHYLIP'''] package, the [http://www.megasoftware.net/ '''MEGA''' package] and the (commercial) PAUP* package. Of these, only MEGA is still under active development, although PHYLIP still functions perfectly (except for problems with graphical windows under Mac OS 10.6). ''Specialized tools'' for tree-building include Treepuzzle or Mr. Bayes. This assignment is constructed around programs that are available in PHYLIP, however you are welcome to use other tools that fulfill a similar purpose if you wish. In this field, researchers consider trees that have been built with ML (maximum likelihood) methods to be more reliable than trees that are built with parsimony methods, or distance methods such as NJ (Neighbor Joining). However ML methods are also much more compute-intensive. Just like with multiple sequence alignments, some algorithms will come closer to guessing the truth and others will not and usually it is hard to tell which is the more trustworthy of two diverging results. The prudent researcher tries out alternatives and forms her own opinion. Specifically, we may usually assume results that converge when computed with different algorithms, to be more reliable than those that depend strongly on a particular algorithm, parameters, or details of input data.
 +
 
 +
      <!-- Column 1 end -->
 +
    </div>
 +
    <div class="col2">
 +
      <!-- Column 2 start -->
 +
In this assignment, we will take a computational shortcut, (something you should not do in real life). We will skip establishing the reliability of the tree with a bootstrap procedure, i.e. repeat the tree-building a hundred times with partial data and see which branches and groupings are robust and which depend on the details of the data. <small>(If you are interested, have a look [[BIO_bootstrapping_with_PHYLIP| '''here''']] for the procedure for running a bootstrap analysis on the data set you are working with, but this may require a day or so of computing time on your computer.)</small> In this assignment, we will simply acknowledge that bifurcations that are very close to each other have not been "resolved" and be appropriately cautious in our inferences. In phylogenetic analysis, not all lines a program draws are equally trustworthy. Don't take the trees as a given fact just because a program suggests this. Look at the evidence, include independent information where available, use your reasoning, and analyse the results critically. As you will see, there are some facts that we know for certain: we know which species the genes come from, and we can (usually) make good assumptions about the relationship of the species themselves - the history of speciation events that underlies all evolution of genes. This is extremely helpful information for our work.
 +
 
 +
 
 +
If you would like to review concepts of trees, clades, LCAs, OTUs and the like, I have linked an excellent and very understandable introduction-level article on phylogenetic analysis here and to the resource section at the bottom of this page.
 +
 
 +
{{#pmid: 12801728}}
 +
 
 +
{{vspace}}
  
 +
'''R''' packages that may be useful include the following:
 +
* [https://cran.r-project.org/web/views/Phylogenetics.html '''R''' task view Phylogenetics] - this task-view gives an excellent, curated overview of the important '''R'''-packages in the domain.
 +
* [https://cran.r-project.org/web/packages/ape/index.html package '''ape'''] - general purpose phylogenetic analysis, but (as far as I can tell ape only supports analysis with DNA sequences).
 +
* [https://cran.r-project.org/web/packages/ips/index.html package '''ips'''] - wrapper for MrBayes, Beast, RAxML "heavy-duty" phylogenetic analysis packages.
 +
* [https://cran.r-project.org/web/packages/Rphylip/index.html package '''Rphylip'''] - Wrapper for Phylip, the most versatile set of phylogenetic inference tools.
  
<div style="padding: 15px; background: #F0F1F7;  border:solid 1px #AAAAAA; font-size:125%;color:#444444">
+
      <!-- Column 2 end -->
;How could the search for ultimate truth have revealed so hideous and visceral-looking an object?
+
    </div>
::''<small>Max Perutz (on his first glimpse of the Hemoglobin structure)</small>''
+
  </div>
 
</div>
 
</div>
&nbsp;
 
&nbsp;
 
  
Where is the hidden beauty in structure, and where, the "ultimate truth"? In the previous assignments we have studied sequence conservation in APSES family domains and we have discovered homologues in all fungal species. This is an ancient protein family that had already duplicated to several paralogues at the time the cenancestor of all fungi lived, more than 600,000,000 years ago, in the [http://www.ucmp.berkeley.edu/fungi/fungifr.html Vendian period] of the Proterozoic era of Precambrian times.
+
{{vspace}}
 +
 
 +
==Preparing input alignments==
 +
{{vspace}}
 +
You have previously collected homologous sequences and their annotations. We will use these as input for phylogenetic analysis. But let's discuss first how such an input file should be constructed.
 +
 
 +
{{vspace}}
 +
 
 +
===Principles===
 +
<div class="colmask doublepage">
 +
  <div class="colleft">
 +
    <div class="col1">
 +
      <!-- Column 1 start -->
 +
In order to use molecular sequences for the construction of phylogenetic trees, you have to build a multiple alignment first. This is important: phylogenetic analysis does not build alignments, nor does it revise alignments, it analyses them '''after''' the alignment has been computed. A precondition for the analysis to be meaningful is that all rows of sequences have to contain the exact same number of characters and to hold '''aligned characters in corresponding positions (i.e. columns)'''. The program's inferences are made on a column-wise basis and if your columns contain data from unrelated positions, the inferences are going to be questionable. Clearly, in order for tree-estimation to work, one must not include fragments of sequence which have evolved under a different evolutionary model as all others, e.g. after domain fusion, or after accommodating large stretches of indels. Thus it is appropriate to edit the sequences and pare them down to a most characteristic subset of amino acids. The goal is not to be as comprehensive as possible, but to input those columns of aligned residues that will best represent the true phylogenetic relationships between the sequences.
 +
 
 +
 
 +
The result of the tree construction is a decision about the most likely evolutionary relationships. Fundamentally, tree-construction programs decide which sequences had common ancestors.
 +
 
 +
 
 +
'''Distance based''' phylogeny programs start by using sequence comparisons to estimate evolutionary distances:
 +
 
 +
* they apply a model of evolution such as a mutation data matrix, to calculate a score for each pair of sequences,
 +
* this score is stored in a "distance matrix" ...
 +
* ... and used to estimate a tree that groups sequences with close relationships together. (e.g. by using an NJ, Neigbor Joining, algorithm).
 +
 
 +
They are fast, can work on large numbers of sequences, but are less accurate if genes evolve at different rates.
 +
 
 +
      <!-- Column 1 end -->
 +
    </div>
 +
    <div class="col2">
 +
      <!-- Column 2 start -->
 +
 
 +
'''Parsimony based''' phylogeny programs build a tree that minimizes the number of mutation events that are required to get from a common ancestral sequence to all observed sequences. They take all columns into account, not just a single number per sequence pair, as the Distance Methods do. For closely related sequences they work very well, but they construct inaccurate trees when they can't make good estimates for the required number of sequence changes.
 +
 
 +
 
 +
'''ML''', or '''Maximum Likelihood''' methods attempt to find the tree for which the observed sequences would be the most likely under a particular evolutionary model. They are based on a rigorous statistical framework and yield the most robust results. But they are also quite compute intensive and a tree of the size that we are building in this assignment is a challenge for the resources of common workstation (runs about an hour on my computer). If the problem is too large, one may split a large problem into smaller, obvious subtrees (e.g. analysing orthologues as a group, only including a few paralogues for comparison) and then merge the smaller trees; this way even very large problems can become tractable.
  
In order to understand how specific residues in the sequence contribute to the putative function of the protein, and why and how they are conserved throughout evolution, we would need to study an explicit molecular model of an APSES domain protein, bound to its cognate DNA sequence. Explanations of a protein's observed properties and functions can't rely on the general fact that it binds DNA, we need to consider details in terms of specific residues and their spatial arrangement. In particular, it would be interesting to correlate the conservation patterns of key residues with their potential to make specific DNA binding interactions. Unfortunately, no APSES domain structures in complex with bound DNA has been solved up to now, and the experimental evidence we have considered in Assignment 2 ([http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=pubmed&dopt=Abstract&list_uids=10747782 Taylor ''et al.'', 2000]) is not sufficient to unambiguously define the details of how a DNA double helix might be bound. Moreover, at least two distinct modes of DNA binding are known for proteins of the winged-helix superfamily, of which the APSES domain is a member.
+
ML methods suffer less from "long-branch attraction" - the phenomenon that weakly similar sequences can be grouped inappropriately close together in a tree due to spuriously shared differences.
  
In this and the following assignment you will (1) construct a molecular model of the APSES domain from the Mbp1 orthologue in your assigned species, (2) identify similar structures of distantly related domains for which protein-DNA complexes are known, (3) assemble a hypothetical complex structure and (4) consider whether the available evidence allows you to distinguish between different modes of ligand binding.
 
  
For the following, please remember the following terminology:
+
'''Bayesian''' methods don't estimate the tree that gives the highest likelihood for the observed data, but find the most probably tree, given that the data have been observed. If this sounds conceptually similar to you, then you are not wrong. However, the approaches employ very different algorithms. And Bayesian methods need a "prior" on trees before observation.
  
;Target
 
:The protein that you are planning to model.
 
;Template
 
:The protein whose structure you are using as a guide to build the model.
 
;Model
 
:The structure that results from the modeling process. It has the '''Target sequence''' and is similar to the '''Template structure'''.
 
&nbsp;
 
  
A brief overview article on the construction and use of homology models is linked to the resource section at the bottom of this page. That section also contains links to other sites and resources you might find useful or interesting.
+
      <!-- Column 2 end -->
 +
    </div>
 +
  </div>
 +
</div>
  
 +
{{vspace}}
  
&nbsp;
+
===Choosing sequences===
==Warm-up: a minimal change==
+
{{vspace}}
Minimal changes to structure models can be done directly in Chimera. This illustrates the principle of full-scale modeling quite nicely. For an example, let us consider the residue <code>A&nbsp;42</code> of the 1BM8 structure. It is oriented twards the core of the protein, but most other Mbp1 orthologs have a larger amino acid in this position, <code>V</code>, or even <code>I</code>.
+
To illustrate the principle we will construct input files by joining APSES domain and Ankyrin domain sequences and for this we will use the Prosite annotations we have collected for the reference set of sequences and your YFO sequences.
  
 
{{task|1=
 
{{task|1=
# Open <code>1BM8</code> in Chimera, hide the ribbons and show all atoms as a stick model.
+
 
# Color the protein white.
+
* Open RStudio.
# Open the sequence window and select <code>A&nbsp;42</code>. Color it red. Choose '''Actions&nbsp;&rarr;&nbsp;Set pivot'''. Then study how nicely the alanine sidechain fits into the cavity formed by its surrounding residues.
+
* Choose File &rarr; Recent Projects &rarr; BCH441_2016.
# To emphasize this better, hide the solvent molecules and select only the protein atoms. Display them as a '''sphere''' model to better appreciate the packing, i.e. the Van der Waals contacts we discussed in class. Use the '''Favorites&nbsp;&rarr;&nbsp;Side view''' panel to move the clipping plane and see a section through the protein. Study the packing, in particular, note that the additional methyl groups of a valine or isoleucine would not have enough space in the structure. Then restore the clipping planes so you can see the whole molecule.
+
* Pull the latest version of the project repository from GitHub.
# Lets simplify the view: choose '''Actions &rarr; Atoms/Bonds &rarr; backbone&nbsp;only &rarr; chain&nbsp;trace'''. Then select <code>A&nbsp;42</code> again in the sequence window and choose '''Actions &rarr; Atoms/Bonds &rarr; show'''.
+
* type <tt>init()</tt>
# Add the surrounding residues: choose '''Select &rarr; Zone...'''. In the window, see that the box is checked that selects all atoms at a distance of less then 5&Aring; to the current selection, and check the lower box to select the whole residue of any atom that matches the distance cutoff criterion. Click '''OK''' and choose '''Actions &rarr; Atoms/Bonds &rarr; show'''.
+
* Open the file <tt>BCH441_A07.R</tt> and work through PART ONE: Choosing sequences.
#Select <code>A&nbsp;42</code> again: '''left-click''' (control click) on any atom of the alanine to select the atom, then '''up-arrow''' to select the entire residue. Now let's mutate this residue to isoleucine.
+
 
#Choose '''Tools &rarr; Structure&nbsp;Editing &rarr; Rotamers''' and select <code>ILE</code> as the rotamer type. Click '''OK''', a window will pop up that shows you the possible rotamers for isoleucine together with their database-derived probabilities; you can select them in the window and cycle through them with your arrow keys. But note that the probabilities are '''very''' different - and thus show you high-energy and low-energy rotamers to choose from. Therefore, unless you have compelling reasons to do otherwise, try to find the highest-probability rotamer that may fit. This is where your stereo viewing practice becomes important, if not essential. It is really, really hard to do this reasonably in a 2D image! It becomes quite obvious in 3D. Btw: I find such "quantitative" work - where the real distances are important - easier in '''orthographic''' than in '''perspective''' view (cf. the '''Camera''' panel).
 
#I find that the first rotamer is actually not such a bad fit. The <code>CD</code> atom comes close to the sidechains of <code>I&nbsp;25</code> and <code>L&nbsp;96</code>. But we can assume that these are somewhat mobile and can accommodate a denser packing, because - as you can easily verify in your Jalview alignment - it is '''NOT''' the case that sequences that have <code>I&nbsp;42</code>, have a smaller residue in position <code>25</code> and/or <code>96</code>. So let's accept the most frequent <code>ILE</code> rotamer by selecting it in the rotamer window and clicking '''OK''' (while '''existing side chain(s): replace''' is selected).
 
#Done.
 
 
}}
 
}}
  
If you want to go over this in more detail, check the video tutorial on YouTube published by the NIAID bioinformatics group [http://www.youtube.com/watch?v=bcXMexN6hjY '''here''']. I would also encourage you to go over [http://www.youtube.com/watch?v=eJkrvr-xeXY '''Part 2 of the video tutorial'''] that discusses how to check for and resolve (by energy minimization) steric clashes. But do remember that it is not clear whether energy minimization will make your structure more correct in the sense of a smaller overall RMSD with the real, mutated protein.
+
{{vspace}}
 +
 
 +
===Adding an Outgroup===
 +
{{vspace}}
 +
 
 +
An outgroup is a sequence that is more distantly related to all of the other sequences than any of them are to each other. This allows us to root the tree, because the root - the last common ancestor to all - must be somewhere on the branch that connects the outgroup to the rest. And whenever a molecular clock is assumed, the branching point that connects the outgroup can be assumed to be the oldest divergence event. Having a root that we can compare to the phylogram of species makes the tree interpretation '''much''' more intuitive. In our case, we are facing the problem that our species cover all of the known fungi, thus we can' rightly say that any of them are more distant to the rest. We have to look outside the fungi. The problem is, outside of the fungi there are no proteins with APSES domains<!--, and certainly none that have APSES as well as ankyrin domains in the same gene-->. We can take the ''E. coli'' KilA-N domain sequence - a known, distant homologue to the APSES domain instead, even though it only aligns to a part of the APSES domains<!-- , and we can get an ankyrin region from e.g. a plant. Both outgroup domains then will have the property that they are more distant individually to any of the fungal sequences, even though they don't appear in the same protein -->.
 +
 
 +
Here is the KilA-N domain sequence in the E. coli Kil-A protein:
 +
 
 +
>WP_000200358.1 hypothetical protein [Escherichia coli]
 +
<span style="color: #999999;">MTSFQLSLISRE</span>IDGEIIHLRAKDGYINATSMCRTAGKLLSDYTRLKTTQEFFDELSRDMGIPISELIQS
 +
FKGGRPENQGTWVHPDIAINLAQ<span style="color: #999999;">WLSPKFAVQVSRWVREWMSGERTTAEMPVHLKRYMVNRSRIPHTHFS
 +
ILNELTFNLVAPLEQAGYTLPEKMVPDISQGRVFSQWLRDNRNVEPKTFPTYDHEYPDGRVYPARLYPNE
 +
YLADFKEHFNNIWLPQYAPKYFADRDKKALALIEKIMLPNLDGNEQF</span>
 +
 
 +
''E. coli'' KilA-N protein. Residues that do not align with APSES domains are shown in grey.
 +
 
 +
The assignment '''R''' - code contains code to add it to the group of APSES sequences.
 +
 
 +
 
 +
 
 +
 
 +
<!--
 +
And here is an ankyrin repeat region, found by BLAST search in ''Solanum tuberosum'', the potato, and confirmed with ScanProsite. Since the potato is more distant in evolution from any fungus than all fungi are to each other, this sequence is suitable to root our ankyrin domain tree.
  
What we have done here with one residue is exactly the way homology modeling works with entire sequences. Let's now build a homology model for YFO Mbp1.
+
>NP_001275294 ankyrin repeat containing protein [Solanum tuberosum]
 +
<span style="color: #999999;">MAPDATDALAVREKVNKFLKAACSGDIELFKKLAKQLDDGKGLAGTVADVKDGNKRGALIFAARESKIEL
 +
CKYLVEELKVDVNEKDDEGETPLLHAAREGHTATVQYLIEQGADPAIP</span>SASGATALHHAAGNGHVELVKL
 +
LLSKGVDVDLQSEAGTPLMWAAGFGQEKVVKVLLEHHANVHAQTKDENNVCPLVSAVATDSLPCVELLAK
 +
AGADVNVRTGDATPLLIAAHNGSAGVINCLLQAGADPNAAEEDGTKPIQVAAASGSREAVEALLPVTERI
 +
QSV<span style="color: #999999;">PEWSVDGVIEFVQSEYKREQERAEAGRKANKSREPIIPKRDLPEVSPEAKKRAADAKARGDEAFKRN
 +
DFATAIDAYTQAIDFDPTDGTLFSNRSLCWLRLGQAERALSDARACRELRPDWAKGCYREGAALRLLQRF
 +
EEAANAFYEGVQINPINMELVTAFREAVEAGRKVHATNKFNSPSSLS</span>
 +
''S. tuberosum'' "ankyrin repeat and KH domain-containing protein 1-like" protein. Ankyrin repeat region shown in black.
  
==Preparation==
 
  
===Target sequence===
+
{{Vspace}}
The first step of homology modelling is to determine which sequence to model. We have determined the putative orthologue with conserved function in YFO by reciprocal best match with ''saccharomyces cervisiae'' Mbp1. Your sequence was initially found with an APSES domain search in YFO and the alignments with the yeast sequence are straightforward for the most part.
 
  
There are two  exceptions however: the alignment of '''ASPFU''' gene XP_754232 and the '''CAPCO''' gene XP_007722875 both are missing part of the domin's N-terminus. This is odd, because this may imply the APSES domain of these genes might not be properly folded. When such surprising results of alignement occurr,  you '''must''' consider whether there could be an error in the published sequence, perhaps stemming from an erroneous gene model. This is not absolutely germane to this assignment, so I have placed the process into the collapsible section below - optional reading. However it may be useful for you to understand what the issue is here and how to address it.
 
  
<div class="mw-collapsible mw-collapsed" data-expandtext="Expand to read about gene model correction" data-collapsetext="Collapse">
+
<source lang="R">
;Correcting the ASPFU Mbp1 gene model.
 
  
 +
# Let's add our outgroups to the feature sequence tables:
 +
 +
# APSES domain feature from E. coli
 +
apsOutGroupSeq <- paste(
 +
    "IDGEIIHLRAKDGYINATSMCRTAGKLLSDYTRLKTTQEFFDELSRDMGI",
 +
    "PISELIQSFKGGRPENQGTWVHPDIAINLAQ",
 +
                        sep = "")
 +
apsOutGroupHead <- ">apses domain from E. coli KilA-N"
 +
apsOutGroupName <- "APS_OUTGRP"
 +
 +
# ankyrin region feature from S. tuberosum
 +
ankOutGroupSeq <- paste(
 +
    "PEWSVDGVIEFVQSEYKREQERAEAGRKANKSREPIIPKRDLPEVSPEAK",
 +
    "KRAADAKARGDEAFKRNDFATAIDAYTQAIDFDPTDGTLFSNRSLCWLRL",
 +
    "GQAERALSDARACRELRPDWAKGCYREGAALRLLQRFEEAANAFYEGVQI",
 +
    "NPINMELVTAFREAVEAGRKVHATNKFNSPSSLS",
 +
                      sep = "")
 +
ankOutGroupHead <- ">ankyrin repeat region from S. tuberosum"
 +
ankOutGroupName <- "ANK_OUTGRP"
  
<div class="mw-collapsible-content">
 
An alignment of APSES domain sequence shows the shortened N-terminus of the ASPFU and the CAPCOprotein, relative to SACCE and e.g. the closely related ''aspergillus nidulans'', ASPNI:
 
APSES domains:
 
Mbp1_SACCE  QIYSARYSGVDVYEFIHSTGSIMKRKKDDWVNATHILKAA...
 
Mbp1_ASPNI  NVYSATYSSVPVYEFKIGTDSVMRRRSDDWINATHILKVA...
 
Mbp1_ASPFU  ----------------------MRRRGDDWINATHILKVA...
 
Mbp1_CAPCO  ----------------------MRRRSDDWVNATHILKVA...
 
  
We analyse this for the ASPFU gene.
+
# add the synthetic proteins to the feature compilations
 +
APSES <- rbind(APSES, data.frame(names = apsOutGroupName,
 +
                                head  = apsOutGroupHead,
 +
                                seq  = apsOutGroupSeq,
 +
                                stringsAsFactors = FALSE))
  
Working from the possibility that this may be a gene model error - e.g. a false translational start, a frameshift due to a sequencing error, or an erroneously modelled intron, we check whether the translation of the genomic sequence supports the presence of the expected amino acids. This is easily done running TBLASTN - BLASTing the protein query against the six reading frames of the ASPFU genome. We find the following:
+
ANKYRIN <- rbind(ANKYRIN, data.frame(names = ankOutGroupName,
 +
                                    head  = ankOutGroupHead,
 +
                                    seq  = ankOutGroupSeq,
 +
                                    stringsAsFactors = FALSE))
  
  
Aspergillus fumigatus Af293 chromosome 3, whole genome shotgun sequence
+
# Remove hyphens, concatenate APSES and ANK_REP_REGION
Sequence ID: ref|NC_007196.1|Length: 4079167Number of Matches: 2
+
# sequences and use names for rownames.
[...]
 
Query  10      VDVYEFIHSTGSIMKRKKDDWVNATHILKAANFAKAKRTRILE ...
 
                V VYEF    S+M+R+ DDW+NATHILK A F K  RTRILE ...
 
Sbjct  3691193  VPVYEFKVDGESVMRRRGDDWINATHILKVAGFDKPARTRILE ...
 
  
Indeed, there is sequence upstream of the gene's published translation start that matches well with our query! But where is the correct translation start? For that we need to look at the actual nucleotide sequence and translate it. Remember: BLAST is a '''local''' sequence alignment algorithm and it won't retrieve everything that matches to our query, just the best matching segment. ASPFU chromosome 3 is over 4 megabases large, so let us try to obtain only the region we are actually interested in: downstream of bases 3691193, lets say 3691100 (make sure this offset is divisible by three, to stay in the same reading frame) and upstream to, say, 3691372.
+
apsSeq <- character()
 +
ankSeq <- character()
 +
for (i in 1:nrow(APSES)) {
 +
aps <- gsub("-", "", APSES$seq[i])
 +
ank <- gsub("-", "", ANKYRIN$seq[i])
 +
if (nchar(aps) > 0) {
 +
        apsSeq <- c(apsSeq, aps)
 +
    names(apsSeq)[length(apsSeq)] <- APSES$names[i]
 +
}
 +
if (nchar(ank) > 0) {
 +
        ankSeq <- c(ankSeq, ank)
 +
    names(ankSeq)[length(ankSeq)] <- ANKYRIN$names[i]
 +
}
 +
}
 +
head(apsSeq)
 +
head(ankSeq)
  
#At the [http://www.ncbi.nlm.nih.gov/genome/browse/ '''NCBI genome project site'''] we search for ''aspergillus fumigatus''.
+
-->
#At the [http://www.ncbi.nlm.nih.gov/genome/18 '''''aspergillus fumigatus''''' '''genome project site'''] we click on chromosome 3 to access the map viewer.
 
#Hovering over the ''Download/View sequence'' link shows us how an URL to access sequence data is structured:
 
<nowiki>http://www.ncbi.nlm.nih.gov/projects/mapview/seq_reg.cgi?taxid=746128&chr=3&from=1&to=4079167</nowiki>
 
:We can easily adapt this to the sequence range we need ...
 
<ol start="4">
 
<li>... and follow: http://www.ncbi.nlm.nih.gov/nuccore/NC_007196.1?from=3691003&to=3691243&report=fasta to yield:
 
</ol>
 
>gi|71025130:3691003-3691243 Aspergillus fumigatus Af293 chromosome 3, whole genome shotgun sequence
 
ACGGTTTGCGGAGACGGGCATTATGGCGGCGGTGGATTTCTCAAAAATCTATTCTGCTACATACAGCAGC
 
GTAAGTCTCTTCTAATTGCGTATCTCTGTTTTCCCTACAGCCTCAAATTTTCCCCAATGCCTCTTTCCAT
 
CCATTTTGCCCCTTCCTTCGCCGCGAAGCCAATCTAACGCAGTTCAATAGGTTCCAGTTTACGAGTTCAA
 
AGTCGATGGCGAAAGTGTTATGCGCCGACGA
 
  
 +
{{task|1=
  
<ol start="5">
+
*Continue with the R-code: PART TWO: Multiple sequence alignment
<li>To translate this, we navigate to any of the [http://bips.u-strasbg.fr/EMBOSS/ '''EMBOSS''' tools servers] and use "remap" - we want to see the translation matched to the nucleotide sequence. We turn restriction sites off, translate all three forward frames and paste and manually align the SACCE Mbp1 sequence into the output to see what we expect and what we got. I have selected only the frame(s) that actually give a match, and I have pasted the homologous CAPCO and SACCE sequences (lower case) to demonstrate their similarity:
 
</ol>
 
ASPFU    ACGGTTTGCGGAGACGGGCATTATGGCGGCGGTGGATTTCTCAAAAATCTATTCTGCTACATACAGCAGC
 
                                                                       
 
ASPFU      R  F  A  E  T  G  I  M  A  A  V  D  F  S  K  I  Y  S  A  T  Y  S  S 
 
CAPCO                          m  -  a  f  d  -  k  e  i  y  s  a  t  y  s  n 
 
SACCE                          m  s  -  -  -  -  n  q  i  y  s  a  r  y  s  g
 
 
         
 
ASPFU    GTAAGTCTCTTCTAATTGCGTATCTCTGTTTTCCCTACAGCCTCAAATTTTCCCCAATGCCTCTTTCCAT
 
 
 
ASPFU    V  S  L  F  *  ...
 
CAPCO    v  a  -  -    ...
 
SACCE    v  d  -  -    ...
 
         
 
ASPFU    CCATTTTGCCCCTTCCTTCGCCGCGAAGCCAATCTAACGCAGTTCAATAGGTTCCAGTTTACGAGTTCAA
 
                                                              ...  V  Y  E  F  K
 
CAPCO                                                        ...  v  y  e  l  k
 
SACCE                                                        ...  v  y  e  f  i
 
         
 
ASPFU      AGTCGATGGCGAAAGTGTTATGCGCCGACGAGGCGATGATTGGATCAATGCTACACATATTCTTAAA
 
 
ASPFU      V  D  G  E  S  V  M  R  R  R  G  D  D  W  I  N  A  T  H  I  L  K ...
 
CAPCO      v  a  g  d  h  i  m  r  r  r  s  d  d  w  v  n  a  t  h  i  l  k ...
 
SACCE      h  s  t  g  s  i  m  k  r  k  k  d  d  w  v  n  a  t  h  i  l  k ...
 
  
 +
}}
  
:This clearly shows us that there is N-terminal sequence that ought to be added to the gene model, upstream of the reported translational start of <tt>MRRR...</tt>. The sequences thus most likely begin as follows:
+
{{Vspace}}
  
ASPFU  MAAVDFSKIYSATYSSVSLFVYEFKVDGE-----SVMRRRGDDWINATHILK...
+
===Reviewing and Editing alignments===
CAPCO  ma-fd-keiysatysnva--vyelkvagd-----himrrrsddwvnathilk...
+
{{vspace}}
SACCE  ms----nqiysarysgvd--ysgvdvyefihstgsimkrkkddwvnathilk...
 
  
The fact that the truncated N-terminus appears in both closely '''related''' genes and species suggests that what we see here is a mis-annotated intron. The take-home lesson is: if your retrieved protein sequence does not conform to your expectations, it may be worthwhile to follow up with the actual nucleotide sequence.
+
<div class="colmask doublepage">
 +
  <div class="colleft">
 +
    <div class="col1">
 +
      <!-- Column 1 start -->
 +
As discussed in the lecture, it is usually necessary to edit a multiple sequence alignment to make it suitable for phylogenetic inference. Here are the principles:
  
 +
<div class="emphasis-box">
 +
'''All characters in a column should be related by homology.'''
 
</div>
 
</div>
 +
 +
This implies the following rules of thumb:
 +
 +
*Remove all stretches of residues in which the ''alignment'' appears ambiguous (not just highly variable, but ambiguous regarding the aligned positions).
 +
*Remove all frayed N- and C- termini, especially regions in which not all sequences that are being compared appear homologous and that may stem from unrelated domains. You want to only retain the APSES domains. All the extra residues from the YFO sequence can be deleted.
 +
*Remove all gapped regions that appear to be alignment artefacts due to inappropriate input sequences.
 +
*Remove all but approximately one column from gapped regions '''in those cases where the presence of several related insertions suggest that the indel is real, and not just an alignment artefact.''' (Some researchers simply remove all gapped regions).
 +
*Remove sections N- and C- terminal of gaps where the alignment appears questionable. 
 +
*If the sequences fit on a single line you will save yourself potential trouble with block-wise vs. interleaved input. If you do run out of memory try removing columns of sequence. Or remove species that you are less interested in from the alignment.
 +
*Move your outgroup sequence to the first line of your alignment, since this is where PHYLIP will look for it by default.
 +
 +
 +
      <!-- Column 1 end -->
 +
    </div>
 +
    <div class="col2">
 +
      <!-- Column 2 start -->
 +
Indels are even more of a problem than usual. Strictly speaking, the similarity score of an '''alignment''' program as well as the distance score of a '''phylogeny''' program are not calculated for an ordered sequence, but for a sum of independent values, one for each aligned columns of characters. The order of the columns does not change the score. However in an optimal sequence alignment with gaps, this is no longer strictly true since a one-character gap creation has a different penalty score than a one-character gap extension! Most '''alignment''' programs use a model with a constant gap insertion penalty and a linear gap extension penalty. This is not rigorously justified from biology, but parametrized (or you could say "tweaked") to correspond to our observations. However, most '''phylogeny''' programs do not work in this way. They strictly operate on columns of characters and treat a gap character just like a residue with the one letter code "-". Thus gap insertion- and extension- characters get the same score. For short indels, this '''underestimates''' the distance between pairs of sequences, since any evolutionary model should reflect the fact that gaps are much less likely than point mutations. If the gap is very long though, all events are counted individually as many single substitutions (rather than one lengthy one) and this '''overestimates''' the distance. And it gets worse: long stretches of gaps can make sequences appear similar in a way that is not justified, just because they are identical in the "-" character. It is therefore common and acceptable to edit gaps in the alignment and delete all but a few columns of gapped sequence, or to remove such columns altogether.
 +
 +
 +
      <!-- Column 2 end -->
 +
    </div>
 +
  </div>
 
</div>
 
</div>
  
 +
{{Vspace}}
 +
----
 +
{{Vspace}}
 +
 +
 +
[[Image:EditingGuide.jpg|frame|none|(Possible) steps in editing a multiple sequence alignment towards a PHYLIP input file. '''a''': raw alignment (CLUSTAL format); '''b''': sequences assembled into single lines; '''c''': columns to be deleted highlighted in red - 1, 3 and 4: large gaps; 2: uncertain alignment and 5: frayed C-terminus: both would put non-homologous characters into the same column; '''d''': input data for PHYLIP: names for sequences must not be longer than 10 characters, the first line must contain the number of sequences and the sequence length. PHYLIP is very picky about incorrectly formatted input, read the [http://evolution.genetics.washington.edu/phylip/doc/sequence.html PHYLIP sequence format guide]. Fortunately Rphylip does the formatting step for you.]]
 +
 +
 +
There is more to learn about this important step of working with aligned sequences, here is an overview of the literature on various algorithms and tools that are available. <!-- Read at least the abstracts. -->
 +
 +
{{#pmid: 17654362}}
 +
{{#pmid: 19505945}}
 +
{{#pmid: 19770262}}
 +
{{#pmid: 20497997}}
 +
{{#pmid: 23193120}}
 +
 +
{{Vspace}}
 +
 +
====Sequence masking with R====
 +
{{Vspace}}
 +
 +
As you saw while inspecting the multiple sequence alignment, there are regions that are poorly suited for phylogenetic analysis
 +
due to the large numbers of gaps.
 +
 +
A good approach to edit the alignment is to import your sequences
 +
into Jalview and remove uncertain columns by hand.
 +
 +
But for this assignment, let's write code for a simple masking heuristic.
 +
 +
{{Vspace}}
 +
 +
{{task|1=
 +
 +
* Head back to the '''RStudio project''' and work through <tt>PART THREE: reviewing and editing alignments</tt>
 +
 +
}}
 +
 +
 +
{{Vspace}}
  
&nbsp;
+
==Calculating trees==
 +
{{vspace}}
  
===Template choice and template sequence===
+
In this section we perform the actual phylogenetic calculation.
  
 +
{{vspace}}
 +
{{task|1=
  
The [http://swissmodel.expasy.org/ SWISS-MODEL] server provides several different options for constructing homology models. The easiest option requires only a target sequence as input. In this mode the program will automatically choose suitable templates and create an input alignment. I would argue however that that is not the best way to use such a service: template choice and alignment both may be significantly influenced by biochemical reasoning, and an automated algorithm cannot make the necessary decisions. Should you use a structure of reduced resolution that however has a ligand bound? Should you move an indel from an active site to a loop region even though the sequence similarity score might be less? Questions like that may yield answers that are counter to the best choices an automated algorithm could make. But Swiss Model is flexible and allows us to upload an explicit alignment between target and template. Please note: the model you will produce is "easy" - the sequence similarity is high and there are no indels to consider, the automated mode would have done just as well. But the strategy we pursue here is suitable also for much more difficult problems. The automated strategy probably is not.
+
* Download the PHYLIP suite of programs from the [http://evolution.genetics.washington.edu/phylip.html Phylip homepage] and install it on your computer.
  
Template choice is the first step. Often more than one related structure can be found in the PDB. We have touched on principles of selecting template structures in the lectures; please refer to the [[Template_choice_principles|template choice principles]] page on this Wiki where I have reviewed the principles and discussed more details and alternatives. One can either search the PDB itself through its '''Advanced Search''' interface; for example one can search for sequence similarity with a BLAST search, or search for structural similarity by accessing structures according to their CATH or SCOP classification. But the BLAST search is probably the method of choice: after all, the most important measure of the probability of success for homology modeling is sequence similarity.
+
* Return to the '''RStudio project''' and work through <tt>PART FOUR: Calculating trees</tt>.
  
In [[BIO_Assignment_Week_3#Search_input|Assignment 3]], you have defined the extent of the APSES domain in yeast Mbp1. In [[BIO_Assignment_Week_6|Assignment 6]], you have used PSI-BLAST to search for APSES domains in YFO. In [[BIO_Assignment_Week_7|Assignment 7]] you have confirmed by ''Reciprocal Best Match'' which of these APSES domain sequences is the closest related orthologue to yeast Mbp1. This sequence is the best candidate for having a conserved function similar to yeast Mbp1. Therefore, this sequence is the one you will model: it is called the '''target''' for the homology modeling procedure. In the same assignment you have also computed a multiple sequence alignment that includes the sequence of  Mbp1 with YFO.
+
}}
  
Defining a '''template''' means finding a PDB coordinate set that has sufficient sequence similarity to your '''target''' that you can build a model based on that '''template'''. In  [[BIO_Assignment_Week_2#Structure_search|Assignment 2]] you have used a keyword search at the PDB to find "Mbp1" structures - but some of these structures were not homologs: keyword searches are notoriously unreliable. To find suitable PDB structures, we will perform a BLAST search at the PDB instead.
+
{{Vspace}}
  
 +
<!-- Bootstrapping ...
 +
* run seqboot
 +
* rename outfile to infile
 +
* rerun proml, use option M for multiple datasets with speedy option (use "jumble" of 1)
 +
* rename outtree to intree
 +
* run consense
 +
* Use option R to define trees as rooted
  
<!-- NOTE TO SELF: use the following sequence to test the procedure
+
Should run at least overnight.
>Mbp1_SCHPO/2-100 NP_593032
 
AVHVAVYSGVEVYECFIKGVSVMRRRRDSWLNATQILKVADFDKPQRTRVLERQVQIGAHEKVQGGYGKYQG
 
TWVPFQRGVDLATKYKVDGIMSPILSL
 
>1BM8_A
 
QIYSARYSGVDVYEFIHSTGSIMKRKKDDWVNATHILKAANFAKAKRTRILEKEVLKETHEKVQGGFGKYQG
 
TWVPLNIAKQLAEKFSVYDQLKPLFDF
 
 
-->
 
-->
  
 +
==Analysing your tree==
 +
{{vspace}}
  
 +
In order to analyse your tree, you need a species tree as reference. This really is an absolute prerequisite to make your expectations about the observed tree explicit. Fortunately we have all species nicely documented in our database.
  
 +
{{vspace}}
 +
 +
===The reference species tree===
 +
{{vspace}}
  
 
{{task|1=
 
{{task|1=
# Retrieve your YFO Mbp1-like APSES domain sequence. You can find the domain boundaries for the yeast protein in the [[Mbp1_protein_reference_annotation|Mbp1 annotation reference page]], and you can get the aligned sequence from your Jalview alignment, or simply recompute it with the <code>needle</code> program of the EMBOSS suite. This YFO sequence is your '''target''' sequence.
 
# Navigate to the [http://www.pdb.org/pdb/home/home.do PDB].
 
# Click on '''Advanced''' to enter the advanced search interface.
 
# Open the menu to '''Choose a Query Type:'''
 
# Find the '''Sequence features''' section and choose '''Sequence (BLAST...)'''
 
# Paste your '''target''' sequence into the '''Sequence''' field, select '''not''' to mask low-complexity regions and '''Submit Query'''. Since the E-value is set rather high by default, you will get a number of low-confidence hits as well as the actual homologs, these have very low E-values.
 
  
All hits that are homologs are potentially suitable '''templates''', but some are more suitable than others. Consider how the coordinate sets differ and which features would make each more or less suitable for creating a homology model: you should consider ...
+
* Navigate to the [http://www.ncbi.nlm.nih.gov/taxonomy '''NCBI Taxonomy page''']
 +
 
 +
* Execute the following '''R''' command to create an Entrez command that will retrieve all taxonomy records for the species in your database:
 +
<source lang="R">
 +
cat(paste(paste(c(myDB$taxonomy$ID, "83333"), "[taxid]", sep=""), collapse=" OR "))
 +
</source>
 +
 
 +
* Copy the Entrez command, and enter it into the search field of the NCBI taxonomy page. Click on '''Search'''. The resulting page should have twelve species listed - ten "reference" fungi, ''E. coli'' (as the outgroup), and YFO. Make sure YFO is included! If it's not there, you did something wrong that needs to be fixed.
 +
 
 +
* Click on the '''Summary''' options near the top-left of the page, and select '''Common Tree'''. This places all the species into the universal tree of life and identifies their relationships.
 +
 
 +
* At the top, there is an option to '''Save as''' ... and the option to select a format to save the tree in. Select '''Phylip Tree''' as the format and click the '''Save as''' button. The file <code>phyliptree.phy</code> will be downloaded to your computer into your default download directory. Move it to the directory you have defined as <code>PROJECTDIR</code>.
 +
 
 +
*Open the file in a text-editor. This is a tree, specified in the so-called {{WP|Newick_format|'''"Newick format"'''}}. The topology of the tree is defined through the brackets, and the branch-lengths are all the same: this is a cladogram, not a phylogram. The tree contains the long names for the species/strains and for our purposes we really need the "biCodes" instead. I can't think of a very elegant way to make that change programmatically, so just go ahead and replace the species names (not the taxonomic ranks though) with their biCode in your text editor. Remove all the single quotes, and replace any remaining blanks in names with an underscore. Take care however not to delete any colons or parentheses. Save the file.
 +
 
 +
My version looks like this - '''Your version must have YFO somewhere in the tree.'''.
 +
 
 +
(
 +
'ESCCO':4,
 +
(
 +
(
 +
'PUCGR':4,
 +
'USTMA':4,
 +
(
 +
'WALME':4,
 +
'COPCI':4,
 +
'CRYNE':4
 +
)Agaricomycotina:4
 +
)Basidiomycota:4,
 +
(
 +
(
 +
(
 +
'ASPNI':4,
 +
'BIPOR':4,
 +
'NEUCR':4
 +
)leotiomyceta:4,
 +
'SACCE':4
 +
)saccharomyceta:4,
 +
'SCHPO':4
 +
)Ascomycota:4
 +
)Dikarya:4
 +
)'cellular organisms':4;
  
:*sequence similarity to your target
+
*Now read the tree in '''R''' and plot it.
:*size of expected model (= length of alignment)
 
:*presence or absence of ligands
 
:*experimental method and quality of the data set
 
  
Sequence similarity is the most important, but we can have the PDB tabulate the other features concisely for this task.
+
<source lang="R">
  
# There is a menu to create '''Reports:''' - select '''customizable table'''.
+
# Download the EDITED phyliptree.phy
# Select (at least) the following information items:
+
orgTree <- read.tree("phyliptree.phy")
;Structure Summary
 
* Experimental Method
 
;Sequence
 
* Chain Length
 
;Ligands
 
* Ligand Name
 
;Biological details
 
* Macromolecule Name
 
; refinement Details
 
* Resolution
 
* R Work
 
* R free
 
# click: '''Create report'''.
 
  
Unfortunately you don't get the E-values into the report, and those should strongly influence your final decision. However in our case the sequences and therefore the E-values of the top three hits are all the same. Neither of the structures has a bound DNA ligand, but the experimental methods and structure quality are different. Two of the sequences have a longer chain-length ... but those are only disordered residues (otherwise these would be better suited templates; regrettably, you'd need to check that in the ''real world'', there is no automatic tool to evaluate disorder and its effects on template choice). In my opinion that leaves pretty much only one unambiguous choice: 1BM8. In case you don't agree, please let me know.
+
# Plot the tree in a new window
 +
dev.new(width=6, height=3)
 +
plot(orgTree, cex=1.0, root.edge=TRUE, no.margin=TRUE)
 +
nodelabels(text=orgTree$node.label, cex=0.6, adj=0.2, bg="#D4F2DA")
  
;Finally: Click on the 1BM8 ID to navigate to the structure page for the '''template''' and save the FASTA sequence to your computer. This is '''the template sequence'''.
+
</source>
  
 
}}
 
}}
  
 +
{{vspace}}
 +
 +
I have constructed a cladogram for many of the species we are analysing, based on data published for 1551 fungal ribosomal sequences. The six reference species are included. Such reference trees from rRNA data are a standard method of phylogenetic analysis, supported by the assumption that rRNA sequences are monophyletic and have evolved under comparable selective pressure in all species.
 +
 +
{{vspace}}
 +
<div class="reference-box">
 +
[[Image:FungiCladogram.jpg|600px|none]]
  
&nbsp;
 
  
 +
<small>'''Cladogram of the "reference" fungi''' studied in the assignments. This cladogram is based on a tree returned by the NCBI Common Tree. It is thus a digest of cladistic relationships, not a representation of a specific molecular phylogeny.</small>
 +
</div>
  
 +
Alternatively, you can look up your species in the latest version of the species tree for the fungi and add it to the tree by hand while resolving the trifurcations. See:
 +
{{#pmid: 22114356}}
  
===Sequence numbering===
+
{{vspace}}
  
  
&nbsp;
+
{{task|1=
  
It is not straightforward at all how to number sequence in such a project. A "natural" numbering starts with the start-codon of the full length protein and goes sequentially from there. However, this does not map exactly to other numbering schemes we have encountered. As you know the first residue of the APSES domain (as defined by CDD) is not Residue 1 of the Mbp1 protein. The first residue of the 1BM8 FASTA file <small>(one of the related PDB structures)</small> '''is''' the fourth residue of the Mbp1 protein. The first residue in the structure is GLN 3, therefore Q is the first residue in a FASTA sequence derived from the cordinate section of the PDB file (the <code>ATOM  </code> records. In the 1MB1 structure, the original N-terminal amino acids are present in the molecule, therefore they are present in the FASTA file which starts with <code>MSNQIY...</code>, but they are disordered in the structure and no coordinates are present for M and S. A sequence derived explicitly from the coordinates is therefore different from the reported FASTA sequence, which is really bad because that is what the modeling program has to work with  ... and so on. It can get complicated. You need to remember: a sequence number is not absolute, but assigned in a particular context and you need to be careful how to do this.  
+
* Return to the RStudio project and continue with the script to its end. Note the deliverable at the end: to print out your trees and bring them to class.
  
Fortunately, the numbering for the residues in the coordinate section of our '''target''' structure corresponds not to its FASTA sequence, but to the numbering of the gene. Otherwise we would need to renumber the sequence <small>(e.g. by using the bio3D R package)</small>. If we would not do this, the sequence numbers in the model might not correspond to the sequence numbers of our target.
+
}}
  
 
<!--
 
<!--
BELOW IS NOT NECESSARY FOR THE 1BM8 TEMPLATE. ALSO extraction can be done with bio3D
 
  
  
The homology '''model''' will be based on an alignment of '''target''' and '''template'''. Thus we have to define the target sequence. As discussed in class, PDB files have an explicit  and an implied sequence and these do not necessarily have to be the same. To compare the implied and the explicit sequence for the template, you need to extract sequence information from coordinates. One way to do this is via the Web interface for [http://swift.cmbi.ru.nl/servers/html/index.html '''WhatIf'''], a crystallography and molecular modeling package that offers many useful tools for coordinate manipulation tasks.
 
  
 +
#Copy the tree-string from the R console.
 +
#Visualize the tree online: navigate to the [http://www.trex.uqam.ca/index.php?action=newick&project=trex Trex-online Newick tree viewer]. Visualize the tree as a phylogram. Explore the options.
  
*Navigate to the '''Administration''' sub-menu of the [http://swift.cmbi.ru.nl/servers/html/index.html WhatIf Web server]. Follow the link to '''Make sequence file from PDB file'''. Enter the PDB-ID of your template into the form field and '''Send''' the request to the server. The server accesses the PDB file and extracts sequence information directly from the <code>ATOM&nbsp;&nbsp;</code> records of the file. The results will be returned in PIR format. Copy the results, edit them to FASTA format and save them in a text-only file. Make sure you create a valid FASTA formatted file! Use this '''implied''' sequence to check if and how it differs from the sequence ...
+
# A particularly useful viewer is actually Jalview - although this may be more apparent with the larger alignment of '''all''' sequences we'll produce later.
 +
##Open Jalview and load your alignment of all APSES domain proteins.
 +
##Save the Newick-formatted tree.  
 +
##In the alignment window, choose '''File &rarr; Load associated Tree''' and load your tree file. You can click into the tree-window to show which clades branch off at what level - it should be obvious that you can identify three major subclades (plus the outgroup). This view is particularly informative, since you can associate the clades of the tree with the actual sequences in the alignment, and get a good sense what sequence features the tree is based on.
 +
##Try the '''Calculate &rarr; Sort &rarr; By Tree Order''' option to sort the sequences by their position in the tree. Also note that you can flip the tree around a node by double-clicking on it. This is especially useful: try to rearrange the tree so that the subdivisions into clades are apparent. Clicking into the window "cuts" the tree and colours your sequences according to the clades in which they are found. This is useful to understand what particular sequences contributed to which part of the phylogenetic inference.  
  
:*... listed in the <code>SEQRES</code> records of the coordinate file;
 
:*... given in the FASTA sequence for the template, which is provided by the PDB;
 
:*... stored in the protein database of the NCBI.
 
: and record your results.
 
  
* Establish how the sequence numbers in the coordinate section of your template(*) correspond to your target sequence numbering.
+
ANALYSIS
  
:(*) <small>These residue numbers are important, since they are referenced e.g. by VMD when you visualize the structure. The easiest way to list them is via the ''Sequence Viewer'' extension of VMD.</small>.
+
* First, the APS and ANK trees should have the same topology, since they are only different parts of the same protein (unless that protein has swapped its domains with another one during evolution). Clearly, that is not the case. The ''basidiomycota'' are reasonably consistent, although their internal ordering is poorly resolved, particularly in the APS tree. The ''ascomycota'' show two major differences, but they are actually consistent between the APS and the ANK tree: SACCE is less similar to all than we would expect from the species tree. And NEUCR is more similar to the ''basidiomycotal'' proteins.
:<small>Don't do this for every residue individually but define ranges. Look at the correspondence of the first and last residue of target and template sequence and take indels into account. Establishing sequence correspondence precisely is crucially important! For example, when a publication refers to a residue by its sequence number, you have to be able to relate that number to the residue numbers of the model as well as your target sequence.</small>.
+
 
&nbsp;
+
* Consider the scale bars: ANK domains have evolved at about twice the rate of the APS domains. This alone should tell us to be cautious with our interpretations since this shows there are different degrees of selective pressure on different parts of the protein. Moreover the <u>relative rates</u> differ as well. NEUCR's APSES domain has evolved much faster by comparison to other proteins than its ankyrin domain. Has its biological function changed?
&nbsp;
 
  
-->
+
* Secondly, both gene trees should follow the species tree. Again, there are differences. But if we exclude SACCE and NEUCR, the remainder actually turns out relatively consistent.
  
 +
In any case: this is what the data tells us. The big picture is mostly conserved, but there are differences in the details. However: now we know what degree of accuracy we can expect from the analysis.
  
&nbsp;
+
{{vspace}}
  
 +
==The mixed gene tree==
 +
{{vspace}}
  
===The input alignment===
+
You have now practiced how to calculate, manipulate, plot, annotate and compare trees.
  
 +
{{task|1=
  
&nbsp;
+
* Now use Rproml to calculate a mixed gene tree based on '''all'' APSES domains. You saved it as <code>APSES.mfa</code>. For the fifty or so domains, each run will take about an hour. Thus run as many <code>random.addition</code> cycles as reasonable during a study break, or overnight. Thus the command will be something like:
The sequence alignment between target and template is the single most important factor that determines the quality of your model. No comparative modeling process will repair an incorrect alignment; it is useful to consider a homology model rather like a three-dimensional map of a sequence alignment rather than a structure in its own right. In a homology modeling project, typically the largest amount of time should be spent on preparing the best possible alignment. Even though automated servers like the SwissModel server will align sequences and select template structures for you, it would be unwise to use these just because they are convenient. You should take advantage of the much more sophisticated alignment methods available. Analysis of wrong models can't be expected to produce right results.
 
  
The best possible alignment is usually constructed from a multiple sequence alignment that includes at least '''the target and template sequence''' and other related sequences as well. The additional sequences are an important aid in identifying the correct placement of insertions and deletions. Your alignment should have been carefully reviewed by you and wherever required, manually adjusted to move insertions or deletions between target and template out of the secondary structure elements of the template structure.
+
<source lang="R">
 +
allApsIn <- read.protein("APSES.mfa")
 +
fullApsTree <- Rproml(allApsIn, path=PROMLPATH, random.addition=3)
  
In most of the Mbp1 orthologues, we do not observe indels in the APSES domain regions. Evolutionary pressure on the APSES domains has selected against indels in the more than 600 million years these sequences have evolved independently in their respective species. To obtain an alignment between the '''template sequence''' and the '''target sequence''' from your species, proceed as follows.  
+
#... and don't forget:
 +
save(fullApsTree, file="fullApsTree.rda")
 +
</source>
  
 +
}}
  
&nbsp;
+
{{vspace}}
  
{{task|1=
+
===Analysis===
Choose on of the following options to align your '''target''' and '''template''' sequence.
+
{{vspace}}
  
 +
Here are two principles that will help you make sense of the tree.
  
;In Jalview...
 
* Load your Jalview project with aligned APSES domain sequences or recreate it from the Mbp1 orthologue sequences from the [[All_Mbp1_proteins|'''Mbp1 protein orthologs page''']] that I prepared for Assignment 7. Include the sequence of your '''template protein''' and re-align.
 
* Delete all sequence you no longer need, i.e. keep only the APSES domains of the '''target''' (from your species) and the '''template''' (from the PDB) and choose '''Edit &rarr; Remove empty columns'''. This is your '''input alignment'''.
 
* Choose '''File&rarr;Output to textbox&rarr;FASTA''' to obtain the aligned sequences. They should both have exactly the same length, i.e. N- or C- termini have to be padded by hyphens if the original sequences had different length. Save the sequences in a text-file.
 
  
 +
A: '''A gene that is present in an ancestral species is inherited in all descendant species'''. The gene has to be observed in all OTUs, unless its has been lost (which is a rare event).
  
;Using a different MSA program
+
B: '''Paralogous genes in an ancestral species should give rise to monophyletic subtrees for each of the paralogues, in all descendants'''; this means: if the MRCA of a branch has e.g. three genes, we would expect three copies of that branch below this node, one for each of the three genes. Each of these subtrees should recapitulate the reference phylogenetic tree of the species, up to the branchpoint of their MRCA. The precise relationships may not be readily apparent, due to the noise and limited resolution we saw above, but the gene ought to be '''somewhere''' in the tree and you can often assume that it is closest to where it ought to be if the topology was correct. In this way you try to reconcile your expectations with your observations - preferably with as small a number of changes as possible.
* Copy the FASTA formatted sequences of the Mbp1 proteins in the reference  species from the [[Reference APSES domains (reference species)|'''Reference APSES domain page''']].
 
* Access e.g. the MSA tools page at the EBI.  
 
* Paste the Mbp1 sequence set, your '''target''' sequence and the '''template''' sequence into the input form.
 
*Run the alignment and save the output.
 
  
 +
With these two simple principles (draw them out on a piece of paper if they do not seem obvious to you), you can probably pry your tree apart quite nicely. A few colored pencils and a printout of the tree will help. I would start by identifying all of the Mbp1 RBMs in the tree.
  
;Using the EMBOSS explorer
+
Here is a bit of code that you can use to colour the labels of the Mbp1 RBMs:
* Use the <code>needle</code> tool for the alignment  ... but remember that pairwise alignments will only be suitable in case the alignment is absolutely unambiguous (such as here) . If there are any indels, an MSA will give much more reliable information.
 
  
 +
<source lang="R">
  
;By hand
+
# You have previously defined the names for Mbp1 RBMs in
APSES domains are strongly conserved and have few if any indels. You could also simply align by hand.  
+
# the vector apsMbp1Names. You can use these to check
 +
# which of the tree tipLabels are in that vector and
 +
# then color them red in the plot.
  
* Copy the CLUSTAL formatted reference alignment of the Mbp1 proteins in the reference species from the [[Reference APSES domains (reference species)|'''Reference APSES domain page''']].
+
# You'll need to replace <TREE> with whatever you called
* Open a new file in a text editor.
+
# your full tree with all APSES domain proteins.
* Paste the Mbp1 sequence set, your '''target''' sequence and the '''template''' sequence into the file.
 
*Align by hand, replace all spaces with hyphens and save the output.
 
}}
 
  
 +
#First, have a look at the tip labels in your tree:
 +
<TREE>$tip.label
  
Whatever method you use: the result should be a two sequence alignment in '''multi-FASTA''' format, that was constructed from a number of supporting sequences and that contains your aligned '''target''' and '''template''' sequence. This is your '''input alignment''' for the homology modeling server. For a ''Schizosaccharomyces pombe'' model, which I am using as an example here, it looks like this:
+
# We'll create a vector of black colours of the same length
 +
# as the tip label vector:
 +
tipColors = rep("#000000", Ntip(<TREE>))
  
>1BM8_A
+
# ... then we replace each one for which the label is
QIYSARYSGVDVYEFIHSTGSIMKRKKDDWVNATHILKAANFAKAKRTRI
+
# in apsMbp1Names with "#BB0000" (red)
LEKEVLKETHEKVQGGFGKYQGTWVPLNIAKQLAEKFSVYDQLKPLFDF
+
tipColors[<TREE>$tip.label %in% apsMbp1Names] <- "#BB0000"
>Mbp1_SCHPO 2-100 NP_593032
 
AVHVAVYSGVEVYECFIKGVSVMRRRRDSWLNATQILKVADFDKPQRTRV
 
LERQVQIGAHEKVQGGYGKYQGTWVPFQRGVDLATKYKVDGIMSPILSL
 
  
 +
#inspect:
 +
tipColors
  
&nbsp;
+
# ... and then we plot:
 +
plot(<TREE>, tip.color=tipColors,
 +
    cex=0.7, root.edge=TRUE, no.margin=TRUE)
  
==Homology model==
 
  
 +
</source>
  
&nbsp;
+
{{vspace}}
  
  
===SwissModel===
+
===The APSES domains of the MRCA===
 +
{{vspace}}
  
&nbsp;<br>
+
Note: A common confusion about cenancestral genes (MRCA = Most Recent Common Ancestor) arises from the fact that by far not all expected genes are present in the OTUs. Some will have been lost, some will have been incorrectly annotated in their genome (frameshifts!) and not been found with PSI-BLAST, some may have diverged beyond recognizability. In general you have to ask: '''given the species represented in a subclade, what is the last common ancestor of that branch'''? The expectation is that '''all''' descendants of that ancestor should be represented in that branch '''unless''' one of the above reasons why a gene might be absent would apply. Eg. if a branch contains species from ''Basidiomycota'' '''and''' ''Ascomycota'', this means that its MRCA was the ancestor of all fungi.
  
Access the Swissmodel server at '''http://swissmodel.expasy.org''' and click on '''Start Modelling'''. Then, under the '''Supported Inputs''', click on '''Target-Template Alignment'''.
 
  
 
{{task|1=
 
{{task|1=
*Paste your alignment for target and model into the form field. Click on the question mark next to "Supported Inputs" if you are not sure about the format. SwissModel will analyse the sequences and ask you to identify target and template. The YFO sequence is your target. The 1BM8 sequence is the template.
 
  
* Click '''Validate Target Template Alignment''' and check that the returned alignment is correct.
 
  
*Click '''Build Model''' to start the modeling process.
+
* Consider the APSES domain proteins of the fungal cenancestor. What evidence do you see in the tree that identifies them. Note that the hallmark of a clade that originated in the cenancestor is that it contains species from '''all''' subsequent major branches of the species tree. How many of these proteins are there? What arer the names of their SACCE descendants?
 +
 
 +
}}
 +
 
 +
{{vspace}}
 +
 
 +
===The APSES domains of YFO===
 +
{{vspace}}
  
* The resulting page returns information about the resulting model. Mouse over the '''Model 01''', open the '''PDB file''' and save the coordinates to your computer. Read the information on what is being returned by the server (click on the question mark icon). Study the quality measures.
+
You have identified the APSES domain genes of the fungal cenancestor above. Accordingly, this defines the number of APSES protein genes the ancestor to YFO had. Identify the sequence of duplications and/or gene loss in your organism through which YFO has ended up with the APSES domains it possesses today.  
  
* Also save:
+
{{task|1=
 +
 
 +
# Print the tree to a single sheet of paper.
 +
# Mark the clades for the genes of the cenancestor.
 +
# Label all subsequent branchpoints that affect the gene tree for YFO  with either '''"D"''' (for duplication) or '''"S"''' (for speciation). Remember that specific speciation events can appear more than once in a tree. Identify such events.
 +
# '''Bring this sheet with you to the quiz on Tuesday. Your annotated printout will be worth half of the phylogeny quiz marks.'''
  
** The output page as pdf (for reference)
 
** The modeling report (as pdf)
 
 
}}
 
}}
  
==Model analysis==
+
{{vspace}}
  
&nbsp;
+
==Bonus: when did it happen?==
&nbsp;
+
{{vspace}}
 +
 
 +
A very cool resource is [http://www.timetree.org/ '''Timetree'''] - a tool that allows you to estimate divergence times between species. For example, the speciation event that separated the main branches of the fungi - i.e. the time when the fungal cenacestor lived - is given by the divergence time of ''Schizosaccharomyces pombe'' and ''Saccharomyces cerevisiaea'': 761,000,000 years ago. For comparison, these two fungi are therefore approximately as related to each other as '''you''' are ...
 +
 
 +
A) to the rabbit?<br>
 +
B) to the opossum?<br>
 +
C) to the chicken?<br>
 +
D) to the rainbow trout?<br>
 +
E) to the warty sea squirt?<br>
 +
F) to the bumblebee?<br>
 +
G) to the earthworm?<br>
 +
H) to the fly agaric?<br>
 +
 
 +
Check it out - the question will be on the quiz.
 +
 
 +
{{vspace}}
 +
 
 +
 
 +
==Identifying Orthologs==
 +
{{vspace}}
 +
 
 +
In the last assignment we discovered homologs to ''S. cerevisiae'' Mbp1 in YFO. Some of these will be orthologs to Mbp1, some will be paralogs. Some will have similar function, some will not. We discussed previously that genes that evolve under continuously similar evolutionary pressure should be most similar in sequence, and should have the most similar "function".
 +
 
 +
In this assignment we will define the YFO gene that is the most similar ortholog to ''S. cerevisiae'' Mbp1, and perform a multiple sequence alignment with it.
 +
 
 +
Let us briefly review the basic concepts.
 +
 
 +
<div style="padding: 2px; background: #F0F1F7;  border:solid 1px #AAAAAA; font-size:125%;color:#444444">
  
=== The PDB file ===
 
 
&nbsp;<br>
 
&nbsp;<br>
 +
;All related genes are homologs.
 +
</div>
  
{{task|1=
 
Open your '''model''' coordinates in a text-editor (make sure you view the PDB file in a fixed-width font (like "courier") so all the columns line up correctly) and consider the following questions:
 
  
*What is the residue number of the first residue in the '''model'''? What should it be, based on the alignment? If the putative DNA binding region was reported to be residues 50-74 in the Mbp1 protein, which residues of your '''model''' correspond to that region?
+
Two central definitions about the mutual relationships between related genes go back to Walter Fitch who stated them in the 1970s:
}}
+
<div style="padding: 2px; background: #F0F1F7;  border:solid 1px #AAAAAA; font-size:125%;color:#444444">
 +
 
 +
&nbsp;<br>
 +
;Orthologs have diverged after speciation.
  
<!-- discuss flagging of loops - setting of B-factor to 99.0 phps. ANOLEA vs. Gromos ... packing vs. energy? -->
+
;Paralogs have diverged after duplication.
 +
</div>
  
  
===R code: renumbering the model ===
+
&nbsp;
  
As you have seen, SwissModel numbers the first residue "1" and does not keep the numbering of the template. We should renumber the model so we can compare the model and the template with the same residue numbers. Fortunately there is a very useful R package that will help us with that.
 
  
{{task|1=
+
[[Image:OrthologParalog.jpg|frame|none|'''Hypothetical evolutionary tree.''' A single gene evolves through two speciation events and one duplication event. A duplication occurs during the evolution from reptilian to synapsid. It is easy to see how this pair of genes (paralogs) in the ancestral synapsid gives rise to two pairs of genes in pig and elephant, respectively. All ''circle'' genes are mutually orthologs, they form a "cluster of orthologs". All genes within one species are mutual paralogs&ndash;they are so called ''in-paralogs''. The ''circle'' gene in pig and the ''triangle'' gene in the elephant are so-called ''out-paralogs''. Somewhat counterintuitively, the ''triangle'' gene in the pig and the ''circle'' gene in the raven are also orthologs - but this has to be, since the last common ancestor diverged by '''speciation'''.
# Navigate to the [http://thegrantlab.org/bio3d/index.php '''bio3D'''] home page. '''bio3d''' is not available for installation via CRAN, but needs to be installed from source. Instructions for the different platforms are here http://thegrantlab.org/bio3d/tutorials/installing-bio3d Follow the instructions and install '''bio3d''' for '''R''' on your platform.
 
  
# Explore and execute the following '''R''' script. I am assuming that your model is in your working directory, change paths and filenames as required.
+
The "phylogram" on the right symbolizes the amount of evolutionary change as proportional to height difference to the "root". It is easy to see how a bidirectional BLAST search will only find pairs of most similar orthologs. If applied to a group of species, bidirectional BLAST searches will find clusters of orthologs only (except if genes were lost, or there are  anomalies in the evolutionary rate.)]]
  
<source lang="rsplus">
 
# renumberPDB.R
 
  
# This is a simple renumbering script that uses the bio3D
+
==Defining orthologs==
# package. We simply set the first residue number to what it
 
# should be and renumber all residues based on the first one.
 
# The script assumes your input PDBfile is in your working
 
# directory.
 
  
# To run this, you must have installed the bio3D R package; instructions
+
To be reasonably certain about orthology relationships, we would need to construct and analyze detailed evolutionary trees. This is computationally expensive and the results are not always unambiguous either, as we will see in a later assignment. But a number of different strategies are available that use precomputed results to define orthologs. These are especially useful for large, cross genome surveys. They are less useful for detailed analysis of individual genes. Pay the sites a visit and try a search.
# are here: http://thegrantlab.org/bio3d/tutorials/installing-bio3d
 
  
setwd("~/my/working/directory")
 
PDBin      <- "YFO_model.pdb"
 
PDBout    <- "YFO_model_ren.pdb"
 
  
first <- 4  # residue number that the first residue should have
+
;Orthologs by eggNOG
 +
:The [http://eggnog.embl.de/ '''eggNOG'''] (evolutionary genealogy of genes: Non-supervised Orthologous Groups) database contains orthologous groups of genes at the EMBL. It seems to be continuously updtaed, the search functionality is reasonable and the results for yeast Mbp1 show many genes from several fungi. Importantly, there is only one gene annotated for each species. Alignments and trees are also available, as are database downloads for algorithmic analysis.
 +
<div class="mw-collapsible mw-collapsed" data-expandtext="more..." data-collapsetext="less" style="width:800px">
 +
&nbsp;
 +
<div class="mw-collapsible-content">
 
   
 
   
# ================================================
+
{{#pmid: 24297252}}
#   Read coordinate file
+
 
# ================================================
+
</div>
 +
</div>
 +
 
 +
 
 +
;Orthologs at OrthoDB
 +
:[http://www.orthodb.org/ '''OrthoDB'''] includes a large number of species, among them all of our protein-sequenced fungi. However the search function (by keyword) retrieves many paralogs together with the orthologs, for example, the yeast Soc2 and Phd1 proteins are found in the same orthologous group these two are clearly paralogs.
 +
<div class="mw-collapsible mw-collapsed" data-expandtext="more..." data-collapsetext="less" style="width:800px">
 +
&nbsp;
 +
<div class="mw-collapsible-content">
 +
 +
{{#pmid: 23180791}}
 +
 
 +
</div>
 +
</div>
 +
 
 +
 
 +
;Orthologs at OMA
 +
[http://omabrowser.org/ '''OMA'''] (the Orthologous Matrix) maintained at the Swiss Federal Institute of Technology contains a large number of orthologs from sequenced genomes. Searching with <code>MBP1_YEAST</code> (this is the Swissprot ID) as a "Group" search finds the correct gene in EREGO, KLULA, CANGL and SACCE. But searching with the sequence of the ''Ustilago maydis'' ortholog does not find the yeast protein, but the orthologs in YARLI, SCHPO, LACCBI, CRYNE and USTMA. Apparently the orthologous group has been split into several subgroups across the fungi. However as a whole the database is carefully constructed and available for download and API access; a large and useful resource.
 +
<div class="mw-collapsible mw-collapsed" data-expandtext="more..." data-collapsetext="less" style="width:800px">
 +
&nbsp;
 +
<div class="mw-collapsible-content">
 
   
 
   
# read PDB file using bio3D function read.pdb()
+
{{#pmid: 21113020}}
library(bio3d)
+
 
pdb  <- read.pdb(PDBin) # read the PDB file into a list
+
... see also the related articles, much innovative and carefully done work on automated orthologue definition by the Dessimoz group.
 +
</div>
 +
</div>
  
pdb            # examine the information
 
pdb$atom[1,]  # get information for the first atom
 
  
# you can explore ?read.pdb and study the examples.
+
;Orthologs by syntenic gene order conservation
 +
:We will revisit this when we explore the UCSC genome browser.
  
# ================================================
 
#    Change residue numbers
 
# ================================================
 
  
 +
;Orthologs by RBM
 +
:Defining it yourself. RBM (or: Reciprocal Best Match) is easy to compute and half of the work you have already done in [[BIO_Assignment_Week_3|Assignment 3]]. Get the ID for the gene which you have identified and annotated as the best BLAST match for Mbp1 in YFO and confirm that this gene has Mbp1 as the most significant hit in the yeast proteome. <small>The results are unambiguous, but there may be residual doubt whether these two best-matching sequences are actually the most similar orthologs.</small>
 +
 +
{{task|1=
 +
# Navigate to the BLAST homepage.
 +
# Paste the YFO RefSeq sequence identifier into the search field. (You don't have to search with sequences&ndash;you can search directly with an NCBI identifier '''IF''' you want to search with the full-length sequence.)
 +
# Set the database to refseq, and restrict the species to ''Saccharomyces cerevisiae''.
 +
# Run BLAST.
 +
# Keep the window open for the next task.
  
resNum <- as.numeric(pdb$atom[,"resno"]) # get residue numbers for all atoms
+
The top hit should be yeast Mbp1 (NP_010227). E mail me your sequence identifiers if it is not.
resNum <- resNum + (first - resNum[1])         # calculate offset
+
If it is, you have confirmed the '''RBM''' or '''BBM''' criterion (Reciprocal Best Match or Bidirectional Best Hit, respectively).
pdb$atom[,"resno"] <- resNum            # replace old numbers with new
 
pdb$atom[1,]                                  # check result
 
  
 +
<small>Technically, this is not perfectly true since you have searched with the APSES domain in one direction, with the full-length sequence in the other. For this task I wanted you to try the ''search-with-accession-number''. Therefore the procedural laxness, I hope it is permissible. In fact, performing the reverse search with the YFO APSES domain should actually be more stringent, i.e. if you find the right gene with the longer sequence, you are even more likely to find the right gene with the shorter one.</small>
 +
}}
  
# ================================================
 
#    Write output to file
 
# ================================================
 
  
write.pdb(pdb=pdb,file=PDBout)
+
;Orthology by annotation
 +
:The NCBI precomputes BLAST results and makes them available at the RefSeq database entry for your protein.
  
# Done. Open the PDB file you have written in a text editor and confirm
+
{{task|1=
# that this has worked.
+
# In your BLAST result page, click on the RefSeq link for your query to navigate to the RefSeq database entry for your protein.
 +
# Follow the '''Blink''' link in the right-hand column under '''Related information'''.
 +
# Restrict the view RefSeq under the "Display options" and to Fungi.  
  
</source>
+
You should see a number of genes with low E-values and high coverage in other fungi - however this search is problematic since the full length gene across the database finds mostly Ankyrin domains.
 
}}
 
}}
 +
 +
 +
You will find that '''all''' of these approaches yield '''some''' of the orthologs. But none finds them all. The take home message is: precomputed results are good for large-scale survey-type investigations, where you can't humanly process the information by hand. But for more detailed questions, careful manual searches are still indsipensable.
 +
 +
<div class="mw-collapsible mw-collapsed" data-expandtext="Expand for crowdsourcing" data-collapsetext="Collapse">
 +
;Orthology by crowdsourcing
 +
:Luckily a crowd of willing hands has prepared the necessary sequences for you: in the section below you will find a link to the annotated and verified Mbp1 orthologs from last year's course  :-)
 +
 +
<div class="mw-collapsible-content">
 +
We could call this annotation by many hands {{WP|Crowdsourcing|"crowdsourcing"}} - handing out small parcels of work to many workers, who would typically allocate only a small share of their time, but here the strength is in numbers and especially projects that organize via the Internet can tally up very impressive manpower, for free, or as {{WP|Microwork}}. These developments have some interest for bioinformatics: many of our more difficult tasks  can not be easily built into an algorithm, language related tasks such as text-mining, or pattern matching tasks come to mind. Allocating this to a large number of human contributors may be a viable alternative to computation. A marketplace where this kind of work is already a reality is {{WP|Amazon Mechanical Turk|Amazon's "Mechanical Turk" Marketplace}}: programmers&ndash;"requesters"&ndash; use an open interface to post tasks for payment, "providers" from all over the world can engage in these. Tasks may include matching of pictures, or evaluating the aesthetics of competing designs. A quirky example I came across recently was when information designer David McCandless had 200 "Mechanical Turks" draw a small picture of their soul for his collection.
 +
 +
The name {{WP|The Turk|"Mechanical Turk"}} by the way relates to a famous ruse, when a Hungarian inventor and adventurer toured the imperial courts of 18<sup>th</sup> century Europe with an automaton, dressed in turkish robes and turban, that played chess at the grandmaster level against opponents that included Napoleon Bonaparte and Benjamin Franklin. No small mechanical feat in any case, it was only in the 19<sup>th</sup> century that it was revealed that the computational power was actually provided by a concealed human.
 +
 +
Are you up for some "Turking"? Before the next quiz, edit [http://biochemistry.utoronto.ca/steipe/abc/students/index.php/BCH441_2014_Assignment_7_RBM '''the Mbp1 RBM page on the Student Wiki] and include the RBM for Mbp1, for a 10% bonus on the next quiz.
 +
 +
</div>
 +
</div>
  
  
 
&nbsp;
 
&nbsp;
  
===First visualization===
 
  
&nbsp;<br>
 
  
Since a homology model inherits its structural details from the '''template''', your model of the YFO sequence should look very similar to the original 1BM8 structure.
+
===Coloring a 3D model by conservation===
 +
 
 +
With the superimposed coordinates, you can begin to get a sense whether either or both binding modes could be appropriate for a protein-DNA complex in your Mbp1 orthologue. But these are geometrical criteria only, and the protein in your species may be flexible enough to adopt a different conformation in a complex, and different again from your model. A more powerful way to analyze such hypothetical complexes is to look at conservation patterns. With VMD, you can import a sequence alignment into the MultiSeq extension and color residies by conservation. The protocol below assumes
 +
 
 +
*You have prealigned the reference Mbp1 proteins with your species' Mbp1 orthologue;
 +
*You have saved the alignment in a CLUSTAL format.
 +
 
 +
You can use Jalview or any other MSA server to do so. You can even do this by hand - there should be few if any indels and the correct alignment is easy to see.
  
 
{{task|1=
 
{{task|1=
# Start Chimera and load the '''model''' coordinates that you have just renumbered.
+
;Load the Mbp1 APSES alignment into MultiSeq.
# From the PDB, also load the '''template''' structure. (Use File &rarr; Fetch by ID ...)
+
 
# In the '''Favourites''' &rarr; '''Model Panel''' window you can switch between the two molecules.
+
:(A) In the MultiSeq Window, navigate to '''File &rarr; Import Data...'''; Choose "From Files" and Browse to the location of the alignment you have saved. The File navigation window gives you options which files to enable: choose to Enable <code>ALN</code> files (these are CLUSTAL formatted multiple sequence alignments).  
# Hide the ribbon and choose '''backbone only &rarr; full'''. You will note that the backbone of the two structures is virtually identical.  
+
:(B) Open the alignment file, click on '''Ok''' to import the data, it will take a short while to load. If the data can't be loaded, the file may have the wrong extension: .aln is required.
# Next, choose '''Actions &rarr; Atoms/Bonds &rarr; show''' to display display the two molecules in a stick style and note how the sidechains have been modeled. Note especially how sidechain coordinates have been guessed, where the template had shorter sidechains than the target. It may be more clear if you hide H-atoms: '''Select &rarr; Chemistry &rarr; Element &rarr; H''' and '''Actions &rarr; Atoms/Bonds &rarr; hide'''
+
:(C) find the Mbp1_SACCE sequence in the list, click on it and move it to the top of the Sequences list with your mouse (the list is not static, you can re-order the sequences in any way you like).  
# Display only residue 50 to 74 to focus on the putative helix-turn-helix domain. Choose '''Favourites &rarr; Sequence''', select the residues for one model, then '''Select &rarr; Invert (selected model)''' and '''Actions &rarr; Atoms/Bonds &rarr; hide'''.
 
# Study the result. A model of the HTH domain of YFO Mbp1.
 
}}
 
  
&nbsp;<br>
+
You will see that the 1MB1 sequence and the APSES domain sequence do not match: at the N-terminus the sequence that corresponds to the PDB structure has extra residues, and in the middle the APSES sequences may have gaps inserted.
&nbsp;<br>
 
  
==Coloring the model by energy ==
+
;Bring the 1MB1 sequence in register with the APSES alignment.
 +
:(A)MultiSeq supports typical text-editor selection mechanisms. Clicking on a residue selects it, clicking on a row selects the whole sequence. Dragging with the mouse selects several residues, shift-clicking selects ranges, and option-clicking toggles the selection on or off for individual residues. Using the mouse and/or the shift key as required, select the '''entire first column''' of the sequences you have imported. 
 +
:(B) Select '''Edit &rarr; Enable Editing... &rarr; Gaps only''' to allow changing indels.
 +
:(C) Pressing the spacebar once should insert a gap character before the '''selected column''' in all sequences. Insert as many gaps as you need to align the beginning of sequences with the corresponding residues of 1MB1: <code>S I M ...</code>
 +
:(D) Now insert as many gaps as you need into the structure sequence, to align it completely with the Mbp1_SACCE APSES domain sequence. (Simply select residues in the sequence and use the space bar to insert gaps. (Note: I have noticed a bug that sometimes prevents slider or keyboard input to the MultiSeq window; it fails to regain focus after operations in a different window. I don't know whether this is a Mac related problem or a more general bug in MultiSeq. When this happens I quit VMD and restore the session from a saved state. It is a bit annoying but not mission-critical.)
 +
:(E) When you are done, it may be prudent to save the state of your alignment. Use '''File &rarr; Save Session...'''
  
SwissModel calculates energies for each residue of the model with a molecular mechanics forcefield. The SwissModel modeling summary page contains a plot of these energies as a function of sequence number like. The values - between 0.0 and 1.0 - are stored in the PDB files B-factor field.
+
;Color by similarity
 +
:(A) Use the '''View &rarr; Coloring &rarr; Sequence similarity &rarr; BLOSUM30''' option to color the residues in the alignment and structure. This clearly shows you where conserved and variable residues are located and allows to analyze their structural context.
 +
:(B) You can adjust the color scale in the usual way by navigating to '''VMD main &rarr; Graphics &rarr; Colors...''', choosing the Color Scale tab and adjusting the scale midpoint.  
 +
:(C) Navigate to the '''Representations''' window and apply the color scheme to your tube-and-sidechain representation: double-click on the NewCartoon representation to hide it and use '''User''' coloring of your ''Tube'' and ''Licorice'' representations to apply the sequence similarity color gradient that MultiSeq has calculated.  
  
 +
&nbsp;<br><div style="padding: 5px; background: #DDDDEE;">
 +
* Once you have colored the residues of your model by conservation, create another informative stereo-image and paste it into your assignment.
 +
</div>
  
{{task|1=
 
# Back in Chimera, use the model panel to '''close''' the 1BM8 structure.
 
# Choose '''Tools &rarr; Depiction &rarr; Render by attribute''' and select '''attributes of atoms''', '''Attribute: bfactor''', check '''color atoms''' and click '''OK'''.
 
# Study the result: It seems that residues in the core of the protein have better energies than residues at the surface. Why could that be the case?
 
 
}}
 
}}
  
Study the options of this window a bit, rendering by attribute is a powerful way to store and depict all manners of information with the molecule. Simply write a little R script that uses bio3D to replace the B-factor or occupancy values with any value you might be interested in: energies, conservation scores, information ... whatever. The rewnder this property to map it on the 3D structure of your molecule. If you want to experience with this a bit, you could apply the information scores from the previous assignment to your model, using a script that is easy to derive from the renumbering R-script you have studied above.
+
{{vspace}}
 
 
  
 +
-->
  
;That is all.
+
{{Vspace}}
  
 
==Links and Resources==
 
==Links and Resources==
 +
;Literature
 +
{{#pmid: 26323765}}
 +
{{#pmid: 22114356}}
 +
{{#pmid: 19190756}}
  
&nbsp;<br>
+
Also: [http://www.nature.com/scitable/topicpage/reading-a-phylogenetic-tree-the-meaning-of-41956 Nature-Scitable (2008): '''Reading a Phylogenetic Tree: The Meaning of Monophyletic Groups''']
  
{{#pmid: 24782522}}
+
{{#pmid: 12801728}}
{{#pmid: 22323219}}
+
:* [http://evolution.genetics.washington.edu/phylip/phylip.html '''PHYLIP''' documentation]
{{#pmid: 12117790}}
+
{{PDF
 +
|authors= Tuimala, Jarno
 +
|year= 2006
 +
|title= A primer to phylogenetic analysis using the PHYLIP package
 +
|journal=
 +
|volume=
 +
|pages=
 +
|URL= http://koti.mbnet.fi/tuimala/oppaat/phylip2.pdf
 +
|doi=
 +
|file= Tuimala_PHYLIP.pdf
 +
|abstract= The purpose of this tutorial is to demonstrate how to use PHYLIP, a collection of phylogenetic analysis software, and some of the options that are available. This tutorial is not intended to be a course in phylogenetics, although some phylogenetic concepts will be discussed briefly. There are other books available which cover the theoretical sides of the phylogenetic analysis, but the actual data analysis work is less well covered. Here we will mostly deal with molecular sequence data analysis in the current PHYLIP version 3.66.
 +
}}
  
  
:* [http://www.wwpdb.org/documentation/format23/v2.3.html '''PDB file format'''] (see the Coordinate Section if you are unsure about chain identifiers)
+
;Software
:* [http://en.wikipedia.org/wiki/Structural_alignment Wikipedia on '''Structural Superposition'''] <small>(although the article is called "Structural Alignment")</small>
+
:* [http://evolution.genetics.washington.edu/phylip.html '''PHYLIP''' home page]
 +
<!-- not currently active
 +
:* [http://itol.embl.de/ '''iTOL''' - Interactive Tree of Life project''']
 +
-->
  
 +
;Sequences
 +
:* [[Reference APSES domains (reference species)|'''reference APSES domains page''']]
  
  
;Reference sequences
 
 
:* [[All_Mbp1_proteins|'''All Mbp1 ortholog sequences''']]
 
  
 
<!-- {{#pmid: 19957275}} -->
 
<!-- {{#pmid: 19957275}} -->
Line 485: Line 794:
 
&nbsp;
 
&nbsp;
 
{{#lst:BIO_Assignment_Week_1|assignment_footer}}
 
{{#lst:BIO_Assignment_Week_1|assignment_footer}}
 +
 +
<table style="width:100%;"><tr>
 +
<td style="height:30px; vertical-align:middle; text-align:left; font-size:80%;">[[BIO_Assignment_Week_6|&lt;&nbsp;Assignment&nbsp;6]]</td>
 +
<td style="height:30px; vertical-align:middle; text-align:right; font-size:80%;">[[BIO_Assignment_Week_8|Assignment&nbsp;8&nbsp;&gt;]]</td>
 +
</tr></table>
  
  

Latest revision as of 15:19, 27 August 2017

Assignment for Week 7
Phylogenetic Analysis

< Assignment 6 Assignment 8 >

Note! This assignment is currently inactive. Major and minor unannounced changes may be made at any time.

 
 



 


 
Nothing in Biology makes sense except in the light of evolution.
Theodosius Dobzhansky

... but does evolution make sense in the light of biology?


 

 

As we have seen in the previous assignments, the Mbp1 transcription factor has homologues in all other fungi, yet there is not always a clear one-to-one mapping between members of a family in distantly related species. It appears that various systems of APSES domain transcription factors have evolved independently. Of course this bears directly on our notion of function - what it means to say that two genes in different organisms have the "same" function. In case two organisms both have an orthologous gene for the same, distinct function, calling these functions "the same" may be warranted. But what if that gene has duplicated in one species, and the two paralogues now perform different, related functions in one organism? Theses two are still orthologues to both their homologues in the other species, but now we expect functionally significant residues to have adapted to the new - and possibly distinct - roles of each paralogue. In order to be able to even ask such questions, we need to make the evolutionary history of gene families explicit. This is the domain of phylogenetic analysis. We can ask questions like: how many paralogues did the cenancestor of a clade possess? Which of these underwent additional duplications in the phylogenesis of the organism I am studying? Did any genes get lost? And - adding additional biological insight to the picture - did the observed duplications lead to the "invention" of new biological systems? When was that? And perhaps even: how did the species benefit from this event?

We will develop this kind of analysis in this assignment. In the previous assignment you have established which gene in your species is the reciprocally most closely related orthologue to yeast Mbp1 (with reciprocal best match) and you have identified the full complement of APSES domain genes in your assigned organism (as a result of your PSI-BLAST search). In this assignment, we will analyse these genes' evolutionary relationship and compare it to the evolutionary relationship of other fungal APSES domains. The goal is to define families of related transcription factors and their evolutionary history. All APSES domain annotations are now available in your protein "database". Now we will attempt to compute the phylogram for these proteins. The goal is to identify orthologues and paralogues.

A number of excellent tools for phylogenetic analysis exist; general purpose packages include the (free) PHYLIP package, the MEGA package and the (commercial) PAUP* package. Of these, only MEGA is still under active development, although PHYLIP still functions perfectly (except for problems with graphical windows under Mac OS 10.6). Specialized tools for tree-building include Treepuzzle or Mr. Bayes. This assignment is constructed around programs that are available in PHYLIP, however you are welcome to use other tools that fulfill a similar purpose if you wish. In this field, researchers consider trees that have been built with ML (maximum likelihood) methods to be more reliable than trees that are built with parsimony methods, or distance methods such as NJ (Neighbor Joining). However ML methods are also much more compute-intensive. Just like with multiple sequence alignments, some algorithms will come closer to guessing the truth and others will not and usually it is hard to tell which is the more trustworthy of two diverging results. The prudent researcher tries out alternatives and forms her own opinion. Specifically, we may usually assume results that converge when computed with different algorithms, to be more reliable than those that depend strongly on a particular algorithm, parameters, or details of input data.

In this assignment, we will take a computational shortcut, (something you should not do in real life). We will skip establishing the reliability of the tree with a bootstrap procedure, i.e. repeat the tree-building a hundred times with partial data and see which branches and groupings are robust and which depend on the details of the data. (If you are interested, have a look here for the procedure for running a bootstrap analysis on the data set you are working with, but this may require a day or so of computing time on your computer.) In this assignment, we will simply acknowledge that bifurcations that are very close to each other have not been "resolved" and be appropriately cautious in our inferences. In phylogenetic analysis, not all lines a program draws are equally trustworthy. Don't take the trees as a given fact just because a program suggests this. Look at the evidence, include independent information where available, use your reasoning, and analyse the results critically. As you will see, there are some facts that we know for certain: we know which species the genes come from, and we can (usually) make good assumptions about the relationship of the species themselves - the history of speciation events that underlies all evolution of genes. This is extremely helpful information for our work.


If you would like to review concepts of trees, clades, LCAs, OTUs and the like, I have linked an excellent and very understandable introduction-level article on phylogenetic analysis here and to the resource section at the bottom of this page.

Baldauf (2003) Phylogeny for the faint of heart: a tutorial. Trends Genet 19:345-51. (pmid: 12801728)

PubMed ] [ DOI ] Phylogenetic trees seem to be finding ever broader applications, and researchers from very different backgrounds are becoming interested in what they might have to say. This tutorial aims to introduce the basics of building and interpreting phylogenetic trees. It is intended for those wanting to understand better what they are looking at when they look at someone else's trees or to begin learning how to build their own. Topics covered include: how to read a tree, assembling a dataset, multiple sequence alignment (how it works and when it does not), phylogenetic methods, bootstrap analysis and long-branch artefacts, and software and resources.


 

R packages that may be useful include the following:

  • R task view Phylogenetics - this task-view gives an excellent, curated overview of the important R-packages in the domain.
  • package ape - general purpose phylogenetic analysis, but (as far as I can tell ape only supports analysis with DNA sequences).
  • package ips - wrapper for MrBayes, Beast, RAxML "heavy-duty" phylogenetic analysis packages.
  • package Rphylip - Wrapper for Phylip, the most versatile set of phylogenetic inference tools.


 

Preparing input alignments

 

You have previously collected homologous sequences and their annotations. We will use these as input for phylogenetic analysis. But let's discuss first how such an input file should be constructed.


 

Principles

In order to use molecular sequences for the construction of phylogenetic trees, you have to build a multiple alignment first. This is important: phylogenetic analysis does not build alignments, nor does it revise alignments, it analyses them after the alignment has been computed. A precondition for the analysis to be meaningful is that all rows of sequences have to contain the exact same number of characters and to hold aligned characters in corresponding positions (i.e. columns). The program's inferences are made on a column-wise basis and if your columns contain data from unrelated positions, the inferences are going to be questionable. Clearly, in order for tree-estimation to work, one must not include fragments of sequence which have evolved under a different evolutionary model as all others, e.g. after domain fusion, or after accommodating large stretches of indels. Thus it is appropriate to edit the sequences and pare them down to a most characteristic subset of amino acids. The goal is not to be as comprehensive as possible, but to input those columns of aligned residues that will best represent the true phylogenetic relationships between the sequences.


The result of the tree construction is a decision about the most likely evolutionary relationships. Fundamentally, tree-construction programs decide which sequences had common ancestors.


Distance based phylogeny programs start by using sequence comparisons to estimate evolutionary distances:

  • they apply a model of evolution such as a mutation data matrix, to calculate a score for each pair of sequences,
  • this score is stored in a "distance matrix" ...
  • ... and used to estimate a tree that groups sequences with close relationships together. (e.g. by using an NJ, Neigbor Joining, algorithm).

They are fast, can work on large numbers of sequences, but are less accurate if genes evolve at different rates.

Parsimony based phylogeny programs build a tree that minimizes the number of mutation events that are required to get from a common ancestral sequence to all observed sequences. They take all columns into account, not just a single number per sequence pair, as the Distance Methods do. For closely related sequences they work very well, but they construct inaccurate trees when they can't make good estimates for the required number of sequence changes.


ML, or Maximum Likelihood methods attempt to find the tree for which the observed sequences would be the most likely under a particular evolutionary model. They are based on a rigorous statistical framework and yield the most robust results. But they are also quite compute intensive and a tree of the size that we are building in this assignment is a challenge for the resources of common workstation (runs about an hour on my computer). If the problem is too large, one may split a large problem into smaller, obvious subtrees (e.g. analysing orthologues as a group, only including a few paralogues for comparison) and then merge the smaller trees; this way even very large problems can become tractable.

ML methods suffer less from "long-branch attraction" - the phenomenon that weakly similar sequences can be grouped inappropriately close together in a tree due to spuriously shared differences.


Bayesian methods don't estimate the tree that gives the highest likelihood for the observed data, but find the most probably tree, given that the data have been observed. If this sounds conceptually similar to you, then you are not wrong. However, the approaches employ very different algorithms. And Bayesian methods need a "prior" on trees before observation.



 

Choosing sequences

 

To illustrate the principle we will construct input files by joining APSES domain and Ankyrin domain sequences and for this we will use the Prosite annotations we have collected for the reference set of sequences and your YFO sequences.

Task:

  • Open RStudio.
  • Choose File → Recent Projects → BCH441_2016.
  • Pull the latest version of the project repository from GitHub.
  • type init()
  • Open the file BCH441_A07.R and work through PART ONE: Choosing sequences.


 

Adding an Outgroup

 

An outgroup is a sequence that is more distantly related to all of the other sequences than any of them are to each other. This allows us to root the tree, because the root - the last common ancestor to all - must be somewhere on the branch that connects the outgroup to the rest. And whenever a molecular clock is assumed, the branching point that connects the outgroup can be assumed to be the oldest divergence event. Having a root that we can compare to the phylogram of species makes the tree interpretation much more intuitive. In our case, we are facing the problem that our species cover all of the known fungi, thus we can' rightly say that any of them are more distant to the rest. We have to look outside the fungi. The problem is, outside of the fungi there are no proteins with APSES domains. We can take the E. coli KilA-N domain sequence - a known, distant homologue to the APSES domain instead, even though it only aligns to a part of the APSES domains.

Here is the KilA-N domain sequence in the E. coli Kil-A protein:

>WP_000200358.1 hypothetical protein [Escherichia coli]
MTSFQLSLISREIDGEIIHLRAKDGYINATSMCRTAGKLLSDYTRLKTTQEFFDELSRDMGIPISELIQS
FKGGRPENQGTWVHPDIAINLAQWLSPKFAVQVSRWVREWMSGERTTAEMPVHLKRYMVNRSRIPHTHFS
ILNELTFNLVAPLEQAGYTLPEKMVPDISQGRVFSQWLRDNRNVEPKTFPTYDHEYPDGRVYPARLYPNE
YLADFKEHFNNIWLPQYAPKYFADRDKKALALIEKIMLPNLDGNEQF

E. coli KilA-N protein. Residues that do not align with APSES domains are shown in grey.

The assignment R - code contains code to add it to the group of APSES sequences.



Task:

  • Continue with the R-code: PART TWO: Multiple sequence alignment


 

Reviewing and Editing alignments

 

As discussed in the lecture, it is usually necessary to edit a multiple sequence alignment to make it suitable for phylogenetic inference. Here are the principles:

All characters in a column should be related by homology.

This implies the following rules of thumb:

  • Remove all stretches of residues in which the alignment appears ambiguous (not just highly variable, but ambiguous regarding the aligned positions).
  • Remove all frayed N- and C- termini, especially regions in which not all sequences that are being compared appear homologous and that may stem from unrelated domains. You want to only retain the APSES domains. All the extra residues from the YFO sequence can be deleted.
  • Remove all gapped regions that appear to be alignment artefacts due to inappropriate input sequences.
  • Remove all but approximately one column from gapped regions in those cases where the presence of several related insertions suggest that the indel is real, and not just an alignment artefact. (Some researchers simply remove all gapped regions).
  • Remove sections N- and C- terminal of gaps where the alignment appears questionable.
  • If the sequences fit on a single line you will save yourself potential trouble with block-wise vs. interleaved input. If you do run out of memory try removing columns of sequence. Or remove species that you are less interested in from the alignment.
  • Move your outgroup sequence to the first line of your alignment, since this is where PHYLIP will look for it by default.


Indels are even more of a problem than usual. Strictly speaking, the similarity score of an alignment program as well as the distance score of a phylogeny program are not calculated for an ordered sequence, but for a sum of independent values, one for each aligned columns of characters. The order of the columns does not change the score. However in an optimal sequence alignment with gaps, this is no longer strictly true since a one-character gap creation has a different penalty score than a one-character gap extension! Most alignment programs use a model with a constant gap insertion penalty and a linear gap extension penalty. This is not rigorously justified from biology, but parametrized (or you could say "tweaked") to correspond to our observations. However, most phylogeny programs do not work in this way. They strictly operate on columns of characters and treat a gap character just like a residue with the one letter code "-". Thus gap insertion- and extension- characters get the same score. For short indels, this underestimates the distance between pairs of sequences, since any evolutionary model should reflect the fact that gaps are much less likely than point mutations. If the gap is very long though, all events are counted individually as many single substitutions (rather than one lengthy one) and this overestimates the distance. And it gets worse: long stretches of gaps can make sequences appear similar in a way that is not justified, just because they are identical in the "-" character. It is therefore common and acceptable to edit gaps in the alignment and delete all but a few columns of gapped sequence, or to remove such columns altogether.



 

 


(Possible) steps in editing a multiple sequence alignment towards a PHYLIP input file. a: raw alignment (CLUSTAL format); b: sequences assembled into single lines; c: columns to be deleted highlighted in red - 1, 3 and 4: large gaps; 2: uncertain alignment and 5: frayed C-terminus: both would put non-homologous characters into the same column; d: input data for PHYLIP: names for sequences must not be longer than 10 characters, the first line must contain the number of sequences and the sequence length. PHYLIP is very picky about incorrectly formatted input, read the PHYLIP sequence format guide. Fortunately Rphylip does the formatting step for you.


There is more to learn about this important step of working with aligned sequences, here is an overview of the literature on various algorithms and tools that are available.

Talavera & Castresana (2007) Improvement of phylogenies after removing divergent and ambiguously aligned blocks from protein sequence alignments. Syst Biol 56:564-77. (pmid: 17654362)

PubMed ] [ DOI ] Alignment quality may have as much impact on phylogenetic reconstruction as the phylogenetic methods used. Not only the alignment algorithm, but also the method used to deal with the most problematic alignment regions, may have a critical effect on the final tree. Although some authors remove such problematic regions, either manually or using automatic methods, in order to improve phylogenetic performance, others prefer to keep such regions to avoid losing any information. Our aim in the present work was to examine whether phylogenetic reconstruction improves after alignment cleaning or not. Using simulated protein alignments with gaps, we tested the relative performance in diverse phylogenetic analyses of the whole alignments versus the alignments with problematic regions removed with our previously developed Gblocks program. We also tested the performance of more or less stringent conditions in the selection of blocks. Alignments constructed with different alignment methods (ClustalW, Mafft, and Probcons) were used to estimate phylogenetic trees by maximum likelihood, neighbor joining, and parsimony. We show that, in most alignment conditions, and for alignments that are not too short, removal of blocks leads to better trees. That is, despite losing some information, there is an increase in the actual phylogenetic signal. Overall, the best trees are obtained by maximum-likelihood reconstruction of alignments cleaned by Gblocks. In general, a relaxed selection of blocks is better for short alignment, whereas a stringent selection is more adequate for longer ones. Finally, we show that cleaned alignments produce better topologies although, paradoxically, with lower bootstrap. This indicates that divergent and problematic alignment regions may lead, when present, to apparently better supported although, in fact, more biased topologies.

Capella-Gutiérrez et al. (2009) trimAl: a tool for automated alignment trimming in large-scale phylogenetic analyses. Bioinformatics 25:1972-3. (pmid: 19505945)

PubMed ] [ DOI ] SUMMARY: Multiple sequence alignments are central to many areas of bioinformatics. It has been shown that the removal of poorly aligned regions from an alignment increases the quality of subsequent analyses. Such an alignment trimming phase is complicated in large-scale phylogenetic analyses that deal with thousands of alignments. Here, we present trimAl, a tool for automated alignment trimming, which is especially suited for large-scale phylogenetic analyses. trimAl can consider several parameters, alone or in multiple combinations, for selecting the most reliable positions in the alignment. These include the proportion of sequences with a gap, the level of amino acid similarity and, if several alignments for the same set of sequences are provided, the level of consistency across different alignments. Moreover, trimAl can automatically select the parameters to be used in each specific alignment so that the signal-to-noise ratio is optimized. AVAILABILITY: trimAl has been written in C++, it is portable to all platforms. trimAl is freely available for download (http://trimal.cgenomics.org) and can be used online through the Phylemon web server (http://phylemon2.bioinfo.cipf.es/). Supplementary Material is available at http://trimal.cgenomics.org/publications.

Blouin et al. (2009) Reproducing the manual annotation of multiple sequence alignments using a SVM classifier. Bioinformatics 25:3093-8. (pmid: 19770262)

PubMed ] [ DOI ] MOTIVATION: Aligning protein sequences with the best possible accuracy requires sophisticated algorithms. Since the optimal alignment is not guaranteed to be the correct one, it is expected that even the best alignment will contain sites that do not respect the assumption of positional homology. Because formulating rules to identify these sites is difficult, it is common practice to manually remove them. Although considered necessary in some cases, manual editing is time consuming and not reproducible. We present here an automated editing method based on the classification of 'valid' and 'invalid' sites. RESULTS: A support vector machine (SVM) classifier is trained to reproduce the decisions made during manual editing with an accuracy of 95.0%. This implies that manual editing can be made reproducible and applied to large-scale analyses. We further demonstrate that it is possible to retrain/extend the training of the classifier by providing examples of multiple sequence alignment (MSA) annotation. Near optimal training can be achieved with only 1000 annotated sites, or roughly three samples of protein sequence alignments. AVAILABILITY: This method is implemented in the software MANUEL, licensed under the GPL. A web-based application for single and batch job is available at http://fester.cs.dal.ca/manuel. SUPPLEMENTARY INFORMATION: Supplementary data are available at Bioinformatics online.

Penn et al. (2010) GUIDANCE: a web server for assessing alignment confidence scores. Nucleic Acids Res 38:W23-8. (pmid: 20497997)

PubMed ] [ DOI ] Evaluating the accuracy of multiple sequence alignment (MSA) is critical for virtually every comparative sequence analysis that uses an MSA as input. Here we present the GUIDANCE web-server, a user-friendly, open access tool for the identification of unreliable alignment regions. The web-server accepts as input a set of unaligned sequences. The server aligns the sequences and provides a simple graphic visualization of the confidence score of each column, residue and sequence of an alignment, using a color-coding scheme. The method is generic and the user is allowed to choose the alignment algorithm (ClustalW, MAFFT and PRANK are supported) as well as any type of molecular sequences (nucleotide, protein or codon sequences). The server implements two different algorithms for evaluating confidence scores: (i) the heads-or-tails (HoT) method, which measures alignment uncertainty due to co-optimal solutions; (ii) the GUIDANCE method, which measures the robustness of the alignment to guide-tree uncertainty. The server projects the confidence scores onto the MSA and points to columns and sequences that are unreliably aligned. These can be automatically removed in preparation for downstream analyses. GUIDANCE is freely available for use at http://guidance.tau.ac.il.

Rajan (2013) A method of alignment masking for refining the phylogenetic signal of multiple sequence alignments. Mol Biol Evol 30:689-712. (pmid: 23193120)

PubMed ] [ DOI ] Inaccurate inference of positional homologies in multiple sequence alignments and systematic errors introduced by alignment heuristics obfuscate phylogenetic inference. Alignment masking, the elimination of phylogenetically uninformative or misleading sites from an alignment before phylogenetic analysis, is a common practice in phylogenetic analysis. Although masking is often done manually, automated methods are necessary to handle the much larger data sets being prepared today. In this study, we introduce the concept of subsplits and demonstrate their use in extracting phylogenetic signal from alignments. We design a clustering approach for alignment masking where each cluster contains similar columns-similarity being defined on the basis of compatible subsplits; our approach then identifies noisy clusters and eliminates them. Trees inferred from the columns in the retained clusters are found to be topologically closer to the reference trees. We test our method on numerous standard benchmarks (both synthetic and biological data sets) and compare its performance with other methods of alignment masking. We find that our method can eliminate sites more accurately than other methods, particularly on divergent data, and can improve the topologies of the inferred trees in likelihood-based analyses. Software available upon request from the author.


 

Sequence masking with R

 

As you saw while inspecting the multiple sequence alignment, there are regions that are poorly suited for phylogenetic analysis due to the large numbers of gaps.

A good approach to edit the alignment is to import your sequences into Jalview and remove uncertain columns by hand.

But for this assignment, let's write code for a simple masking heuristic.


 

Task:

  • Head back to the RStudio project and work through PART THREE: reviewing and editing alignments


 

Calculating trees

 

In this section we perform the actual phylogenetic calculation.


 

Task:

  • Download the PHYLIP suite of programs from the Phylip homepage and install it on your computer.
  • Return to the RStudio project and work through PART FOUR: Calculating trees.


 


Analysing your tree

 

In order to analyse your tree, you need a species tree as reference. This really is an absolute prerequisite to make your expectations about the observed tree explicit. Fortunately we have all species nicely documented in our database.


 

The reference species tree

 

Task:

  • Execute the following R command to create an Entrez command that will retrieve all taxonomy records for the species in your database:
cat(paste(paste(c(myDB$taxonomy$ID, "83333"), "[taxid]", sep=""), collapse=" OR "))
  • Copy the Entrez command, and enter it into the search field of the NCBI taxonomy page. Click on Search. The resulting page should have twelve species listed - ten "reference" fungi, E. coli (as the outgroup), and YFO. Make sure YFO is included! If it's not there, you did something wrong that needs to be fixed.
  • Click on the Summary options near the top-left of the page, and select Common Tree. This places all the species into the universal tree of life and identifies their relationships.
  • At the top, there is an option to Save as ... and the option to select a format to save the tree in. Select Phylip Tree as the format and click the Save as button. The file phyliptree.phy will be downloaded to your computer into your default download directory. Move it to the directory you have defined as PROJECTDIR.
  • Open the file in a text-editor. This is a tree, specified in the so-called "Newick format". The topology of the tree is defined through the brackets, and the branch-lengths are all the same: this is a cladogram, not a phylogram. The tree contains the long names for the species/strains and for our purposes we really need the "biCodes" instead. I can't think of a very elegant way to make that change programmatically, so just go ahead and replace the species names (not the taxonomic ranks though) with their biCode in your text editor. Remove all the single quotes, and replace any remaining blanks in names with an underscore. Take care however not to delete any colons or parentheses. Save the file.

My version looks like this - Your version must have YFO somewhere in the tree..

(
'ESCCO':4,
(
(
'PUCGR':4,
'USTMA':4,
(
'WALME':4,
'COPCI':4,
'CRYNE':4
)Agaricomycotina:4
)Basidiomycota:4,
(
(
(
'ASPNI':4,
'BIPOR':4,
'NEUCR':4
)leotiomyceta:4,
'SACCE':4
)saccharomyceta:4,
'SCHPO':4
)Ascomycota:4
)Dikarya:4
)'cellular organisms':4;
  • Now read the tree in R and plot it.
# Download the EDITED phyliptree.phy 
orgTree <- read.tree("phyliptree.phy")

# Plot the tree in a new window
dev.new(width=6, height=3)
plot(orgTree, cex=1.0, root.edge=TRUE, no.margin=TRUE)
nodelabels(text=orgTree$node.label, cex=0.6, adj=0.2, bg="#D4F2DA")


 

I have constructed a cladogram for many of the species we are analysing, based on data published for 1551 fungal ribosomal sequences. The six reference species are included. Such reference trees from rRNA data are a standard method of phylogenetic analysis, supported by the assumption that rRNA sequences are monophyletic and have evolved under comparable selective pressure in all species.


 
FungiCladogram.jpg


Cladogram of the "reference" fungi studied in the assignments. This cladogram is based on a tree returned by the NCBI Common Tree. It is thus a digest of cladistic relationships, not a representation of a specific molecular phylogeny.

Alternatively, you can look up your species in the latest version of the species tree for the fungi and add it to the tree by hand while resolving the trifurcations. See:

Ebersberger et al. (2012) A consistent phylogenetic backbone for the fungi. Mol Biol Evol 29:1319-34. (pmid: 22114356)

PubMed ] [ DOI ] The kingdom of fungi provides model organisms for biotechnology, cell biology, genetics, and life sciences in general. Only when their phylogenetic relationships are stably resolved, can individual results from fungal research be integrated into a holistic picture of biology. However, and despite recent progress, many deep relationships within the fungi remain unclear. Here, we present the first phylogenomic study of an entire eukaryotic kingdom that uses a consistency criterion to strengthen phylogenetic conclusions. We reason that branches (splits) recovered with independent data and different tree reconstruction methods are likely to reflect true evolutionary relationships. Two complementary phylogenomic data sets based on 99 fungal genomes and 109 fungal expressed sequence tag (EST) sets analyzed with four different tree reconstruction methods shed light from different angles on the fungal tree of life. Eleven additional data sets address specifically the phylogenetic position of Blastocladiomycota, Ustilaginomycotina, and Dothideomycetes, respectively. The combined evidence from the resulting trees supports the deep-level stability of the fungal groups toward a comprehensive natural system of the fungi. In addition, our analysis reveals methodologically interesting aspects. Enrichment for EST encoded data-a common practice in phylogenomic analyses-introduces a strong bias toward slowly evolving and functionally correlated genes. Consequently, the generalization of phylogenomic data sets as collections of randomly selected genes cannot be taken for granted. A thorough characterization of the data to assess possible influences on the tree reconstruction should therefore become a standard in phylogenomic analyses.


 


Task:

  • Return to the RStudio project and continue with the script to its end. Note the deliverable at the end: to print out your trees and bring them to class.


 

Links and Resources

Literature
Szöllősi et al. (2015) Genome-scale phylogenetic analysis finds extensive gene transfer among fungi. Philos Trans R Soc Lond., B, Biol Sci 370:20140335. (pmid: 26323765)

PubMed ] [ DOI ] Although the role of lateral gene transfer is well recognized in the evolution of bacteria, it is generally assumed that it has had less influence among eukaryotes. To explore this hypothesis, we compare the dynamics of genome evolution in two groups of organisms: cyanobacteria and fungi. Ancestral genomes are inferred in both clades using two types of methods: first, Count, a gene tree unaware method that models gene duplications, gains and losses to explain the observed numbers of genes present in a genome; second, ALE, a more recent gene tree-aware method that reconciles gene trees with a species tree using a model of gene duplication, loss and transfer. We compare their merits and their ability to quantify the role of transfers, and assess the impact of taxonomic sampling on their inferences. We present what we believe is compelling evidence that gene transfer plays a significant role in the evolution of fungi.

Ebersberger et al. (2012) A consistent phylogenetic backbone for the fungi. Mol Biol Evol 29:1319-34. (pmid: 22114356)

PubMed ] [ DOI ] The kingdom of fungi provides model organisms for biotechnology, cell biology, genetics, and life sciences in general. Only when their phylogenetic relationships are stably resolved, can individual results from fungal research be integrated into a holistic picture of biology. However, and despite recent progress, many deep relationships within the fungi remain unclear. Here, we present the first phylogenomic study of an entire eukaryotic kingdom that uses a consistency criterion to strengthen phylogenetic conclusions. We reason that branches (splits) recovered with independent data and different tree reconstruction methods are likely to reflect true evolutionary relationships. Two complementary phylogenomic data sets based on 99 fungal genomes and 109 fungal expressed sequence tag (EST) sets analyzed with four different tree reconstruction methods shed light from different angles on the fungal tree of life. Eleven additional data sets address specifically the phylogenetic position of Blastocladiomycota, Ustilaginomycotina, and Dothideomycetes, respectively. The combined evidence from the resulting trees supports the deep-level stability of the fungal groups toward a comprehensive natural system of the fungi. In addition, our analysis reveals methodologically interesting aspects. Enrichment for EST encoded data-a common practice in phylogenomic analyses-introduces a strong bias toward slowly evolving and functionally correlated genes. Consequently, the generalization of phylogenomic data sets as collections of randomly selected genes cannot be taken for granted. A thorough characterization of the data to assess possible influences on the tree reconstruction should therefore become a standard in phylogenomic analyses.

Marcet-Houben & Gabaldón (2009) The tree versus the forest: the fungal tree of life and the topological diversity within the yeast phylome. PLoS ONE 4:e4357. (pmid: 19190756)

PubMed ] [ DOI ] A recurrent topic in phylogenomics is the combination of various sequence alignments to reconstruct a tree that describes the evolutionary relationships within a group of species. However, such approach has been criticized for not being able to properly represent the topological diversity found among gene trees. To evaluate the representativeness of species trees based on concatenated alignments, we reconstruct several fungal species trees and compare them with the complete collection of phylogenies of genes encoded in the Saccharomyces cerevisiae genome. We found that, despite high levels of among-gene topological variation, the species trees do represent widely supported phylogenetic relationships. Most topological discrepancies between gene and species trees are concentrated in certain conflicting nodes. We propose to map such information on the species tree so that it accounts for the levels of congruence across the genome. We identified the lack of sufficient accuracy of current alignment and phylogenetic methods as an important source for the topological diversity encountered among gene trees. Finally, we discuss the implications of the high levels of topological variation for phylogeny-based orthology prediction strategies.

Also: Nature-Scitable (2008): Reading a Phylogenetic Tree: The Meaning of Monophyletic Groups

Baldauf (2003) Phylogeny for the faint of heart: a tutorial. Trends Genet 19:345-51. (pmid: 12801728)

PubMed ] [ DOI ] Phylogenetic trees seem to be finding ever broader applications, and researchers from very different backgrounds are becoming interested in what they might have to say. This tutorial aims to introduce the basics of building and interpreting phylogenetic trees. It is intended for those wanting to understand better what they are looking at when they look at someone else's trees or to begin learning how to build their own. Topics covered include: how to read a tree, assembling a dataset, multiple sequence alignment (how it works and when it does not), phylogenetic methods, bootstrap analysis and long-branch artefacts, and software and resources.

Tuimala, Jarno (2006) A primer to phylogenetic analysis using the PHYLIP package.  
(pmid: None)Source URL ] The purpose of this tutorial is to demonstrate how to use PHYLIP, a collection of phylogenetic analysis software, and some of the options that are available. This tutorial is not intended to be a course in phylogenetics, although some phylogenetic concepts will be discussed briefly. There are other books available which cover the theoretical sides of the phylogenetic analysis, but the actual data analysis work is less well covered. Here we will mostly deal with molecular sequence data analysis in the current PHYLIP version 3.66.


Software
Sequences



 


Footnotes and references


 

Ask, if things don't work for you!

If anything about the assignment is not clear to you, please ask on the mailing list. You can be certain that others will have had similar problems. Success comes from joining the conversation.



< Assignment 6 Assignment 8 >