Closed nlgittens closed 1 year ago
Hi Nathan,
That's a great suggestion and thanks for putting in the work to make the edits! I'll try and integrate this into the package - maybe I can also add the auc method you suggestion at the same time.
now included
Hi Olly,
I am back with another issue with the difference plots; after looking at some more data I was still not quite happy that things were working as they should, but I think I have got to the bottom of the issue now. So in the HOIP dataset (taking newqDF object as an example), when you compute the diffMap, only the first row is populated with values. This is because of line 874:-
j <- which.min(rowSums(peptideMap[, seq.int(start[i], end[i])] > 0))
diffMap[j, seq.int(start[i], end[i])] <- diff[i]
[1,] 0 0 0.156536 0.156536 0.156536 0.156536 0.156536 0.757045 0.329764 0.590997 0.590997 0.590997 0.473997 0.473997 [2,] 0 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [3,] 0 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [4,] 0 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [5,] 0 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [6,] 0 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [7,] 0 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [8,] 0 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [9,] 0 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [10,] 0 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [11,] 0 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [12,] 0 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [13,] 0 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [14,] 0 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [15,] 0 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [16,] 0 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [17,] 0 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [18,] 0 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [19,] 0 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [,15] [,16] [,17] [,18] [,19] [,20] [1,] 0.473997 0.473997 0.473997 0.473997 0.473997 0.473997 [2,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [3,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [4,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [5,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [6,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [7,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [8,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [9,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [10,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [11,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [12,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [13,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [14,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [15,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [16,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [17,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [18,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 [19,] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
At different seq_along, where difference < 0, the peptide map is not being populated. So this should be:
j <- which.min(rowSums(diffMap[, seq.int(start[i], end[i])] != 0))
diffMap[j, seq.int(start[i], end[i])] <- diff[i]
And now the diffMap mirrors peptideMap object, and there are no missing peptides. The impact on the HOIP dataset is minimal.
Now that I'm satisfied that the function is doing what it's supposed to, I still don't like the output. Where the two uptake curves have converged, the sign is determined by noise, even if there is a significant differential effect at a different timepoint. And you're never going to be in an optimal place whichever timepoint you use to make the comparison.
I had thought that perhaps what might be better is to take the mean uptake across all timepoints for reference and comparator states (defined by new options ref_cols and comp_cols), and then take the difference on these instead. Maybe we could integrate the area under the uptake curve too as an alternative, but just taking a mean seemed to work well enough. Using this function, I'm a lot happier with how my differential heatmap looks compared to the hdxdifference function in the package.
Hopefully that covers the issue. Wasn't sure whether perhaps there is a better way of proposing changes to push in GitHub.