Top Banner
CSE 111 Bio: Program Design I Lecture 24: Phylogenetic trees Robert Sloan (CS) & Rachel Poretsky (Bio) University of Illinois, Chicago November 21, 2017 https://imgs.xkcd.com/comics/tree.png
64

DICTIONARIES (CONT.)

Feb 27, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: DICTIONARIES (CONT.)

CSE111Bio:ProgramDesignILecture24:Phylogenetictrees

RobertSloan(CS)&RachelPoretsky(Bio)UniversityofIllinois,Chicago

November21,2017

https://imgs.xkcd.com/comics/tree.png

Page 2: DICTIONARIES (CONT.)

TuesdayafterThanksgiving

• About5minutesofclasswillbespentonCSdepartmentClimatesurvey

• AdministeredinCS111,141,andCS251eachfallbyCSstudentaffairsstaff

• Easytodoonyourphone,butbringlaptopifyoupreferthat

Page 3: DICTIONARIES (CONT.)

DICTIONARIES(CONT.)

Page 4: DICTIONARIES (CONT.)

def translate():d = {"hello":"hola", "goodbye":"adios", "good":"bueno", "spam":"spam"}for word in d:

print(word, "is: ", d[word])d["more"] = "mas"

translate() A. hello is: holagoodbye is: adiosgood is: buenospam is: spam

B.good is: buenohello is: holagoodbye is: adiosspam is: spam

C. E. A or D or otherhello is: holagoodbye is: adiosgood is: buenospam is: spammore is: mas

D.spam is: spamgood is: buenogoodbye is: adioshello is: hola

Page 5: DICTIONARIES (CONT.)

def translate():d = {"hello":"hola", "goodbye":"adios", "good":"bueno", "spam":"spam"}for word in d:

print(word, "is: ", d[word])d["more"] = "mas"

translate()good is: buenohello is: holagoodbye is: adiosspam is: spam

Theorderisweird!

Page 6: DICTIONARIES (CONT.)

TryThis…

>>> score(“spam”, scrabble_dict)8

def score(myString, dict):

Youcanusewhileorforloopshere…

scrabble_dict = {"a":1, "b":3, "c":3, "d":2, …}

Page 7: DICTIONARIES (CONT.)

TryThis…

scrabble_dict = {"a":1, "b":3, "c":3, "d":2, …}

def score(my_string, dict):total = 0for letter in my_string:

total += scrabble_dict[letter]return total

Page 8: DICTIONARIES (CONT.)

Usefulmethod(fromZybook)

• d.get(key)isalternatesyntaxford[key]– Okay,fine,butwhere'stheadvantage?

• d[key-not-in-d]à KeyError• d.get(key,default)à d[key]ifkeyand defaultotherwise

– E.g.,d.get(key,"N/A")

Page 9: DICTIONARIES (CONT.)

Dictionary,ohhowdoIlovethee?

• ListsinPythonarewonderful,andamazing• Theonethingthatmightbebetterisdictionaries• All-purposeforkey-valuelinkages

– Ifyou'reGoogleandwanttoremembereverypagethathasthephrase"TreeofLife"onit?

• Dictionarywithstringkeys,andlistofstrings(URLS)values

– Doinganysortoftranslation,rangingfromEnglishtoSpanishtomRNAtoAminoacids?

– Etc.?

Page 10: DICTIONARIES (CONT.)

TREES

Page 11: DICTIONARIES (CONT.)

• AlllifeonEarthevolvedfromacommonancestor.

• Biologistsmaphoworganismsarerelatedbyconstructingphylogenetictrees.

Page 12: DICTIONARIES (CONT.)
Page 13: DICTIONARIES (CONT.)

Figure12.2

Page 14: DICTIONARIES (CONT.)

• Recentgeneticanalysisandotheradvancementshavefoundthatsomeearliertaxonomicclassificationsdonotreflectactualevolutionaryrelationships,andtherefore,changesandupdatesmustbemadeasnewdiscoveriestakeplace.

• Onedramaticandrecentexamplewasthebreakingapartofprokaryoticspecies,whichuntilthe1970swereallclassifiedasbacteria.

• TheirdivisionintoArchaea andBacteriacameaboutaftertherecognitionthattheirlargegeneticdifferenceswarrantedtheirseparationintotwoofthreefundamentalbranchesoflife.

Page 15: DICTIONARIES (CONT.)
Page 16: DICTIONARIES (CONT.)
Page 17: DICTIONARIES (CONT.)
Page 18: DICTIONARIES (CONT.)
Page 19: DICTIONARIES (CONT.)

=Whatreallymatters?

Treescanbedrawnindifferentways

Morerecentcommonancestor

Page 20: DICTIONARIES (CONT.)

Figure12.4

Aphylogenetictreeisrootedandshowshowdifferentorganisms,inthiscasethespeciesandsubspeciesoflivingapes,evolvedfromacommonancestor.

Branchpoint

Sistertaxa

Page 21: DICTIONARIES (CONT.)

Figure12.5

• Thisphylogenetictreeisrootedbyanorganismthatlackedavertebralcolumn.Ateachbranchpoint,organismswithdifferentcharactersareplacedindifferentgroups.

Page 22: DICTIONARIES (CONT.)

Figure12.6

Organismsthatsharesimilarphysicalfeaturesandgeneticsequencestendtobemorecloselyrelatedthanthosethatdonot.Featuresthatoverlapbothmorphologicallyandgeneticallyarereferredtoashomologousstructures;thesimilaritiesstemfromcommonevolutionarypaths.

Page 23: DICTIONARIES (CONT.)

Figure12.7

Someorganismsmaybeverycloselyrelated,eventhoughaminorgeneticchangecausedamajormorphologicaldifferencetomakethemlookquitedifferent.

Page 24: DICTIONARIES (CONT.)

Figure12.8

Unrelatedorganismsmaybedistantlyrelatedyetappearverymuchalike,usuallybecausecommonadaptationstosimilarenvironmentalconditionsevolvedinboth.

Page 25: DICTIONARIES (CONT.)

timeà

PhylogenyofSpecies:Atree-likerepresentationofevolutionaryrelationshipsamongspecies)

Commonlyusedinbasicevolutionaryresearch,conservation,andmedicine.

Page 26: DICTIONARIES (CONT.)

timeà

Page 27: DICTIONARIES (CONT.)

timeà

Page 28: DICTIONARIES (CONT.)

timeà

Page 29: DICTIONARIES (CONT.)

timeà

Page 30: DICTIONARIES (CONT.)

timeà

Isthefrogmorecloselyrelatedtothefishorthehuman?

a. Fishb. Humanc. Equallyrelatedtobothd. Thereisnotenoughinformationtodecide

Page 31: DICTIONARIES (CONT.)

timeà

Isthefrogmorecloselyrelatedtothefishorthehuman?

a. Fishb. Humanc. Equallyrelatedtobothd. Thereisnotenoughinformationtodecide

Page 32: DICTIONARIES (CONT.)

timeà

Page 33: DICTIONARIES (CONT.)
Page 34: DICTIONARIES (CONT.)
Page 35: DICTIONARIES (CONT.)
Page 36: DICTIONARIES (CONT.)

Which taxon on the tree below is most closely related to taxon D?

a. Ab. Bc. Cd. All of the above are

equally closelyrelated to D

Page 37: DICTIONARIES (CONT.)

Which taxon on the tree below is most closely related to taxon C?

a. Ab. Bc. Dd. B and D are

equally closely related to C

e. All of the above areequally closelyrelated to C

Page 38: DICTIONARIES (CONT.)

Which taxon on the tree below is most closely related to taxon A?

a. Bb. Cc. Dd. All of the above are

equally closely related to A

Page 39: DICTIONARIES (CONT.)
Page 40: DICTIONARIES (CONT.)

MostStudiedGeneSequences

• Rubisco (fromchloroplast,rbcL)• Ribosomesubunits(fromnucleus,18S&26S)• ATPsynthase(fromchloroplast,atpB)

Page 41: DICTIONARIES (CONT.)

Manyofthealgorithmsdevelopedforphylogenetics havebeenusedtodevelopsoftwareinotherfields.

Page 42: DICTIONARIES (CONT.)
Page 43: DICTIONARIES (CONT.)

MolecularsystematicsTheuseofDNAandRNAsequencestoinferevolutionaryrelationships

• Manymoremolecularcharactersavailableforanalysisthanmorphologicalones.

• Identityiseasiertodefine:ATCGvs.whetheraflowercolorispinkorwhite.

Page 44: DICTIONARIES (CONT.)
Page 45: DICTIONARIES (CONT.)

Forexample,twoplantsmayhavea“C”ataparticularlocationonagene

• Onepossibilityisthattheyhaveevolvedtogetherandarecloselyrelated

• Anotherpossibilityisthatonestartedatwiththe“C”atthatlocationanditdidn’tchange,whiletheotherplantwent“C->G->A->T->C”andlookslikeit’sthesameevolutionbecauseallyouseeisthestartandfinish“C”

Page 46: DICTIONARIES (CONT.)

ModernPhylogenetics

• DNAsequencedataarenowoverwhelminglythetoolofchoiceforgeneratingphylogenetichypotheses.

• Muchofthisdataisontheweb.

• NationalCenterforBiotechnologyInformationhttp://www.ncbi.nlm.nih.gov/

Page 47: DICTIONARIES (CONT.)

Figure12.9

• Lizards,rabbits,andhumansalldescendfromacommonancestorinwhichtheamnioticeggevolved.Thus,lizards,rabbits,andhumansallbelongtotheclade Amniota.Vertebrataisalargercladethatalsoincludesfishandlamprey.

Page 48: DICTIONARIES (CONT.)
Page 49: DICTIONARIES (CONT.)

Elephants (Loxodonta sp.)

Page 50: DICTIONARIES (CONT.)
Page 51: DICTIONARIES (CONT.)

MacGillivray’s warbler(Oporornis tolmieli)

Page 52: DICTIONARIES (CONT.)

Influenza A

Page 53: DICTIONARIES (CONT.)
Page 54: DICTIONARIES (CONT.)

Approximatemolecularclock:thenumberofDNAsubstitutionsinconstantovertime.

Page 55: DICTIONARIES (CONT.)

RelevancetoCS?Choosingtherightrelationships:

• Constructingaphylogenetictree,orcladogram,fromthecharacterdataisamonumentaltaskthatisusuallyleftuptoacomputer.

• Thecomputerdrawsatreesuchthatallofthecladessharethesamelistofderivedcharacters

Page 56: DICTIONARIES (CONT.)

http://evolution.genetics.washington.edu/phylip/newicktree.html

TheNewick Standardforrepresentingtreesincomputer-readableformmakesuseofthecorrespondencebetweentreesandnestedparentheses,noticedin1857bythefamousEnglishmathematicianArthurCayley.Ifwehavethisrootedtree:

theninthetreefileisrepresentedby:(B,(A,C,E),D)

Page 57: DICTIONARIES (CONT.)

((raccoon:19.19959,bear:6.80041):0.84600,((sea_lion:11.99700,seal:12.00300):7.52973,((monkey:100.85930,cat:47.14069):20.59201,weasel:18.87953):2.09460):3.87382,dog:25.46154)

Page 58: DICTIONARIES (CONT.)
Page 59: DICTIONARIES (CONT.)

"HomosapiensisamemberofthegroupHomo,whichisamemberofthegroupHomininae”

Childtoparent

"Primatescontainstwogroups:Haplorrhini andStrepsirrhini”

Parenttochild

Page 60: DICTIONARIES (CONT.)

"HomosapiensisamemberofthegroupHomo,whichisamemberofthegroupHomininae”

Childtoparent

tax_dict = {'Homo sapiens' : 'Homo','Homo' : 'Homininae'

}

Page 61: DICTIONARIES (CONT.)

def get_ancestors(taxon):first_parent = tax_dict.get(taxon)second_parent = tax_dict.get(first_parent)third_parent = tax_dict.get(second_parent)return[first_parent, second_parent, third_parent]

Page 62: DICTIONARIES (CONT.)

def get_ancestors(taxon):result = [taxon]while taxon != 'Primates':

result.append(tax_dict.get(taxon))taxon = tax_dict.get(taxon)

return result

Noticehoweachtimeroundtheloopwesetthevalueofthetaxonvariabletobethenameoftheparenttaxon,whichthenbecomesthechildinthenextiterationofthewhileloop.

Page 63: DICTIONARIES (CONT.)

"Primatescontainstwogroups:Haplorrhini andStrepsirrhini”

Parenttochild

tax_dict = {'Strepsirrhini' : 'Lorisidae','Strepsirrhini' : 'Lemuriformes','Strepsirrhini' : 'Lorisiformes'

}

Whyisthisnogood?

Page 64: DICTIONARIES (CONT.)

"Primatescontainstwogroups:Haplorrhini andStrepsirrhini”

Parenttochild

new_tax_dict = { 'Primates': ['Haplorrhini', 'Strepsirrhini'],

}