I want to create a MSset file (proteomics data, data corresponds to spectral counts) but I get error messages and I am stuck (after reading manuals, helps, forums, etc).
You can get my files here: https://www.dropbox.com/sh/dw7zfgiku6cteba/AADP3U2yxB5LgXy5ykJYFf0ga?dl=0
Here is the code I have tried:
setwd("~/Desktop/analyse")
## The spectral counts data:
data <- as.character(read.delim("sc.txt", header=TRUE,sep="\t", row.names=1, as.is=TRUE))
## Feature meta-data:
fdata <- as.character(read.delim("fdata.txt", header=TRUE,sep="\t", row.names=1, as.is=TRUE))
## Pheno data:
pdata <- as.character(read.delim("pheno.txt", header=TRUE,sep="\t", row.names=1, as.is=TRUE))
library("MSnbase")
readMSnSet(exprsFile = data,
phenoDataFile = pdata,
featureDataFile = fdata,
header=TRUE)
This last command returns an error message
Error in file(file, "rt") : invalid 'description' argument
I have verified the following:
class(data)
[1] "character"
class(fdata)
[1] "character"
class(pdata)
[1] "character"
dim(data)
NULL
dim(fdata)
NULL
dim(pdata)
NULL
str(data)
chr [1:15] "c(4, 6, 11, 4, 3, 6, 2, 9, 8, 14, 15, 2, 8, 16, 5, 0, 0, 0, 0, 1, 2, 0, 0, 2, 1, 1, 0, 13, 11, 5, 0, 4, 6, 116,"| __truncated__ ...
str(pdata)
chr [1:2] "c(\"treatmentA\", \"treatmentA\", \"treatmentA\", \"treatmentA\", \"treatmentA\", \"treatmentB\", \"treatmentB\"| __truncated__ ...
str(fdata)
chr [1:9] "c(222, 273.06, 335.8638, 413.112474, 508.128343, 624.9978619, 768.7473702, 945.5592653, 1163.037896, 1430.53661"| __truncated__ ...
I have also tried, instead of "as.character()", to use "as.matrix()" for "data", and "as.data.frame()" for "fdata" and "pdata".
Dimensions match correctly and are not "NULL" in this case but it does not solve the problem because i get the following message:
Error in (function (file, header = FALSE, sep = "", quote = "\"'", dec = ".", :
'file' must be a character string or connection
If I try:
all(rownames(pdata)==colnames(data))
TRUE
I have tried to create my MSnSet file with the following (with initial reading as.character...):
MSnSet(data, fdata, pdata)
Error in (function (storage.mode = c("lockedEnvironment", "environment", :
'AssayData' elements with invalid dimensions: 'exprs'
If i read the files "as.matrix" for "data" and "as.data.frame" for "fdata" and "pdata":
> MSnSet(data, fdata, pdata)
Error in validObject(.Object) :
invalid class “MSnSet” object: 1: feature numbers differ between assayData and featureData
invalid class “MSnSet” object: 2: featureNames differ between assayData and featureData
> row.names(pdata)[1:5]
[1] "sample1" "sample2" "sample3" "sample4" "sample5"
> colnames(data)[1:5]
[1] "sample1" "sample2" "sample3" "sample4" "sample5"
> row.names(data)[1:5]
[1] "prot1" "prot2" "prot3" "prot4" "prot5"
> row.names(fdata)[1:5]
[1] "prot1" "prot2" "prot3" "prot4" "prot5"
So I have no clue where the problem comes from. Any idea on how to create properly my MSnSet file ??
Many thanks in advance for your help.
SkyR
From the argument name and from the help page, phenoDataFile
should be the path to the file, not the contents of the file. From your question, I would guess the argument should be phenoDataFile = "~/Desktop/analyse/pheno.txt"