Hello gain,
I need to learn how I can create an MSnSet file from a csv file. So, as an example, I just wrote “msms.spk” expression dataset (from “msmsTests” package) to a csv file as bellow:
library(msmsTests)
data(msms.spk)
write.exprs(msms.spk, file="msms.txt", sep="\t")
Then, I manually exported msms.txt to msms.csv file.
(ms1 data has 685 rows (protein IDs) and 19 columns (expression data for each treatment)) except the first column (containing protein IDs) and the first row (containing the name of treatments).
Then, to import msms.csv dataset to MSnSet instance, I ran the following codes:
> ms1 <- read.csv("msms.csv")
> dim(ms1)
[1] 685 20
> MAMA <- readMSnSet2(ms1, ecol = 2:19, fnames = 1, header=TRUE)
> dim(MAMA)
[1] 685 18
> head(fData(MAMA))
Protein.ID Y500U600.006
YKL060C YKL060C 238
YDR155C YDR155C 183
YOL086C YOL086C 221
YJR104C YJR104C 152
YGR192C YGR192C 145
YLR150W YLR150W 115
> head(pData(MAMA))
data frame with 0 columns and 6 rows
> head(MAMA)
MSnSet (storageMode: lockedEnvironment)
assayData: 1 features, 18 samples
element names: exprs
protocolData: none
phenoData: none
featureData
featureNames: YKL060C
fvarLabels: Protein.ID Y500U600.006
fvarMetadata: labelDescription
experimentData: use 'experimentData(object)'
Annotation:
- - - Processing information - - -
Subset [685,18][1,18] Thu Feb 14 16:01:07 2019
MSnbase version: 2.8.3
I do not know what is wrong in my codes because the output of the original dataset directly from msmsTests packages is different (specially in pData and fData) as it is shown the below:
> data(msms.spk)
> head(msms.spk)
MSnSet (storageMode: lockedEnvironment)
assayData: 1 features, 19 samples
element names: exprs
protocolData: none
phenoData
sampleNames: Y500U100_001 Y500U100_002 ... Y500U600_006 (19 total)
varLabels: treat
varMetadata: labelDescription
featureData: none
experimentData: use 'experimentData(object)'
pubMedIds: http://www.ncbi.nlm.nih.gov/pubmed/23770383
Annotation:
- - - Processing information - - -
Subset [685,19][1,19] Wed Feb 13 20:10:53 2019
MSnbase version: 1.8.0
> fData(msms.spk)
data frame with 0 columns and 685 rows
> pData(msms.spk)
treat
Y500U100_001 U100
Y500U100_002 U100
Y500U100_003 U100
Y500U100_004 U100
Y500U200_001 U200
Y500U200_002 U200
Y500U200_003 U200
Y500U200_004 U200
Y500U200_010 U200
Y500U200_011 U200
Y500U400_002 U400
Y500U400_003 U400
Y500U400_004 U400
Y500U600_001 U600
Y500U600_002 U600
Y500U600_003 U600
Y500U600_004 U600
Y500U600_005 U600
Y500U600_006 U600
I would highly appreciate if you can help me to solve my problem.
Many thanks for your great help. It is working now and I could also add my phenoData.csv to the final MSnSet file. Thanks a lot.