Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make MetaboAnalyst export more visible #296

Open
sneumann opened this issue Jun 26, 2018 · 19 comments
Open

Make MetaboAnalyst export more visible #296

sneumann opened this issue Jun 26, 2018 · 19 comments

Comments

@sneumann
Copy link
Owner

XCMS has for quite some time a hidden export to MetaboAnalyst

## before starting conversion to metaboAnalyst format:

I had feedback by people from @xia-lab @jsychong that this actually works, so it would be great
to have that better exposed. The current version is designed for xcmsSet,
and the exposed version should handle both xcmsSet and the new interface.
If the Xia lab have some code examples, they could contribute that to the documentation/manpage/examples. PR appreciated :-) Yours, Steffen

@jorainer
Copy link
Collaborator

Is there some general format in which the data should be exported? some test files? descriptions? Implementing should then be simple and straightforward.

@sneumann
Copy link
Owner Author

sneumann commented Jun 27, 2018 via email

@jsychong
Copy link

Hi, thank you for opening this issue. I will do some testing if it still works well with our MetaboAnalystR package and let you know. I’ll also prepare some examples on a workflow using XCMS then our package.

Cheers,
Jasmine

@jsychong
Copy link

jsychong commented Jul 3, 2018

Hi,

The xcms:::.write.metaboanalyst() works perfectly with our R package, creating the correct data table in the right format. From our end I've created an example workflow that I will add as a vignette/use-case in our package.

Thanks!
Jasmine

@jorainer
Copy link
Collaborator

jorainer commented Jul 4, 2018

Great! Can you just point here to the vignette once you've added it?
I'll then check the export function again, eventually add unit tests (if not already implemented) and add documentation etc.

@jsychong
Copy link

jsychong commented Jul 9, 2018

Here it is! Let me know if you have any thoughts.
https://github.com/xia-lab/MetaboAnalystR/blob/master/vignettes/XCMS_to_MetaboAnalystR.Rmd

@jorainer
Copy link
Collaborator

Thanks for the link! I'll have a look at it next week as I'm on a workshop this week.

@jorainer
Copy link
Collaborator

Looks nice. I'll implement a method for the newer XCMSnExp object and export that. Would be nice if you could then also switch to the xcms xcms functions/user interface in your Rmd (I'll make a pull request on that).

@jorainer
Copy link
Collaborator

jorainer commented Jul 16, 2018

Just had a look at the exported file. The supported file format is thus:

"Sample","ko15","ko16","ko18"
"Label","KO","KO","KO"
"279/2788","17140626.9682501",NA,"16919266.8898065"
"286.2/3255",NA,"1264118.63831818","732016.229999997"
"300.2/3387","4700903.21950002","5313736.07442857","5169558.19975"
"301/2788","3051847.80832143","1964443.59906668","2774885.34432354"

Is that correct? Is there any way that feature definitions could be added too, e.g. the rt range and mz range of the features/rows?

@jorainer
Copy link
Collaborator

And how does MetaboAnalyst handle missing values? As shown above they are exported as NA. Is that OK for MetaboAnalystR?

jorainer added a commit that referenced this issue Jul 16, 2018
- Implement the exportMetaboAnalyst function to export an XCMSnExp feature data
  matrix in MetaboAnalyst format.
- Add documentation and unit tests.
@jsychong
Copy link

Yes that file format is correct, and NA is fine for missing values. Also, we currently don't make use of feature definitions so all we need is the m/z and peak intensities. We will for sure switch over once you have that ready. As well, I had an email from a user that tried our example vignette and wanted to know if it was possible to edit the decimal points for the m/z or retention time?

@jorainer
Copy link
Collaborator

Thanks for the information. Regarding the decimal point: so the user wants to use either a "." or a "," as decimal point?

@jorainer
Copy link
Collaborator

Could you check if the new exportMetaboAnalyst function works (is allows to specify also the character to be used as decimal point)?
I made a pull request at your MetaboAnalystR repo that features the vignette to use the new user interface and the exportMetaboAnalyst function.

@jsychong
Copy link

For the decimal point it was the number of digits following the decimal, not "." or ",". And I will check the new function/your pull request now and get back to you ASAP!

@jorainer
Copy link
Collaborator

I see. No problem about that. I'll be however on holidays the next two weeks - so it will take some time...

@jorainer
Copy link
Collaborator

jorainer commented Aug 6, 2018

I've now added a digits parameter that allows to specify the number of significant digits (passed directly to R's format function).

@jsychong
Copy link

jsychong commented Aug 6, 2018

Great! Everything looks good on our end, thank you.

@etrh
Copy link

etrh commented Oct 31, 2018

It would be great to have the possibility to replace rownames with mz/rt values. This is how I currently do it:

### Convert XCMSnExp to xcmsSet ###
xset_conv <- as(xdata, "xcmsSet")
sampclass(xset_conv) <- gsub("^.*\\.", "", sampclass(xset_conv))

### Build the MetaboAnalyst Matrix ###
metaboanalyst_dat <- groupval(xset_conv, "medret", "into")
rownames(metaboanalyst_dat) <- groupnames(xset_conv, mzdec = 6, rtdec = 6)
metaboanalyst_dat <- rbind(group = as.character(phenoData(xset_conv)$class), metaboanalyst_dat)
colnames(metaboanalyst_dat) <- xset_conv@phenoData$sample_name

### Export ###
write.csv(metaboanalyst_dat, file='MetaboAnalyst_Matrix.csv')

@jorainer
Copy link
Collaborator

jorainer commented Nov 5, 2018

@etrh I could add a parameter to exportMetaboAnalyst that allows to use groupnames instead of the feature IDs as rownames - would that be OK?

jorainer added a commit that referenced this issue Nov 5, 2018
- Add parameter groupnames to exportMetaboAnalyst to allow using m/z and
  retention times as rownames (issue #296).
- Fix bug in `show,XCMSnExp` that would lead to an error if process history is
  empty.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants