Question: How to keep the gene id with highly FPKM.
0
gravatar for M K
3.3 years ago by
M K490
United States
M K490 wrote:

I have a text file contains three columns; the first coulmn is the Ensemble gene id, the second column is gene name, and the third column is FPKM. I am looking for R function to keep the Ensemble gene id that highly expressed (i.e has highest FPKM) only in this file.

Example: from the data below, I want only to keep ENSMUST00000062483 Gli2 0.157666 which has the highest FPKM

ex

R • 937 views
ADD COMMENTlink modified 3.3 years ago by Pol70 • written 3.3 years ago by M K490

That's a very basic R question. I would suggest you to follow tutorial on basic R programming, this will make everything less painful in the long run. Specifically, you are looking for the row (slicing) for which the FPKM value is equal to the maximum value of all FPKM values.

ADD REPLYlink written 3.3 years ago by WouterDeCoster43k
2
gravatar for Pol
3.3 years ago by
Pol70
Pol70 wrote:
newdata <- yourdataframe[order(-yourdataframe$FPKM),]

The "-" before yourdataframe$FPKM indicates "descending" without it will be "ascending"

ADD COMMENTlink written 3.3 years ago by Pol70

That's worked, but it gave me all highest FPKMs. What I need to keep the highest one only (i.e the highest value among all higher FPKM values)

ADD REPLYlink written 3.3 years ago by M K490
2
    highest <- newdata [1,]

I hope this helps

ADD REPLYlink written 3.3 years ago by Pol70
1
gravatar for shunyip
3.3 years ago by
shunyip180
shunyip180 wrote:
Yourdata <- read.table("yourfile.txt", sep="\t", row.names=1, header=FALSE)
HighlyExpressedID <- rownames(Yourdata[order(Yourdata[,2],decreasing=TRUE),])[1:n]

Just replace "n" with the number of gene id that you want to keep.

I hope this helps

ADD COMMENTlink written 3.3 years ago by shunyip180
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 904 users visited in the last hour