add_conditional_nas: Replace 0 with NA if not all entries for a given condition...

View source: R/proteomics.R

add_conditional_nasR Documentation

Replace 0 with NA if not all entries for a given condition are 0.

Description

This will hopefully handle a troubling corner case in Volker's data: He primarily wants to find proteins which are found in one condition, but _not_ in another. However, due to the unknown unknown problem in DIA acquisition, answering this question is difficult. If one uses a normal expressionset or msnset or whatever, one of two things will happen: either the 0/NA proteins will be entirely removed/ignored, or they will lead to spurious 'significant' calls. MSstats, to its credit, does a lot to try to handle these cases; but in the case Volker is most interested, it will exclude the interesting proteins entirely.

Usage

add_conditional_nas(expt, fact = "condition", method = "NA")

Arguments

expt

Expressionset to examine.

fact

Experimental design factor to use.

method

Specify whether to leave the NAs as NA, or replace them with the mean of all non-NA values.

Details

So, here is what I am going to do: Iterate through each element of the chosen experimental design factor, check if all samples for that condition are 0, if so; leave them. If not all the samples have 0 for the given condition, then replace the zero entries with NA. This should allow for stuff like rowMeans(na.rm = TRUE) to provide useful information.

Finally, this will add columns to the annotations which tell the number of observations for each protein after doing this.

Value

New expressionset with some, but not all, 0s replaced with NA.


elsayed-lab/hpgltools documentation built on April 8, 2024, 1:30 a.m.