Shannon's Entropy by Sliding Window in R
0
0
Entering edit mode
10 weeks ago
Alex • 0

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 • 286 views
1
Entering edit mode

what did you try so far ? Show us the code.

0
Entering edit mode

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

0
Entering edit mode

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.

0
Entering edit mode

Okay, thank you

0
Entering edit mode

zoo::rollapply is your friend

0
Entering edit mode

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?

0
Entering edit mode

Yes I do this