tvpham / iq

An R package to estimate relative protein abundances from ion quantification in DIA-MS-based proteomics
BSD 3-Clause "New" or "Revised" License
19 stars 9 forks source link

Pre-filter peptides #7

Closed cobbolds closed 1 year ago

cobbolds commented 1 year ago

Hi Thang,

I was interested in filtering the minimum number of peptides used for quantification in the MaxLFQ algorithm within the 'iq' package.

Can you let me know if this is possible and if so which function (MaxLFQ or preprocess) and command is necessary?

Thanks in advance,

Simon

tvpham commented 1 year ago

Hi Simon,

No, the feature is not in iq. But you can filter using the long-format input.

I will use the first example here: https://cran.r-project.org/web/packages/iq/vignettes/iq-fast.html

library("iq") # if not already installed, run install.packages("iq") 

raw <- read.delim("DIA-Report-long-format.txt")

selected <- raw$F.ExcludedFromQuantification == "False" & 
            !is.na(raw$PG.Qvalue) & (raw$PG.Qvalue < 0.01) &
            !is.na(raw$EG.Qvalue) & (raw$EG.Qvalue < 0.01)

raw <- raw[selected,]

Now you can create a table with proteins and their peptides.

a <- unique(raw[, c("PG.ProteinGroups", "PEP.GroupingKey")])

Then you can count the number of entries for each proteins. You might use the package plyr

library("plyr")
b <- count(a, "PG.ProteinGroups")

You can filter the final MaxLFQ table using b.

Cheers, Thang

cobbolds commented 1 year ago

Hi Thang,

Thanks for the quick response and clear example solution. I will give it a try.

Best,

Simon