simonlabcode / bakR

Other
6 stars 2 forks source link

About running bakRFit #2

Closed WangJingwen21 closed 1 year ago

WangJingwen21 commented 1 year ago

Thank you for sharing such a useful tool! I am a little confused about the function bakRFit(). After I run “para <- bakRFit(dat.bakR)”,should I run “paraH <- bakRFit(para, HybridFit = TRUE)” and “paraS <- bakRFit(paraH, StanFit = TRUE)” in order,or HybridFit and StanFit are independent methods?

isaacvock commented 1 year ago

Thank you for your interest in bakR!

In short, HybridFit and StanFit are independent models. Once you run bakRFit() on your initial bakRDataobject, you can run either of these models in any order.

HybridFit = TRUE runs the model referred to as the "Hybrid implementation" in our paper, and StanFit = TRUE runs the "MCMC implementation". In the paper, we show that these two models perform almost equally well on most datasets, but the "Hybrid implementation" is orders of magnitude more efficient to run. Because of this, I usually suggest just running bakRFit(para, HybridFit = TRUE).

There are some cases where using the other model can be useful though, for example if your metabolic label incorporation rates are low or if your metabolic label feed time was much longer or shorter than the typical half-life of the RNA you sequenced. There is a function in bakR called QC_checks() which can be run on a bakRFitobject as such: QC <- QC_checks(para) (where I used the same variable name you did for your bakRFitobject). It will provide a broad overview of your data and flag any potential issues that could make analyzing the data with the faster models (the "MLE implementation", which is the one that runs when you first run bakRFit() on a bakRDataobject, and the "Hybrid implementation") difficult. In that case, it will output a message suggesting that you run the "MCMC implementation" by setting StanFit = TRUE in bakRFit(). The QC_checks function and its interpretation is discussed in more detail in the relevant vignette on the bakR website.

WangJingwen21 commented 1 year ago

Thank you so much for your reply! Helped a lot! Forgive me for asking one more question may not concerns bakR. I really want to learn plotting figures like this in the article [STL-seq reveals pause-release and termination kinetics for promoter-proximal paused RNA polymerase II transcripts] published on Molecular Cell.

image

Could you give me some clue?

isaacvock commented 1 year ago

I'm glad it helped!

Yeah those plots are not something that bakR can make for you, but there are some instructions on the bam2bakR website about how to use bam2bakR's output to create these colored sequencing tracks.

Making a figure exactly like the one from the STL-seq manuscript requires lots of tinkering in Adobe Illustrator, but the general idea of making sequencing coverage tracks colored by mutational content is possible with the instructions linked above.