Considering that I have two vectors, one called residues
and a second one called scores
, which have 31 scores, one for each residue, all positive numbers. To illustrate, the two vectors were obtained as shown below:
residues <- 1:31
scores <- runif(n = 31, min = 0.35, max = 3.54)
I am considering a random sequence just to exemplify.
If I plot the residues
x the scores
I will have the following graphic:
What I want to do is the following: I will consider specific combinations of 15 residues (henceforth referred as 15mer), skipping one residue (i.e. 1:15, 2:16, 3:17 all the way up to 17:31) and I want to calculate the area under the curve (AUC) for all these 17 combinations. My final goal is to select the 15mer that has the highest AUC.
The AUC can be calculated using the rollmean function from the zoo package, as shown in this question. However, as I have, in this example, 17 possible combinations, I am trying to find a script to automatize the process. Thanks in advance.