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

Add new element #30

Closed
uby76 opened this issue Nov 11, 2024 · 4 comments
Closed

Add new element #30

uby76 opened this issue Nov 11, 2024 · 4 comments

Comments

@uby76
Copy link

uby76 commented Nov 11, 2024

Thank you for developing such a nice package, it is really convenient for us workers who are more familiar with R language!

I have a question, when my data if there are still Cl or Br elements, when calling as.peakData, how should I add to peakObj = as.peakData(e_data = data_fticrms, f_data = emeta, e_meta = e_fticrms, edata_ cname = “Mass”, mass_cname = “Mass”, fdata_cname = “SampleID”, c_cname = “C”, h_cname = “H”, o_cname = “O”, n_cname = “N”, s_cname = “S”, p_cname = “P”). Because I realized that there is nothing about Cl and Br inside the default parameters.

@clabornd
Copy link
Collaborator

If you have installed from the latest release (1.1.0) the object creation only handles CHNOSP. We have implemented support for arbitrary elements in #25 but have not done a release with these changes. You can still install these changes by installing from the latest master: remotes::install_github("EMSL-Computing/ftmsRanalysis").

In the new framework, we specify element columns with a list like so:

peakObj <- as.peakData(ftms12T_edata, ftms12T_fdata, ftms12T_emeta, 
                       edata_cname="Mass", fdata_cname="SampleID", 
                       mass_cname="Mass", element_col_names = list("C"="C", "H"="H", "O"="O", "N"="N", "S"="S", "P"="P"), 
                       isotopic_cname = "C13", 
                       isotopic_notation = "1")

Where the format of element_col_names is list("element_name" = "corresponding_count_column", ...). You can see this in the ftmsRanalysis.Rmd vignette. In your case you should be able to specify element_col_names = list("C"="C", "H"="H", "Cl" = "your_cl_count_column", "Br" = "your_br_count_column")

Currently there is limited functionality for these non-CHNOSP elements: you can just calculate element ratios with these new elements (see ?calc_element_ratios for details). Feel free to put in a feature request for any downstream processing of these new elements. Glad you have found the package useful!

@uby76
Copy link
Author

uby76 commented Nov 11, 2024

Thank you for your quick response! Your answer is incredibly helpful for my analysis. I will update to the latest version and test it out. This package is indeed very convenient, and I will continue using it. Many thanks!

I have another question, I see that you used G-Test in ftmsRanalysis Introduction - ftmsRanalysis at the end when comparing the difference between two compositions, if my sample size is not that large. I mean, for one treatment I have only one sample, so how should I solve it?

@clabornd
Copy link
Collaborator

No problem, for your issue with the single sample, you will have to exclude this sample from any statistical tests.

group_designation should automatically set these group levels to NA. Then when calling this code in the vignette:

byGroup <- divideByGroupComparisons(peakObj, 
                                comparisons = "all")[[1]]$value

crop_unique <- summarizeGroupComparisons(byGroup, 
            summary_functions="uniqueness_gtest", 
            summary_function_params=list(
                  uniqueness_gtest=list(pres_fn="nsamps", 
                          pres_thresh=2, pvalue_thresh=0.05)))

head(crop_unique$e_data)

You could specify something like comparisons = list(c("A", "B")) in divideByGroupComparisons where "A" and "B" are groups with more than 1 sample. If you run into issues, you can also use subset.peakData to remove your singleton group and perform analysis on the remaining data.

@uby76
Copy link
Author

uby76 commented Nov 12, 2024

Thank you so much for your response, this is really cool!

@uby76 uby76 closed this as completed Nov 13, 2024
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

2 participants