Yes, it is possible using the
This is described in Combining MSnSet instances section of the MSnbase: MS data processing, visualisation and quantification vignette. You can access it from R by typing
vignette("MSnbase-demo", package = "MSnbase").
You can access it online here. Note that the online vignette matches the development version (but that section/functionality hasn't changed), while the one accessed directly from R matches you installed version.
The combine function for combining two different MSnSets with completely different sample names is producing erroneous results.
So instead of returning as mentioned in the vignette unique (n1)+unique (n2)+ shared (n1,n2) rows, it is returning an MSnSet with nrow of max(n1,n2). I tried various test cases but couldn't pin-point the exact reason of this error. I have already used updateFvarLabels and updateSampleNames before combining.
However, it gives this warning messages.
> test12 <- combine(test1,test2)
1: In alleq(levels(x[[nm]]), levels(y[[nm]])) : 11 string mismatches
2: data frame column 'Experiment' levels not all.equal
3: In alleq(levels(x[[nm]]), levels(y[[nm]])) : 3 string mismatches
4: data frame column 'Label' levels not all.equal
I think this warning message is because these MSnSets consists of different samples.
I got it now. When combining different samples featureNames has to defined as protein accession (or the combining variable). In my dataset it had no featureNames but just numbers so thats why it was giving wrong results. It does not give any error message but just wrong results.
One small confusing thing is the following message in the processing information where it should mention the dimensions of the combined MSnSets. Have a look into the text marked in bold.
> exp12 <- MSnbase::combine(MSnset_P1, MSnset_P2)
MSnSet (storageMode: lockedEnvironment)
assayData: 9197 features, 22 samples
element names: exprs
sampleNames: CMK.Rep1.MSnset_P1 CMK.Rep2.MSnset_P1 ...
RefPool.4.MSnset_P2 (22 total)
varLabels: Experiment Label ... Analyt.Rep (5 total)
featureNames: A0A0B4J2F0 A0AV96 ... Q9Y6V0 (9197 total)
fvarLabels: Protein.MSnset_P1 Gene.MSnset_P1 ... Count.MSnset_P2 (10
experimentData: use 'experimentData(object)'
- - - Processing information - - -
Combined [9197,22] and [8303,11] MSnSets Wed Jan 24 08:15:26 2018
 8607 11
 8303 11