fgcz / prolfqua

Differential Expression Analysis tool box R lang package for omics data
https://pubs.acs.org/doi/pdf/10.1021/acs.jproteome.2c00441
MIT License
37 stars 7 forks source link

Error with setup_analysis() #54

Closed amechakra closed 1 year ago

amechakra commented 1 year ago

Hi,

I would like to try the vignette. The first steps go well until this one: adata <- setup_analysis(startdata, config)

I get the following error: "creating sampleName Error in if (!after) c(values, x) else if (after >= lengx) c(x, values) else c(x[1L:after], : missing value where TRUE/FALSE needed"

It seems that my data contains missing values but I don't know how to handle them. I tried : data <- read.table("path_to/proteinGroups.txt", sep="\t",na.strings = c(""), header=T) data <- data %>% drop_na(c("Protein.IDs", "Gene.names", "Intensity")) startdata <- prolfqua::tidyMQ_ProteinGroups(data) ...steps up to: adata <- setup_analysis(startdata, config)

but I still get the same error.

Here is the link to my protein groups file: https://www.swisstransfer.com/d/34536145-ba5e-4994-8364-fa2a5aca223a

wolski commented 1 year ago

Dear amechakra,

The missing values are not the problem. Could you tell me how you specified the configuration (config) variable? Could you also share this code? I want to reproduce the error, which would help me to give you an answer and improve the error message.

Witek

amechakra commented 1 year ago

Dear Witek,

Thanks for your prompt answer.

Sorry, I did not specify that I am applying the vignette : "Comparing Two Groups with prolfqua" https://fgcz.github.io/prolfqua/articles/Comparing2Groups.html

Here is the code that gave the error:

inputMQfile <-  file.path("/path_to/proteinGroups.txt")
inputAnnotation <- file.path("path_to/annotation.xlsx")
startdata <- prolfqua::tidyMQ_ProteinGroups(data)
annotation <- readxl::read_xlsx(inputAnnotation)
head(annotation)
startdata <- dplyr::inner_join(annotation, startdata, by = "raw.file")
startdata <- dplyr::filter(startdata, nr.peptides > 1)
atable <- AnalysisTableAnnotation$new()
atable$fileName = "raw.file"
atable$hierarchy[["protein_Id"]] <- c("proteinID")
atable$set_response("mq.protein.intensity")
config <- AnalysisConfiguration$new(atable)
adata <- setup_analysis(startdata, config) #the error comes here

proteinGroups: https://www.swisstransfer.com/d/34536145-ba5e-4994-8364-fa2a5aca223a annotation: https://www.swisstransfer.com/d/75d16e41-28de-4b37-b943-cc422144cc1b


From: Witold Wolski @.***> Sent: 21 March 2023 12:17:44 To: fgcz/prolfqua Cc: Mechakra Asma; Author Subject: Re: [fgcz/prolfqua] Error with setup_analysis() (Issue #54)

Dear amechakra,

The missing values are not the problem. Could you tell me how you specified the configuration (config) variable? Could you also share this code? I want to reproduce the error, which would help me to give you an answer and improve the error message.

Witek

— Reply to this email directly, view it on GitHubhttps://github.com/fgcz/prolfqua/issues/54#issuecomment-1477659353, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A4AGYIVPZ7DXZGHZUEAIMRLW5GE5RANCNFSM6AAAAAAWCFUWRM. You are receiving this because you authored the thread.Message ID: @.***>

[ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/fgcz/prolfqua/issues/54#issuecomment-1477659353", "url": "https://github.com/fgcz/prolfqua/issues/54#issuecomment-1477659353", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

wolski commented 1 year ago

Hi, Thanks for sharing the code and data.

There are two things you need to fix. First, the raw file names in the annotation do not match those coming from tidyMQ_ProteinGroups.

> annotation$raw.file[1]
[1] "20210920_002_S312150_2021-08-17_HuBiceps_LCM_141_Pat1216_Diseased.raw"
> unique(startdata$raw.file)[1]
[1] "02_s312150_2021.08.17_hubiceps_lcm_141_pat1216_diseased"

Then you can check that the join does not return an empty data frame.

startdata <- dplyr::inner_join(annotation, startdata, by = "raw.file")

The second possible problem is that you did not specify that Condition and sample are the columns containing the explanatory variables:

atable <- prolfqua::AnalysisTableAnnotation$new()
atable$fileName = "raw.file"
atable$hierarchy[["protein_Id"]] <- c("proteinID")
atable$factors[["Condition"]] <- "Condition"
atable$factors[["PatientID"]] <- "sample"

Afterward, using prolfqua should become much more straightforward.

I hope this helps.

amechakra commented 1 year ago

Thank you. It perfectly works now.


From: Witold Wolski @.***> Sent: 22 March 2023 10:42:53 To: fgcz/prolfqua Cc: Mechakra Asma; Author Subject: Re: [fgcz/prolfqua] Error with setup_analysis() (Issue #54)

Hi, Thanks for sharing the code and data.

There are two things you need to fix. First, the raw file names in the annotation do not match those coming from tidyMQ_ProteinGroups.

annotation$raw.file[1] [1] "20210920_002_S312150_2021-08-17_HuBiceps_LCM_141_Pat1216_Diseased.raw" unique(startdata$raw.file)[1] [1] "02_s312150_2021.08.17_hubiceps_lcm_141_pat1216_diseased"

Then you can check that the join does not return an empty data frame.

startdata <- dplyr::inner_join(annotation, startdata, by = "raw.file")

The second possible problem is that you did not specify that Condition and sample are the columns containing the explanatory variables:

atable <- prolfqua::AnalysisTableAnnotation$new() atable$fileName = "raw.file" atable$hierarchy[["protein_Id"]] <- c("proteinID") atable$factors[["Condition"]] <- "Condition" atable$factors[["PatientID"]] <- "sample"

Afterward, using prolfqua should become much more straightforward.

I hope this helps.

— Reply to this email directly, view it on GitHubhttps://github.com/fgcz/prolfqua/issues/54#issuecomment-1479221309, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A4AGYIXSWR7ECMRXHV6JZWTW5LCR3ANCNFSM6AAAAAAWCFUWRM. You are receiving this because you authored the thread.Message ID: @.***>

[ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/fgcz/prolfqua/issues/54#issuecomment-1479221309", "url": "https://github.com/fgcz/prolfqua/issues/54#issuecomment-1479221309", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.": "Organization", "name": "GitHub", "url": "https://github.com" } } ]