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?
what did you try so far ? Show us the code.
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
Were u able to achieve this?
Login before adding your answer.
Use of this site constitutes acceptance of our User Agreement and Privacy