This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Shannon's Entropy by Sliding Window in R

Hellow there. I have a fasta file containing aligned sequences (around 1,000). I need to calculate the entropy using the sliding window method on this file. How can this be done in R?

sequence window r entropy sliding

To be honest, I haven't tried anything. I've never come across this topic before. I don't know much about python, so I'm looking for a solution in R if it exist

I would suggest starting by googling "apply function in sliding window in R". Learning how to google and find stuff out like this is the most important skill in bioinformatics. People here are very willing to help, but you have to show some effort first.

Okay, thank you

zoo::rollapply is your friend

If I remember correctly, TFBStools package in R has a shannon.entropy() function that you could use, maybe you need to calculate it per position and take mean over every window?

Yes I do this

0 answers

No answers yet.

Log in to answer this question.