Skip to main content
Topic: split issue (Read 6534 times) previous topic - next topic

split issue

Dear all,
I tried to split my data with recipe on cookbook, however, had no success. My data is in the file called: testsplit. there are four samples in this file:HG2onedsili100,
HG2twosili100,HG2threedsili100,HG2pwm and HG2pww. Each sample has triplet runs. Here are script I used and error I got:


>sampclass(testsplit) <- c("HG2onedsili100","HG2pwm","HG2pww", "HG2threedsili100","HG2twodsili100")
Error in sampclass(testsplit) <- c("HpG2onedsili100", "HpG2pwm", "HpG2pww",  :
  object 'testsplit' not found
 
then I did following:
>sampclass<- c("HG2onedsili100","HG2pwm","HG2pww", "HG2threedsili100","HG2twodsili100")
> table(sampleclass)

no errors, however error showed up in xsplit:
>xslist <- split("HG2onedsili100","HG2pwm","HG2pww", "HG2threedsili100","HG2twodsili100", f=sampclass(HG2onedsili100","HG2pwm","HG2pww", "HG2threedsili100","HG2twodsili100"))
Error: unexpected string constant in "xslist <- split("HG2onedsili100","HG2pwm","HG2pww", "HG2threedsili100","HG2twodsili100", f=sampclass(HG2onedsili100",""

Could any one tell me how to fix it?

Thanks
Luoluopig

Re: split issue

Reply #1
Luoluopig,

It would appear that your xcmsSet object isn't loaded from the line:
Quote
>sampclass(testsplit) <- c("HG2onedsili100","HG2pwm","HG2pww", "HG2threedsili100","HG2twodsili100")
Error in sampclass(testsplit) <- c("HpG2onedsili100", "HpG2pwm", "HpG2pww", :
object 'testsplit' not found

If you type just testsplit in R you should see your object just like if you do faahko on the example from the cookbook. Also the only reason the sampclass method was used in the example was to have a third group to split by instead of just having two. You can do this as well if you want to change your sample classes.

So first I would try:
Code: [Select]
library(xcms)
##I'll assume that testsplit has been made
testsplit
sampclass(testsplit)
xslist <- split(testsplit, f=sampclass(testsplit))

Paul
~~
H. Paul Benton
Scripps Research Institute
If you have an error with XCMS Online please send me the JOBID and submit an error via the XCMS Online contact page

Re: split issue

Reply #2
Hi, Paul,
When you said "testsplit"has been made", what does that mean?
Every time before I run xset, I just change work directory. Is there anything else I need do?
Thanks!

Re: split issue

Reply #3
luoluopig,

test split should be from xcmsSet so....

Code: [Select]
library(xcms)
testsplit<-xcmsSet()
testsplit.g<-group(testsplit)

sampclass(testsplit.g)
xslist <- split(testsplit.g, f=sampclass(testsplit.g))

## or
testsplit<-xset
~~
H. Paul Benton
Scripps Research Institute
If you have an error with XCMS Online please send me the JOBID and submit an error via the XCMS Online contact page

Re: split issue

Reply #4
Hi, Paul,
After I typed xcmsSet().The error says " directory tree must be level". How you guys put your folders in a diretory tree? Could you please tell me the software you are using to build a directory tree?
Thanks!


Luoluopig

Re: split issue

Reply #5
So the directory needs to be only one level deep and your R directory needs to be sitting above the folders you want to look at. For example if I have two classes KO and WT. I will have two folders called KO and WT. In each of these files I'll put the corresponding data files in them. So something like:

MS_exp
    KO
        MS-data1.mzXML
        MS-data2.mzXML
        MS-data3.mzXML
    WT
        MS-data4.mzXML
        MS-data5.mzXML
        MS-data6.mzXML

Your R directory wants to be in MS_exp. We don't use any program to make the directory structure we leave it up to you since we're not sure how you want to arrange your experiment. If you want you can always just put all of your files together into one directory, but your results will vary on how you setup the folders. This is due to the group method and the parameter minfrac.

Hope it helps,

Paul
~~
H. Paul Benton
Scripps Research Institute
If you have an error with XCMS Online please send me the JOBID and submit an error via the XCMS Online contact page

Re: split issue

Reply #6
Hi, Paul,
The way I put my folders was exactly same with the way you showed me. So I tried demo data (faahKO) I downloaded from bioconductor:
after I typed
> getwd()
it came out fine.
However, when I typed
>sampclass(faahKO)
I got an error saying" Error in sampclass(faahKO) : error in evaluating the argument 'object' in selecting a method for function 'sampclass': Error: object 'faahKO' not found"

I don't understand. The getwd already showed the correct path of faahKO folder. How could I still get this error?
Do you have any idea what might be wrong there?
  :(


Rui

Re: split issue

Reply #7
ok with the faahko library you need to call the library explicitly.
Code: [Select]
library(faahKO)

R doesn't work like matlab in that it doesn't look at the directory for code. Instead you can load code from anywhere and library/packages can be loaded from any directory or space using the library function. It's pretty late here so apologies if I didn't read everything correctly or answer everything.

Paul

EDIT: also the object is called faahko , notice the lower case ko
~~
H. Paul Benton
Scripps Research Institute
If you have an error with XCMS Online please send me the JOBID and submit an error via the XCMS Online contact page