lgatto / pRoloc

A unifying bioinformatics framework for organelle proteomics
http://lgatto.github.io/pRoloc/
15 stars 13 forks source link

Write markers column into a .csv #139

Closed ortizmateujuan closed 3 years ago

ortizmateujuan commented 3 years ago

Hi,

I have successfully made a PCA analysis with my SWATH data using the prolocVis() function. MiniSWATH.xlsx

But now if I want to run the code to assign new subcellular phenotypes to my data I need to have an Input column in a .csv file with the markers. (Something like the "phenoDisco Input" column in this data): ncomms9992-s2.xlsx

This is the code so far:

csvfile <- dir("/Users/x/Desktop", full.names = TRUE, pattern = "MiniSWATH.csv") 
basename(csvfile)

getEcols(csvfile, split = ",", n = 2)

ms <- readMSnSet2(csvfile, ecol = 4:6, fnames = 1, skip = 1)
ms

fvarLabels(ms)
fvarLabels(ms)[1:3] <- c("Acc", "ID", "Description")

ms <- normalise(ms, method = "sum")

pRolocmarkers()
mrk <- pRolocmarkers(species = "hsap")
head(mrk)

ms <- addMarkers(ms, mrk)

head(featureNames(ms))

par(mfrow = c(1, 2))
plot2D(ms, main = "pRolocmarkers for human")
addLegend(ms, cex = .6)

ms <- fDataToUnknown(ms, from = "PEROXISOME", to = "unknown") 
ms <- fDataToUnknown(ms, from = "plasma mem", to = "unknown")
ms <- fDataToUnknown(ms, from = "Lysosome", to = "unknown")

getMarkers(ms)

library("pRolocGUI") 
pRolocVis(ms)

Then I want to get the markers

getMarkers(ms, fcol = "phenoDisco.Input")

but I don´t have them added to the .csv file so:

> getMarkers(ms, fcol = "phenoDisco.Input") Error in isMrkVec(object, fcol) : fcol %in% fvarLabels(object) is not TRUE

So, my question is that if it is possible to export this information derived from addMarkers into my data .csv file or into a new .csv file. The prolocVis() function shows a table with this column but I see no option of exporting this into a .xlsx or .csv.

The same question goes for the rest of the featureData in the natcomms9992 file: phenoDisco Output, SVM markers, classification... How I add these in to my data?

Any help would be appreciated, thanks!

lgatto commented 3 years ago
write.exprs(ms, fcol = fvarLabels(ms), file = "ms.csv", sep = ",")
lgatto commented 3 years ago

Closing the issue, but feel free to re-open this one or create a new one if necessary.