Hi,
I have a data.frame of genic expression as follows.
Sample1 <- c(0.2,0.8,1.02,4,1.6)
Sample2 <- c(0.9,0.2,1.06,0.9,1.6)
Sample3 <- c(1.05,0.8,1.02,1.5,0.8)
input <- data.frame(Sample1,Sample2,Sample3 , row.names = c("geneA","geneB","geneC","geneD","geneE"))
I want to apply a score depending on the expression of each gene in each sample :
for gene A,B and C : <0.5 : 0 point ; >0,5 <2 : 2 points ; >2 : 6 points
for gene D, E : <0.5 : 10 points ; >0.5 <2 : 5 points ; >2 : 0 point
the result in that case would be as follows :
Sample1 <- c(0,2,2,0,5)
Sample2 < c(2,0,2,5,5)
Sample3 <- c(2,2,2,5,5)
result <- data.frame(Sample1,Sample2,Sample3 , row.names = c("geneA","geneB","geneC","geneD","geneE"))
Then I will sum each column to get the final score for each sample.
I dont manage in creating the function from input to result. Thanks for help !
Regards
Simon