This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Dichotomizing Gene Expression Data Based On The Median

Hello,

I have a question which was part answered on another post but I have follow up question. Dichotomizing Gene Expression Data Based On The Median

I am using for loop and most use as doing calculation further on which require it.

my question is

since I am using for loop, I need to access the gene expression value for each gene separately to do the comparison to median.

geneA 0.54744
gene B 0.5596

and so on....

I have the normalised data but that's a matrix of the genes and the samples what each got. for example,

 genes  sample 1    sample 2  sample 3  sample 4  
7945460  7.471390  7.256158  7.287770  7.545794 
7945462  7.609366  7.528324  7.324294  7.310791
7945475  5.375443  5.749566  5.519073  5.806861

How / where is the final number for the gene? so I can calculate comparison.

r microarray gene-expression-data dichotomizing

1 answer

It's not clear what you are asking, but you can greatly simplify your calculations:

#make some fake data. you call this current_study
# 100 genes * 10 samples.
expr = matrix(rnorm(1000), nrow=100, ncol=10)
rownames(expr) = paste0("gene", 1:100)
colnames(expr) = paste0("sample", 1:10)

# get the median for each gene.
meds = apply(expr, 1, median)

# you called this di_matrix
gtmed = expr > meds

where gtmed now contains TRUE if that entry is above the median for that row.

I try make it clearer sorry.

I have multiple samples because these are replicates. so when work out for a gene what expression is, its statistical stronger.

I looking for the final expression number of a gene to compare that to the median.

Just use what brentp posted and then take the median of medians. What he posted will give you one value per gene/probe/whatever. I should note that I'm not a fine of dichotomous expressed/unexpressed methods (the mas5 method is OK).

Log in to answer this question.