All right welcome everyone so today we're going to be talking about epigenomics and using that as a way to introduce also hidden Markov models which is one type of sequential learning uh model that we kind of alluded to uh last time so what uh what is EP genomics EP genomics basically fits within this first module basically first we talked about uh expression analysis basically How do we understand gene expression patterns and this is fundamental uh in many many places then we talked about and we used that to introduce clustering classification G mixture models Etc then
we talked about some of the specifics of single cell analysis and how do we understand single cell data a much more sort of U foundational way the problem set is very much addressing both epigenomics And single cell and expression analysis Etc who has already started working on the problem set please raise your hands okay awesome so please show up at recitation tomorrow first take a look at it and two go to R station tomorrow tomorrow in R station we're going to spend a whole hour going through P said one okay so this should this is
again there to help you learn it's there to teach it's not there to make it hard for you so basically there's a lot of Numbers of steps that we want you to go through for p one some of these steps are complicated so we're going to be walking through them together two questions okay a student oh gosh um yeah well uh okay so uh you know I know the answer but the the the question is how does the tenar professor get kicked out of MIT uh and the questions station on on a Holiday so so
we're going to basically do office hours instead and we're probably going to just record it so that people can't make those office hours are able to do so two options for office hours one we could do it later today so that you guys have the recording over the weekend and another the possibility that we can do it on Monday are you guys free my my my little girl had her Birthday so everybody like are you one are you two are you three who's free at three free who's free at four who's free at five are
you six okay so so who's free at 4 today who's free at five today it can be over Zoom you don't have to come over who's free at 6 today who's free at 7 today who's free at 8 today who free at nine today who free at midnight tomorrow I'm kidding um so it doesn't seem like a lot of people are free today uh when would you guys Like to do it do you want to do it on Monday Monday's good oh yeah I see a lot of nodding for Monday good who's free at three
on Monday good awesome who's free at four on Monday nice who's free at five on Monday six on Monday that's amazing all right so we're probably going to do it at three on Monday or four on Monday who's free at four but not at three who's free at three but not at four type type call three versus two all Right so we're gonna send a doodle poll and uh it's either gonna be a or at 4 or at 5: on Monday sounds good so try to work on it over the weekend take a look ask
chbt they're your friend don't ask for the answer ask for you to understand the code basically go through stuff basically our goal is for you to learn and to sort of you know Empower you to do all that stuff okay great so that's for the P set and uh next week we're so so basically uh Yeah next week we're going to be talking about Regulatory genomics and Regulatory networks but today diving into epigenomics so what is epigenomics epigenomics is the ability to sort of have a diversity of cell types from the same underlying genome so
first we're going to look at what is epigenomics overview what are chromatin modifications we're going to talk about the Technologies on the experimental side then we're going to talk about the Primary data processing basically when you get the signal out what do you do we're going to introduce this super cool bers B wheer transform approach that was introduced by bowai for very rapid um GRE mapping yesterday I had a wonderful time hanging out with uh Lang me the original author of The Bai algorithm who was basically visiting MIT so we're going to talk about read
mapping and and PE calling then we're going to turn to not just primary data processing of one Epigenomic mark but how do we combine multiple epigenomic marks together to characterize chromatin States and this is uh going to start with foundations of he Mark of models who has seen he Mark of models before who has never seen he Market models before okay good and we're going to see how that applies to a multivi mark model then we're going to talk a lot about model complexity how do you decide just how many parameters how many states do
your model have and then How to learn chromatin States jointly not just across multiple marks but also multiple marks in multiple cell types everybody with me here awesome let's right in so epigenomics epigenomics basically what allows you to go from a single genome to the extraordinary diversity of cell types we have in our body basically if you look at the brain there's you know an extraordinary diversity within even the neuroc cortex but if you look at subcortical regions The number and the diversity of neuronal and both excitatory inhibitory neuron subtypes is just enormous if you
look at our immune system uh our blood cells are you know of course there's red blood cells but then there's like these uh you know huge diversity of white blood cells and um all of the functions that they play in the immune system if you look at just any little snippet of your skin just within it there's you know hair Follicles there's inovations there's sensory organs there's you know epithelial cells there's uh you know veins and blood irrigation Etc this is all coming from the same underlying genome all of these cells have exact same code
so what you know what allows them to have such extraordinary diversity in their phenotypes the fact that instead of just having one code you basically have different subsets that are utilized by Each cell type and the way that this is enabled is through epigenomics so very briefly your DNA is packaged up extremely compactly within every one of your cells if you take the DNA from one of your cells it is 2 m long end to end it's extraordinary 2 m worth of DNA in every one of your cells and you have like a trillion cells
so if you put now a trillion times 2 meters you don't just get to the moon you get to Jupiter I Think about 10 times okay so so this amount of DNA compacted within your body is and within every one of your cells is uh relying on structural mechanisms of epigenomics whereby the DNA is looped around these nucleosomes so nucleosomes are about 250 nucleotides worth of DNA and or let's say 200 it's about 144 for two Loops of the DNA around the nucleome and another 50 nucleotide Linker so basically 200 base per chunks Are labeled
in different way so that that because every nucleosome can have decorations of these proteins that it's made out of that we call hone proteins and these hstone proteins have markings that tell the cell whether this is an active region that it should be actively opening whether that's a repressed region whether that's a Poise region whether that's a transcribed region if it's promoter and enhancer and so on so forth is everybody with me here I saw and go up okay so basically there's eight hastone proteins in every one of your nucleosomes and these nucleosomes capture about
200 bases of DNA so that that plays a structural role in compacting this uh you know massive 2 meters worth of DNA into a tiny chromosome or at least 23 pairs of those and it also plays a functional role in basically remembering which regions are important for every cell type so at Every cell division during your development there are factors that establish the epigenomic memory of every one of your cells to be able to remember its state as you know you you go on through your life so that your neurons don't wake up tomorrow thinking
that they are I don't know uh immune cells everybody with me here awesome so basically DNA is very long cells very small huge compression to use the DNA you have to Actually open up this structure and that's why you have to remember which structures you're going to be needing in every one of the cell types and then DNA accessibility the state of the chromatin and there's a huge role of DNA interactions across different segments everybody with me here awesome so now we talked about the fact that DNA that the DNA packaging is both structural and
functional there's three ways to encode this functional part so First of all the structural compaction has a functional implication that the more compact it is the harder it is to open so these regions in your neurons that are super highly compacted are probably not helpful in neurons they're helpful in heart or in liver or in lung or you name everybody here yeah so one of them is just the compaction the second one is accessibility basically compaction is one thing of the entire fiber and the Second one is locally where are the nucleosomes positioned can they
sort of roll back and forth to even in a Loosely compacted region of the DNA of the chromosome be able to locally open it up for Regulators to bind that piece of DNA is there everybody me here good so basically one of them is just DNA accessibility another one is DNA methylation so on the DNA sequence itself we have a c GT but you can put a methyl group on top Of a c so it becomes a methyl C now a regulator a transcription Factor when it binds DNA it doesn't just open it up to
read it what it does is that it binds from the side and if there's a methyl group there and you're you're feeling the T Bas or the a Bas or the G Bas or the C Bas when you're feeling and you're looking for a c if there's a methyl group you might not recognize it everybody with me here so therefore by Modifying the c a regulator might no longer be able to buy and conversely by modifying the c a regulator that was previously unable to bind might now be able to bind only the methylated version
of C is there here so then that means that I can actually change the code of the DNA I can change the rec recognition the way that Regulators are reading DNA by adding a methyl group directly there everybody With me here so that's one type of modification one type of modification is dilation the second one is compactness and accessibility and then the third one is based on directly these histone proteins that I mentioned earlier where every nucleosome is made out of eight hone proteins the most common version is h2a two copies h2b two copies H3
two copies H4 two copies okay so basically every nucleome has H2 a h2b H3 H4 H into copies and you can have now modified Nucleosomes themselves for example instead of h2a you might have a variant h2a Z or you name it you can have modified H3 modified H4 but you can also have post translational modification on the tals of the hone proteins themselves so basically the hone proteins are providing a way for DNA to attach but they're also hanging out with loose tails that Can be recognized by specific Regulators that are then attracted to whatever
signal you put into that tail and that signal can basically say oh well this is a region that you you should use as an enhancer this is a region you should as a promoter this is a transcribe region this is a repress region Etc is everybody with me here so there's methylation that changes whether a TF can bind or not a transcri factor can bind or not there's Co compactness that Basically tells you if that region at all is accessible and if within the accessible region I can actually buy those nucleotides and then there's histo
modifications which are modifying the tails of these proteins with read signals and there's other right factors that will then come in and change these modifications that will then guide how that region is interpreted everybody with me here now some of these Modifications don't change the properties of the histone itself so you can add a methyl group two methyl group three methyl group it still has the same properties like biophysical properties but if you add acation that actually loosens up the DNA by itself so some of these modifications are not just having um informational impact some
of them are actually having a physical a biophysical impact by actually changing The compactness the accessibility the looseness the you know breathing of the chromatin we F that they've learned something yes awesome great 54321 good who's with me 5 4 3 through one okay awesome beautiful any questions yeah please sorry there was there was a an opening of a bottle exactly as you were asking something is generated lab generated so oxidation and carbonation are PMS that are oh yeah Yeah so so basically I spoke about DNA mutilation and DNA acation that are the most common
now there's tination there's uh sumolation there's all kinds of additional ones including some man-made ones so basically you can use that to mark up regions but then you need to maintain them because every time the DNA is replicated those are going to be lost so you need to have Regulators that establish them and read them and rewrite them and so on so forth so again part of The purpose or part of the the point of the double helix is that it's semiconservative replication so basically that means that I'm I'm copying it and I now have
each copy can basically serve as the template for the other one but now the trick is yes it can serve as a template for the DNA sequence but what about the epigenomics I need to have the right Regulators that will basically read one copy and then reestablish that copy and now as you Start thinking about sort of these hystone marks that are on top of the DNA when you undergo replication sometimes they just fall off other times they fall off one way and then they're reattached right behind the replication for same thing with RNA transcription
to transcribe you need to open up the strands something's going to happen to these keystones so basically there are some marks that are transcription Associated there some marks that are Co-transcriptional along with the transcription Machinery these are carried along and then you know they're modified and so on so forth so you got to think about both the informational view of the genome but also the biophysic view of the gene other questions yeah yeah last yeah so we see of yeah yeah yeah so many people think about a Genetics and I try to keep saying epigenomics
now genetics has a mutation of inheritance and therefore epigenetics is very often associated with inheritance and basically people say oh this is not a mutation it's an epim mutation so basically when an organism for example under go some kind of exposure to extreme cold or to radiation or to all kinds of things maybe the DNA will change but sometimes the epigenome will change and now the question is are These epigenomic modifications epigenetically inherited and and then the the the answer there is nearly all of the time no in other words humans go out of their
way to wipe out the epigenomic state from one generation to the next when the sperm is formed and when the egg is formed whatever modifications we had basically are very sperm-like and very egg-like now I get anomic modification my brain how's that going To be reflected in my sperm not clear now when the zygote forms there's a wiping out of theum information to basically restart clean with a bunch of sequence primary sequence signals that are sitting in the DNA itself and of course the egg itself has all kinds of proteins that are establishing that signal
so this is part of the reason for the and and and then the zygote itself you know re wipes like Several times in in in sort of it during its development so if I have anomic modification because I saw I don't know a violent movie yesterday you know I have to somehow pass it into my sperm that sperm has to make it into the egg with that memory somehow that traveled from the brain cell to the sperm cell it has to make it through the egg and and on the zygote it has to Now sort
of carry out the Modification and then after I have fully developed you know my my my child has fully developed that kid has now to must have some kind of epigenomic modification in their brain and obviously in all of their organs so it's complicated it's difficult now I've just hopefully convinced you it's imp possible but let let me now tell you how it might be possible it might be possible that small rnas that are associated with EPO are Basically traveling throughout the body making into the germ line making into the Next Generation making it through
the you know mure of the Exel and somehow as the um you know embryo starts developing you can basically now have these small rnas continue to sort of carry out genomic modifications it's possible but very very difficult any other questions yeah so the Compactness is established as a memory by Regulators in the previous cell type that you were at so basically the zygote forms you have one cell type because you have one cell then there's the first cell division one of these cells is going to become more anterior the other one will become more posterior
the anterior cell in some species gets marked randomly in other species based on the Direction in which it sits inside the mum or inside the egg or inside you know the whatever environment this is replicating so other species establish gradients of expression for different Regulators you basically have an anter posterior gradient then you have two additional gradients one of them going down one of them you know going one down one way one another way and there are some response elements that require two-third of one and one third of the Other to respond and others you
know I don't know three fifths and two fifths and and so so forth and that basically can now establish the expression of additional regulatory signals that are you know specifically in one band of that uh gradients you know you one stripe the way that they call them in the dropa element for example or in C Elegance every replication is programmed you know exactly the identity of that cell is Like 13A it's going to replicate into 27b and 27d and you know that one is going to replicate exactly this way Etc so there's many many different
ways in which Evolution has kind of established this asymmetry breaking the Symmetry breaking if you wish to sort of establish all of the different cell types in my view it is miraculous and and extraordinarily beautiful how this happens I mean I challenge any engineer to basically Create a robot that's sort of self-replicating and sort of then deciding all on the fly with three billion letters of code how to you know form itself and and sort of this extraordinary Innovation I showed you for one millimeter of skin you know I you know I think this is
you know this probably took billions of years of evolution that's why it took so long to go from M from unicellular organisms to multicellular because you have to Establish these rules of you know self reprogramming and differentiation any other questions who found the questions really enlightening right I mean ask what you're wondering about because again I can give you the lecture I can give you sort of answers to the stuff that you're burning to know any other burning questions okay great p43 to1 who's with me so far yay awesome great so that last one I
Mentioned is kind of cool basically this one is about compactness this one is about you know changing the F that bind you this one can have both a biophysical role and a read right role and this one is by far the most complex the most versatile you can have in these hstone tails that I mentioned before amino acids that are modified with different types of modifications so you can basically you know we're going to be talking a lot about H3 K4 tration what The heck does that mean H3 means that from all of the proteins
so there's h2a h2b H3 H4 from all of the proteins it's hstone H3 everybody here then which residue so it's lysen which is K at position 4 1 2 3 4 or lysen at position 36 1 2 3 4 all the way to 36 everybody with me here and then what do you add to it you can have methylation you can have phosphorilation you can have tination you can have similation you name it and you can have one methyl group or you Can have you know H3 and one of the hes becomes another ch3 and
another C3 Etc okay so you can have methyl methyl methyl also known as trimethyl so when I talk about H3 you're going to be like oh hon H3 no problem K4 oh Li in four no problem me3 oh yeah three methyl no problem everybody with me here awesome so now each of these will now be associated with particular functions but they're not going to be acting alone h3k4 M3 coupled with some Of modifications means one thing but couple with a different one means a different thing okay so in addition to that as I mentioned you
have DNA modifications you can have methyl C in CBG you have nucle positioning DNA accessibility Etc and you can think of all of that as a constant struggle a constant fight for territory on one hand The Regulators are trying to bind DNA and they're sort of pushing nucleosomes apart to bind there some of these Regulators are stronger than others we call them Pioneer faction factors they're able to sort of bind DNA and displace nucleosomes others are obeying whatever the nucleome say basically say oh you know you're not binding here it's like no problem I'm not
binding there everybody here so there's hone you know proteins there's nucleosomes which are made out of his proteins there's General factors there's chromatin regulators and So on so forth okay and all of these are basically competing for access to the DNA okay so there's a biophysical component and then there's a read write component where specific proteins will come and recognize these modifications and then do stuff like loosening up the chromatin like tightening it up like bringing you know a bunch of of their friends and sort of establishing a landing side for RNA polymer to start
you know to bind and start transcribing And so on so forth everybody with me here awesome good and as I mentioned they don't act alone so for example in enhancers you have DNA accessibility but you also have h3k27 acation that basically means an acation group in the 27th license of hon H3 or h4k h3k4 me1 promoters h3k4 me3 and more k9 instilation for transcribe regions three marks k36 k79 K2 H4 K20 me1 and these are actually found at different places Along the gene body at the beginning at in the middle and the end of transcription
basically have slightly different abundance of those and then there's three types of repression there's h3k27 tryl which is polycom facultative repression so basically in a given cell type this is sort of shutting down or opening up things h3k9 trialation this is a very stable heterochromatin repression this is like the super super compact stuff that Mentioned earlier where when you're there you basically are not getting out and then there's DNA mation which is very orthogonal and it's usually a mark of repression in regulatory regions in transcribed regions interestingly more methylation associated with more expression which might
simply mean do not bind here to reinitiate so it might actually still be a repressive Mark but a consequence of transcription and Please don't reinitiate here here okay everybody with me here good yeah untranslated regions are basically when you transcribe an mRNA you have the start of transcription and then you have the start of translation which is the atg between transcription start and the atg that's a utr it's the five Prime R and now between the T TGA TAA translation stop codon and the end of transcription That's another utr it's the three prime utr so
after you basically make your transcript you add the cap as a way to stabilize it and after you're done transcribing you add the poly tail to also stabilize sure other questions all right awesome so again hundreds of nor modifications many Still Still emerging we need a systematic mapping with chromatin imuno precipitation bisulfite sequencing and DNA's Accessibility so now let's talk about these Technologies so basically um bisulfite sequencing basically means that you treat the DNA with bisulfite and that will differentially alter C's that do not have a methyl group and C's that have a methyl group
and then you sequence the result twice and based on whether you see a c or whatever letter A methyl C looks like then you're going to know oh this is methylated or not everybody with me here So that's bfight sequencing then DNA's sequencing basically means I'm going to randomly chop up the DNA and find the segments that were just not bound by anything or that were where so so basically how am I going to randomly chop out by adding DN it's an enzyme that digests DNA but does so preferentially in open chromatin regions and accessible
regions the regions that are not marked by hist modifications everybody with me Here it's kind of interesting because dnas will have a very funny shape on the DNA itself so DNA will basically cut in accessible regions but for a region to be accessible you need to have a regulator that makes it accessible that pushes off nucleosomes so you'll basically see an accessible region but right in the middle of it there's an inaccessible region that's exactly where the regulator is binding everybody with me Here so that's basically DNA's sequencing and then chromatin precipitation we're going to
talk a little bit more but it's basically finding an antibody that will recognize these pull them down and then you're sequencing the chunks of DNA that came with whatever your antibody bound and these chunks are basically the places where you have each of these modifications okay so that's chromatin imuno precipitation imuno means you're Using an antibody to pull down pration means pull down and then chromatin chroma okay all right so there's a lot of efforts for example theonomic road map the encode project and others that are basically mapping many many different tissues in the body
and his modifications open chromatin DNA methylation and gene expression okay why because there isn't just one human EP genome yeah there's like one human genome that each of us Has and you know with some exceptions of course but there's many many many EP genomes that each of us carries my brain epigenome might be different than my lung epigenome and also within my brain my neuronal epigenome might be different than my you know inhibitory urine or olend side epome Etc everybody with me here so every cell type and every tissue and frankly every stage of development
sometimes every person males versus females will have different marks And you know we basically need to figure them out all out okay all right so to do that there's basically many different projects and code R genomics blueprint Mouse and code mod code Etc and you know they're mapping many modifications many cell types many individuals many species many conditions many bodies across whole genome etc etc ET okay as I mentioned earlier the way that we do chromatin imuno precipitation is By building an antibody that will basically recognize a hstone modification so you basically are feeding you
know some unsuspecting bunnies a bunch of h3k4 M3 and then you know their immune system is like oh gosh what's that thing I'm going to build a bunch of antibodies against it you just collect the antibodies and now you are able to pull it down everybody with me here same thing with uh transcription Factor you can kind of bind instead of The modification you can bind a regulator and you can find all of the regions where the regulator is bound so you basically uh do this experiment you pull down so you first chop up the
DNA then you pull down all of the regions that were Bound by either you know this antibody here or that antibody there that recognize this modification or The Binding of this regulator and then you get rid of the nucleosomes and you sequence whatever Segment of the DNA came along sounds good doesn't matter how you sequence them but then you map them to the DNA you map them to the genome sequence and then you're like oh well in this region here I pull down h3k4 M1 you know much more here than here so that tells you
that this region of the genome had that modification everybody with me here and same for this line here H3 K4 M3 h3k4 me1 H3 k36 tration so h3k4 me1 is a mark Of enhancers so you basically see that there's this enhancers here saying oh there's some active region then there's a promoter and then there's a transcribe region it's kind of cool you can just read it off that's basically the general accessibility of the establishment of these control regions then you have the promoter itself that's exactly where transcription starts and then you have transcribe regions which
are along the body of the Gene and guess what the gene Model is right there there's the start codom there's the transcription start there's the translation start there's the translation end these are the utrs the untranslated regions on both sides and then you have a transcription stop and you can basically see that the exact place where transcription starts has basically this h3k4 M3 signal and guess what there's a dip here why is it absent it's absent because that's exactly where transcription starts so you basically Need to bind that place and guess what there's not going
to be any hones there there's not going to be any nucleosomes so you can't have a histone modification if you don't have histon in the first place everybody with me here cool so again always think about the informational and the biophysical side by side okay so this is for three marks you can do this for dozens of marks you can basically have DNA accessibility you can Have you know various promoter Associated marks various enhancer Associated marks active enhancers repressed polycom repressed regions k27 trimethyl heterochromatin dnation and you know we're going to talk at some point
about highy which is chromatin confirmation capture it basically tells you about long range interactions and in addition to all of the marks you have now transcribed regions that you can see have Transcription Associated marks but also RNA sequencing and then you have the actual Gene models at the top so the question is how do we make sense of all of that how do we summarize these multiple marks into chromatin States how do you learn the combination of all of these things to effectively understand the language of the epome everybody with me here awesome good so
ultimately what we want to know is what Are enhancers promoters transcribed Reg repressed regions promoters are basically the regulatory regions that surround the transcription start site transcribed regions repressed regions you understand enhancers are slightly different than promoters enhancers or promoters are basically the names that we give the control regions that are right at the start side or a little further away and they have different properties promoters Are typically marked whether or not the gene is actually transcribed they're kind of ready for business enhancers are extremely cell type specific and tsue specific so the enhancer will
be on in you know very specific conditions whereas the promoter is like hey you know just come to me when you're ready everybody with me here now every Gene will typically have one or maybe two or three promoters that's sort of the Places where you start transcription but a gene will typically have 20 or 50 enhancers so basically there's many many different places where this Gene will be used so you're going to have an enhancer for your left toe and enhancer for Your Right toe and enhancer for your you know left ear and so so
forth everybody with me here I mean yes I'm making this up like we we're actually bilateral animals so usually your left toe and your right Toe will be the same okay cool learning stuff all right want to see some like math algorithms good let's dive in so now what's the problem we have we now have a gazillion reads that we just got how am I going to map these reads to the genome I just sequence 100,000 reads from each of 1,000 experiments I have 100 million reads to map to the genome how are you going
to do it raise your Hands you guys know so on tues yeah alignment great what are different ways I can do alignment so dynamic programming right alignment could be an exponential problem and we turned it into quadratic we were so proud of ourselves then quadratic was a little too slow because I I now have 100 million reads that would want to map and I have now three billion bases for each of those reads they's say Tre is 30 Nucleotides I have 30 times a billion times 100 million that's a lot of bases that's a lot
of mapping that's a lot of alignment so what could we do instead what was the end of the lecture yeah CER hashing good so instead of basically saying oh I'm just going to construct the dynamic programming Matrix I'm not looking for evolutionary changes here I don't care to find a very nice beautiful path with a bunch of mutations no if it doesn't match it doesn't match so I'm Going to basically super rapidly hash all of the cers and then just map them to a hashed version of The genome everybody with me here good this is
very powerful but but if I want to Hash every I don't know 10mer and I want to compare it to the three billion letters of the genome I'm going to have a very big table with you know three billion bases times all of the hashes everybody with me here so basically that's actually quite Expensive you basically have that long list so what we're going to see today is a crazy super awesome algorithm that Ben langid actually developed who was here visiting me yesterday and I told him hey tomorrow I'm teaching about bowai um to basically
map reads super super fast on the genome and you might just blow your mind a little bit but we kind of like that are you excited about a little bit of mind-blowing yes all right let's blow a little bit of Minds So how do we map millions of short reads to the genome we're going to look at traditional hashing schemes and then the burs wheer transform that was implemented into the bow tie uh which of as bwt all right quick exercise to the reader just map ca g TC Etc here who finds it first raise
your hand good um so as you all saw it was here sorry you're laughing because it was so simple so um yeah last time we're like oh how many matches do you have now I'm like okay just find it it's there just find it really fast so how do you find it really fast well you could basically uh allow mismatches you want to allow mismatch you want to allow sequencing errors and you want to be super memory efficient so you want that entire operation to be executed super super fast without sort of constantly trying to
swap in and out the genome from memory okay so you can basically do sequence alignment you can do hashing You can find other Advanced algorithms for example linear time string matching or sopix trees and sopix arrays the challenges that the memory recir me is typically quadratic for those and the BS Willer transform is actually order m it's super super memory efficient super super fast and it has been the new norm since uh Ben lmid basically developed Bai okay you can basically he see bur Willer transform I asked how many citations he has I think he
said Something like 90,000 citations for this like you know bionformatics paper what is it like it was published in genome biology the impact factor of that journal has probably gone up four times like by four four or five points just from this one paper just because it's it's insane so he was basically saying oh we have this you know cute new indexing scheme that we found from you know bz2 and we just applied it to genomes and it basically makes it in Practice 35 times faster than the previous algorithm and 300 times faster than another
algorithm now if you want to spend 300 hours or one hour aligning all your read which one you're going to choose okay so that's exactly what it's about and right after this you basically have soap that became soap too and then you know uh this algorithm became you know the version two which always sort of incorporate both Ty so how does it work okay brace yourselves this is very Fun so you have a bunch of chromosomes and you can put them n to end and you can extract seeds and you know create this giant table
and you can basically take a short read and then hash it and then map each of these hashes and then look up where that table Falls it sounds super fast but it's very memory expensive okay instead what you can do and it sounds crazy but bear with me is you can take up your genome and just shop it up into little segments and sort All of these little segments based on an algorithm that I'm going to say that that I'm going to describe very shortly and I'm basically going to shuffle my genome in a way
that preserves The Ordering of specific bases I'm going to explain what that means in a second but what that allows me to do is now take a new short read and then start mapping first one letter then another letter then another letter Then another letter and progressively I'm searching for all of the t's all of the t's are just at the end of The genome because I've sorted it but then all of the80s are somewhere else in the genome in a smaller interval that I can kind of use to look for next and the a8s
are in a yet smaller interval so it's a form of beam searching where you're starting with a very large beam and then you're making smaller and smaller and smaller And smaller every time until you find a stretch of your shuffled up genome that contains all of your matches to basically any substring sounds a little crazy but again bear with me for a second so the first thing that we're going to do is basically figure out what the heck is this beers wheer transform so bers wheer transform was basically introduced in I think bip 2 as
a way to compact files if you have a file that Has a bunch of you know uh consecutive letters for example The genome has like you know a bunch of A's and a bunch of T's and a bunch of C's Etc you basically say oh well there's 30 A's in a row and 20 B's in a row Etc okay or 20 GS in a row so it basically started out as a transformation that allows you to then compress things really fast and and really tight okay what do that compression look like it basically takes any
word like banana and it looks at all Of the possible rotations of the word banana okay I'm going to put a start character and end character in every possible rotation everybody with me here now I'm going to sort all of these rotations so basically you know uh alpha numeric Al you know graphically so I'm going to take all of the A's put them first all of the B's ends you know start and so so far so good and now the B transform is going to be the last column of that String and the last column
of that string turns out to have some nice properties about the stretches of similar letters stretch of nucle text so far so good now you can basically now say uh okay what the heck did you do to my genome I want my banana back um and uh the answer is no problem no problem I'll get you your banana okay how am I going to get the banana back first I'm going to take the last column Which I know is the last column right how can I get the First Column if I have the last column
raise your hands I have one answer I have the last column I want to find the First Column what's special about the first column two answers what's special about the First Column three answers go ahead it's sorted so what can I do to the last column to find the First Column sorted okay I'm good so I get my something back and I get oh gosh I I have the sorted version back okay well that's a little better but now what's the trick the trick is that if I have the last column in the First Column
because they're all the rotations I basically get the first two columns because if I put the last column and the First Column together this is the second column basically and I sort it I have my second column is everybody with me here Because the last column and the First Column are basically consecutive if I have the last column I can get the First Column and if I have the first and the last column together I can basically put them together and I sort them and that gives me the second column and I can figure out
the third column how by appending the First Column and the second column to the last column and Resorting the whole thing everybody with me here so basically I do last for a second sort I get third last first second third sort I get fourth last first second third fourth sort I get fifth give me a 543 to1 who's following awesome good so when I'm done with the whole thing I can get back my full Matrix and therefore I can find simply the character that says start and then that's my full string okay everybody can Here
so basically I don't need to remember anything but the last column to be able to reconstruct the whole G okay so this was fun but it didn't get us anywhere yet so you know it still doesn't tell us how we're going to find something and I apologize I'm not as self-centered this side was actually made by Jason NS when I asked him to give a guest lecture so um he chose I don't know some random name with a bunch of repetitions and uh my parents would Be so proud um so so basically if I want
to find the string o l i s in this gibber stuff here okay how do I do it remember this beam searching approach I'm going to start with an S and and I'm going to have a beam for all of the S's and where are all the s's well in the First Column they're just at the end so far so good so all I need to remember is how many characters do I have of each type so that's one variable the count of how many characters occur before c Lexicographically in the gene okay that basically
simply tells me where the the string of s's will come so far so good so I have one pointer then if I add the I the I is not that far from the S it is just before it and because all of these are Cycles just before it is basically right there now not all the s's will be eyes so basically my beam is going to get smaller everybody with me Here so all I need is a variable I have the query substring of course then I have a variable that basically tells me how many
characters occur in C sorry before c lexicographically in the genome and then the most interesting variable is the occurrences of character C in the far right column starting at the current position SP now what's SP and EP it's the start pointer and the end pointer so as I'm Doing my beam search I have a start pointing and an end pointer and at every iteration I just keep updating the start and the end pointer so that I I keep switching from column to column basically From First to Last From First to Last From First to Last
every time I add one more character because as I add that one more character I've now gone from oh okay well I had is and now I have Lis and I have Lis and I add one more and I have o Lis Etc everybody with Me here so basically what I'm doing is every single time I have a start pointing and an endp pointer the start pointer is simply wherever I start start like the number of counts of before character C in my genome and then the end pointer is just simply that plus one okay
basically the next character plus one so if I have you know the s's start here and say the T start there then that's my starting my end card so that's all of the S's and then I progressively Keep making it smaller because I can use this pointer this you know table here that basically the number of occurrences of character C in the far right columns starting at that position okay and then building that can also be done very very fast okay and now I basically go from the s to the is from the is to
the L and then suddenly it it starts decreasing in length because only a subset of those characters will actually be in the next one line open okay So this is extremely fast because I only use one one string effectively the last column the First Column is implicit I don't need the First Column do I need the First Column no it's just the occurrences Matrix this occurrences M this C Matrix is basically the First Column just tells you well you have 300 a and then 400 G's and then you know 200 T's Etc is everybody with
me here so the First Column is basically sorted so I don't need it but you can think of it as Having it and that allows you to keep going from the last column to the First Column and then then the occurrences uh table basically tells you about that last column and then you're just updating your pointers and in the end you end up with all of the locations in your genome that have that exact substring why is that exciting because I can basically now do it a 100,00 times get all of the coordinates take the
three billion letter table map out how Many times did I end up at this position in this letter here which is unique position of the genome and the the reads are now piling up in that unique position and what do I do at the end I just reshuffle my genome to rebuild the original one while preserving the counts everybody with me here awesome so that's that's the key idea of the burs wheer transform and bow tie in sort of mapping these reads to the genome okay so it's very little memory usage basically same As the
input or actually less you don't represent the Matrix of the strings just pointers and in the encoding step you simply sort the pointers in the decoding you follow the pointers the original application was string comparisons of bzip 2 runs of letters were compressed into letter run length and in B formatics it's about similar run time at hash tables but dramatically faster in practice because of memory efficiency okay and it you can then map 100,000 Reads only transform once so you pre-process once you reverse transform once but then after you've mapped all of the counts you
have who thinks this is kind of cool yeah 543 to1 who's with me yes awesome I see some thre some four you guys are honest this is great yeah expand the acronym um so yeah so basically the way that it worked with Mismatches is you could artificially put in the mismatches and just search that string a bunch of times you could basically say I want to look for that string or one of here one of here one of here yeah I think that you know that would be sufficiently fast I'm sure you can do some
you know even faster than any other questions okay good so um we've now mapped all our reads to the genome and we want to start inferring now not just Where are all of the reads so basically what we what we've ended up with is something like this it's an intensity so what we've achieved is what we had promised namely I took 100,000 reads and I've now mapped them and I have these Heights Here everybody with me here the next step is what do I what do I do with that are these reads distributed in a
way that suggest that the experiment was successful are they matching across different marks in way that allow me to Infer more information about the genome so how are we going to do that we're going to basically run a bunch of quality control steps understanding that this will allow us to figure out which experiments were good which experiments were less good and so so forth okay you don't have to worry about all of those you know but but this is useful for your general education so basically first of all you need to know where are the
regions that Are bound by a regulat but the problem is that when I chop up the DNA to basically figure out where are the regions Bound by a regulator I will also get the regions that are just generally accessible so I might think naively that the regions that are generally accessible are also Bound by the regulator so what I need to do is the experiment twice once with the antibody to pull down the regulator but also once with just DNA by itself in other words DNA and all of its accessible regions is everybody with me
here and then the ratio between the two tells me which regions are truly Bound by the regulator so that's step number one step number two is you know as I'm sequencing sometimes the quality of the reads diminishes so you know I don't want to catch all of those section number three is what fraction of the short reads were actually fully mapped uniquely mapped or multiply mapped okay so you can you know Deal with that as well another one is about how the reads are actually matching if the reads are simply piling on top of each
other perfectly then this is likely to be an artifact because that's probably just one RNA molecule or one DNA molecule that will sequence over and over and over and over again because if you chop up the genome randomly you're going to get a bunch of different starting points so another one is basically what is the Non redundant fraction of binding of my library everybody with me here another one is the fact that every time I pull down a regulator or a hstone modification Mark I'm going to have some breaking up of the genome I'm going
to pull down all of the reads that were attached to that segment that I pulled down and I'm going to sequence the end point of those fragments because I only sequence from the beginning of a DNA fragment so now You have to think about the fact that I'm I'm capturing fragments of the genome and then I'm sequencing either from here or from there into that fragment is everybody with me here so if I if I pull down 500 Bas per fragments then I'm going to have reads that are pointing to the right anywhere within I
don't know 250 300 400 base pairs of what I pulled down suppose that the regulator was binding I don't know 50 or 100 nucleotides okay now or or you Know this history Mark is perhaps covering 144 nucle ties all of the reads the 200 Bas per segments that contain that Mark that was pulled down are going to start to the left of that and all the ones that I'm sequencing from that side are going to start to the right of that is everybody with me here so then I'm going to have some kind of characteristic
Left Right pointing read distribution if I read from the left it's going to look like the Waton strand If I read from the right it's going to look like the Crick strand so if I have a read on the Waton strand pointing to the right I'm going to have to assume that it's somewhere to the left of where it was bound and the ones from the right are going to be you know on the on the cck Str when be to the right is everybody with me here can I get a five for3 one how
how you're following this awesome bunch of fives some fours some threes okay So because there's a physical segment of the DNA that I'm capturing and that physical segment better be pulled down by my experiment that segment better be 500 base paars long am I going to get any reads starting here and pointing to the right no because that segment would not have been pulled down by my experiment so all of the ones that were pulled down are basically the ones that are starting to the left and all the ones from the right side are the
ones That are starting from the right okay so that basically allows me to do one more quality control step I can basically look at the distribution of forward and reverse pointing reads and scan them past each other and when they meet I should get a peak and when they don't meet again I should get a trout so I can basically look at the self correlation of the forward reads and the reverse reads at varying offsets and at those varying offsets they will be matching at Some point and that will basically tell me what was my
fragment length everybody with me here awesome so now that fragment length better be high enough compared to my read length and the read length simply says how much did I read and how much did I read and therefore if I have just random fragments I'm going to get a bunch of stuff at the read R length Okay and those reads are going to be amplifying each other and therefore you know that will be a sign of a bad Experiment so basically if I have a bunch of Peaks here it just simply means that I keep
resequencing the same reads if I have something beautiful there it basically means that you know this is a good experiment okay so that's the fragment length distribution all right so now I can reject the bad experiments start doing some you know Peak calling I want to know where are the regions that are bound okay so I have a continuous signal and I want to figure out Intervals where that signal was bound is everybody with me here awesome so that basically means that I need some kind of model for how are reads distributed if I have
a binding event on the genome and I can basically say okay you know up to 15 reads I might not say it's significant ific but at 150 reads I I'm going to start believing so there's many many different methods that have been developed to recognize that for example you know Max and pixie have different Properties based on whether they're window based whether they cluster the tags whether they subtract the background signal whether they calculate a false Discovery rate whether they have some kind of normalized control and so so forth okay but most of it is
going to be about what is the probability of having some count even some kind of local expectation and some kind of plusone distribution uh based on those okay and the challenge is going to be Okay at what threshold do I call a reasonable Peak and those thresholds are going to be based on um you know just the the sum number of reads so then the the the great challenge is going to be how do I select the real Peaks versus the bogus Peaks and here's two replicates of the same experiment the same experiment was carried
out twice and in replicate one I see yeah some agreement that that looks nice and then in replicate two I see some green but Now I see this giant Peak here and only a smaller Peak here and I see a moderate Peak here and a very very small Peak here how do I combine these replicates there's different ways of doing it one of them is take only the Peaks that were called in both experiments that means that this one is going to get rejected because it wasn't perhaps also called there another one is let's add
up the signal from the two experiments seems reasonable the problem There is that you you don't like you're you're wasting the effort that you did to sort of carry out two experiments one of them is bad you're just adding a bunch of noise um another one might be I'm going to take the union of all of the Peaks if I called it here and if I called it there and if I called it there so basically I'm going to take all of the ones like this one was called here that one was called there that's
sounds great take The unit the problem again is that if one of them is noisy you're just you know you're going to call all the noisy ones if you take the intersection if one of them didn't have enough signal then you're not going to call all these great signals from the other okay good so I hope I've convinced you that we need to do something more than that there something more than that is very simple it basically says let me sort all of my peaks in experiment number one and see How many of those replicate
in the other experiment and based on the replication rate I'm I'm going to choose where to choose the cut off in experiment one everybody with me here and I'm going to do the same for experiment two in experiment two I'm going to sort all of the reads based on their intensity and I'm going to down go down the list and say oh wow this replicates well replicates well oh this stops replicating why is that powerful because The replicates well could be 10% to 2% transition or 50% to 30% transition right so the moment I stop
replicating well even if one experiment was much less signal than the other experiment I'll still see that the replication rate decreases at some point but that point can be very different for experiment one and experiment two everybody with me here so basically I go down the list of experiment one and Peaks and then I stop and maybe For experiment one I'll choose like 4,000 Peaks and for experiment two I'll choose like 300 Peaks and that's okay sounds good but if a peak was so strong in Experiment 2 in the 300 peaks of The Experiment 2
if it was so strong I'll still keep it even if if it may have been missed in experiment one okay can I get a 543 to1 who's with me here awesome nice nice I see a bunch of FIV great and some fours Okay so that's the key idea basically I say what is the replication rate if you wish and then this replication rate will you know or this non-replication rate will basically start you know going really bad at some point and then that's where I I'll choose my cup okay so that's sort of the the
key idea of this uh replication uh right all right now what have I done I've basically carried out my experiments I've mapped my reads I've called my Peaks I've replicated them the next step is how do I now combine multiple signals from multiple marks okay so here's the challenge we have dozens of History modification marks they can arise in very complex combinations they're extremely diverse extremely Dynamic and maybe there's distinct functions for distinct combinations of marks and there might be both additive and combinatorial effects how do we find the biologically relevant Combinations of marks what
we want is to be able to learn the language of the epome from scratch we want an unsupervised approach just give it a bunch of data come back and say okay well I found 20 patterns that matter everybody with me here so that's the goal and we want a probabilistic model that explicitly models the combinations and that uses just like we saw on Tuesday the relationship between neighboring positions to avoid making a Bunch of bulu Scrolls so what we're going to do is basically try to uh Define this based on the fact that serly as
I walk through my genome I will go through different combinations and I want to infer the hidden chromatin State okay so I have a bunch of observations of individual marks and I have a hidden promting state track at every position I'm in a enhancer State promoter State transcribe State Etc and I'm emitting a vector of hiso modification marks okay so I want to have both a transition Matrix that basically tells me that promoter states are near promoter States enhancer states are near enhancer States transcribed States or near transcribed States and uh emission that basically tells
me promoter states are more likely to emit these marks enhancer states are more likely to admit those marks you Know repress states are more likely to admit those marks Etc okay and to do this we're basically going to develop a hidden Mark of model okay again who has seen her Mark models raise your hands high who has not seen them raise your hands high okay awesome so what are hidden Mark of models hidden Mark of models are basically a way to uh start thinking about the type of sequence that generated something okay for example in
speech a Kid Mark of model can be used to transcribe the words that I'm saying based on the utterances that you hear why because these utterances come in a sequence they come in an order and the one before can influence the way that you interpret the one right after is everybody with me here yeah so the time here is the position in the genome from left to right because if I'm in an Ingenic region I'm more likely to stay in an ingenic region if I start say an exent I'm more likely to stay in a
gene and so so forth so I'm capturing the temporality as simply position along the genome and I'm using the neighborhood information to constrain the extraordinary number of possibilities for any one seg everybody with me here awesome so what we want with this hit Market model is the ability to both emit a DNA sequence of a Certain type to recognize DNA sequences of that type and to learn the distinguishing characteristics of a given State everybody here awesome remember at the very beginning of the class I basically said that there's a model and a bunch of observations
the observations are the stuff that we see about the world and the model is the stuff that we in about the world and I showed you these as being basically independent even Though they were sampled from a continuous process that has some kind of temporality okay and then we talked about how in the generation we have the probability of observing the data given the hypothesis and in the inference we have the probability of being in the Spring State given the observations that I have everybody can here awesome so now what I'm going to do is
I'm going to add this temporality component I'm going to basically say well I transition from you Know promoter to enhancer to transcribed Etc a transition from Summer to fall to winter Etc and I basically have some notion of the state that I'm in that depends on the previous state that I was in you know right before okay so that's a mark of chain and this basically says after you know this particular observation are more likely to see that observation so in a mark of chain everything observe whereas in a hidden Mark of model the mark
of chain is not Between the observations it is instead between the hidden States and the hidden States generate observations in a generative framework and transition from one state to the other okay so I'm going to have two sets of parameters I'm going to have my observations X my hidden State pi and the two sets of parameters are going to be what is the probability of transitioning from this state to that State and that probability is not going to depend on anything okay given the state that I'm in I randomly draw an observation and I randomly
choose a next day to go to this is what we call memorylessness the the the model has no memory it's memoryless everybody with me here so so um if I'm in this state I have some generation probability and I have some transition probability the transition probability is simply the Probability of going to State L given that I was in state K the emission probability is the probability of emitting character XI given that I I'm in state K okay so we have a vector of observations a hidden path a transition Matrix and an emission Vector okay
and then we're going to be using the same base rule as before but now we're going to have not only emission probabilities we're also going to have Transition probabilities from the states nearby everybody with me here awesome so um this is a example hit Mark of model for interpreting genomes so basically you have some background distribution of nucleotides equal probability for every a CG or T and for example a GC sequence might have higher probability of emitting a g or a c with 40% compared to only 10% for an A Or a t everybody with
me here so I have some self transition probability that basically says if I'm in a background I'm more likely to stay in a background for a long time 100 times out of uh sorry 99 times of 100 I'm going to stay where I am and then here 95 times of 100 I'm going to stay where I am so 19 times out of 20 but one time over 100 I'm going to transition from background to promoter and one times out of 20 I'm Going to transition from promoter back to background which state do you think is
going to be longer this has a very high self trans probability background is probably going to be longer everybody with me here awesome so now I have an observation I basically see you know uh at AG TCT what is the chance that this was generated by background only Well Point 0555 point5 and of course the transition probabilities because there's a 01 Chance of exiting every single time everybody with me here so that's the joint probability of observing this sequence and all background and that is 025 to the 10th because that's the emission probability of each
of the characters and then 99 to the 9th which is astronomically small 10 minus 9 very very small why is it so small because I could have generated many different types of sequences this is just one of basically an exponential Number of sequences because at every position I have four options time four * four time four so four to the 10 everybody from here awesome now if I generate exactly the same sequence but from the promoter State then the chance is 0.1 for all of of the at R sequences and then point4 for all of
the GC R sequences and therefore it gives me two to the 10th * to- 9 and now I can compare the two and say aha this one is Two 10us 9 and this is five so this is 2 and a half times more likely okay and therefore this sequence as you can see is more 0 Rich so it's more likely to be from the background State than the promoter State sounds good can I do better maybe I could just transition from the B to the P to the B so from the background to the promoter
back to background why because here I capture all of the at Rich here I Capt all of the at ra and here C all of the GC ra Who thinks this is going to be better raise your hands who think it's going to be worse raise your hands why good good because transitioning is extremely expensive okay so if I compare the two now I'm 10us 10 and it's much less likely because of the high cost of Transitions okay all of that is nice and good and all I need to do is just simply calculate every
possible parts and just evaluate them all and I'm done happy how Many parses are there exponential okay so I need to do something better yeah yeah you could basically say which St state am I more likely to start in you could also say you know what I don't want to start State probability what I want is just simply the you know continuous um basically if I'm more likely to self transition with background than with promoter then I'll just expect more background so I could Just get rid of this as a parameter okay so so uh
I'm not going to score them all instead I'm going to use dynamic programming to turn an exponential number of possible paths to a polom how effectively by aligning states to positions so it's the same thing as we did on Tuesday where I aligned a sequence to a sequence but now I'm going to be aligning states to positions is everybody with me Here but the alignment of states is not going to transition linearly through all of the states it's going to jump state to state according to the transition probability Matrix so going from this state to
that state has some probability going from that state to the next state has some other probability so I'm going to be aligning these states with reuse and the transitions I'm going to be paying for according to transition Matrix can I get a 543 to1 who's with me nice yes so as you're transitioning you're not paying the same fixed Gap penalty you're paying a penalty according to that specific transition and every transition is going to have its own parameter okay so I'm basically going to encode this as I've already computed the best possible score of parsing
that Entire sequence all the way to this state and that gives me a score for every one of the previous positions and I'm going to comp use that to compute the best possible score for each of these next States based on the score that I got all the way to that position the transition probability penalty of going from there to here and the emission of you know generating the next car okay so my next maximum is going to Be the emission from the current position and then I'm going to choose the maximum of all of
those options what do I want I want something that has a great previous score but I don't want to pay a huge transition penalty I want something that has a great transition score but I don't want to start from a crappy preview state so it's going to be the product of those two that will basically tell me what the Current maximum is can I get a 543 to one who's following here nice awesome beautiful now one more thing I make that maximum decision what do I need to do remember it so I'm going to store
both the next maximum and the arrow from where it came from everybody with me here so then I get to the end and then I trace back following back the Arrows at every position I choose not from three previous squares but from a whole column of previous squares I I have k n entries to fill in and at every position I choose any one of K preview steps so this gives me a k Square n time and only a k n space everybody with me here who is that they've learned stuff yes awesome so now
that I have that I want to also perhaps calculate the total Probability of generating a sequence what that total probability it's the sum of all of these probabilities so then that I can sort of propagate that all the way to the end and then I can do something very fun which is if I observe a particular sequence both before and after I can calculate How likely is it that I parse all of these and end up in the state B coming from the left to the right or how How likely is it that I parse
all of These starting from State B and I calculate that from the right to the left and if I add the two together what that gives me is the total probability of going into a particular State and out of that particular State okay so that is the total probability of being in a state given all of the stuff before and all of the stuff after okay so what that allows me to do is to now use of that information to effectively create a hidden Mark of model that allows me to Parse the probability of being
in each of these hidden states of enhancer promoter transcribe repress based on the observations of the marks that I'm emitting is everybody with me here awesome so what have we seen in today's lecture we basically saw um you know the foundations of epigenomics we saw about primary data processing about mapping of reads using the bur wheer transform we looked at various Ways of doing quality control and Peak calling and we looked at some foundations of h mark of models for generating sequences and for parsing sequences and for decoding sequences we haven't yet looked about how
do we learn the parameters of human Mark of model and we still need to talk a little bit about more complex learning chating States Etc all of that is not in your homeworks so we're going to pick up this lecture on Tuesday and then we're going To continue with the regulatory Motif lecture and the two are kind of tied with each other okay and then for hidden Mark of models in particular we saw the basics of observations versus models of using base rule we looked at the difference between Mark of change where I'm just transition
between different observations and hidden work of models where I'm transitioning between hidden States and I emit observations and then we looked at the BB algorithm the Forward algorithm a little bit of the posterior decoding algorithm that basically allows me to align effectively a set of hidden states to a set of observations feel that they've learned stuff today awesome good have a wonderful long weekend see you guys on Monday for recitation either at 3 4 or 5: PM we're going to send out a poll and we're going to go through P set one then and then
we'll continue this on Tuesday next week thank you