Functions
Index
MetabolomicsWorkbenchAPI.build_df_dataMetabolomicsWorkbenchAPI.check_mwMetabolomicsWorkbenchAPI.fetch_dataMetabolomicsWorkbenchAPI.fetch_metabolitesMetabolomicsWorkbenchAPI.fetch_propertiesMetabolomicsWorkbenchAPI.fetch_samplesMetabolomicsWorkbenchAPI.fetch_study_infoMetabolomicsWorkbenchAPI.fetch_total_subjectsMetabolomicsWorkbenchAPI.filt_jsonMetabolomicsWorkbenchAPI.fix_unbalanced_nameMetabolomicsWorkbenchAPI.get_outputMetabolomicsWorkbenchAPI.get_variables_namesMetabolomicsWorkbenchAPI.json2dfMetabolomicsWorkbenchAPI.mw_matchMetabolomicsWorkbenchAPI.mw_mwtabMetabolomicsWorkbenchAPI.mw_urlMetabolomicsWorkbenchAPI.parse_jsonMetabolomicsWorkbenchAPI.url2df
Description
MetabolomicsWorkbenchAPI.build_df_data — Methodbuild_df_data(vDF::Vector{DataFrame}) => DataFrameIt checks all samples and includes all the variables names. If a sample misses one or more variable, it generates the missing entries for all variables. It returns a dataframe.
MetabolomicsWorkbenchAPI.check_mw — Functioncheck_mw(url::AbstractString) => StringChecks if Metabolomics Workbench server is responding properly. Returns the HTTP status code (200 if successful) and prints a message.
Example
julia> check_mw()
MetabolomicsWorkbench.org is alive.
200MetabolomicsWorkbenchAPI.fetch_data — Methodfetch_data(studyname::String) => DataFrameReturn the metabolite data of the study as a dataframe.
Example:
julia> df = fetch_data("ST001710");
julia> df[1:5,1:3]
5×3 DataFrame
Row │ Metabolite 1022385746 1022385747
│ String String String
─────┼─────────────────────────────────────────────
1 │ CE(16:0) + CE(18:1) 0.1062 -1.9080
2 │ CE(18:0) 0.2580 0.2774
3 │ CE(18:2) 1.0654 0.1419
4 │ CE(20:4) 0.7983 -0.3442
5 │ Cer(d18:1/23:0) 1.2658 0.9246MetabolomicsWorkbenchAPI.fetch_metabolites — Methodfetch_metabolites(studyname::String) => DataFrameReturn the dataframe of the metabolites' attributes of the study.
Example:
julia> df = fetch_metabolites("ST001710");
julia> df[1:5,1:3]
5×10 DataFrame
Row │ Metabolite pubchem_id inchi_key kegg_id other_id other_id_type ri ri_type moverz_quant
│ String String String String String String String String String String
─────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ CE(16:0) + CE(18:1) 9.12 369.351948452576
2 │ CE(18:0) 9.64 369.351943579901
3 │ CE(18:2) 8.71 369.351905113834
4 │ CE(20:4) 8.48 369.351992746797
5 │ Cer(d18:1/23:0) 7.78 636.630358494506MetabolomicsWorkbenchAPI.fetch_properties — Methodfetch_properties(metabolite_names::Vector{String}) => DataFrameReturns a data frame with the following information: exact mass, formula, main class, refmet name, sub class, super class.
Example:
julia> vNames = ["LPC(16:0p)", "PC(18:0p/18:1(9Z))", "CE(18:0)", "PC(O-32:1)", "TG(O-52:2)"];
julia> fetch_properties(vNames)
5×6 DataFrame
Row │ exactmass formula main_class refmet_name sub_class super_class
│ String? String? String String String String
─────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ 479.3376 C24H50NO6P Glycerophosphocholines LPC P-16:0 O-LPC Glycerophospholipids
2 │ missing missing Glycerophosphocholines PC P-18:0/18:1(9Z)* PC Glycerophospholipids
3 │ 652.6158 C45H80O2 Sterol esters CE 18:0 Chol. esters Sterol Lipids
4 │ 717.5672 C40H80NO7P Glycerophosphocholines PC O-32:1 O-PC Glycerophospholipids
5 │ missing missing Triradylglycerols TG O-52:2* O-TAG GlycerolipidsMetabolomicsWorkbenchAPI.fetch_samples — Methodfetch_samples(studyname::String) => DataFrameReturn the samples dataframe of the study.
Example:
julia> fetch_samples("ST001710")
627×15 DataFrame
Row │ Sample ID Data type NAFLD.Category T2DM Kleiner.Steatosis Inflammation Sex Sample_Data:Ballooning Kleiner.Fibrosis NAS Platelets.E10-9.per.L Liver.ALT Liver.AST AST.ALT.Ratio ⋯ │ String String String String String String String String String String String String String String ⋯─────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 1 │ 1022385746 Serum lipidomics 1 NA 1 - NA - - 1 235 173 248 1.43352601156069 ⋯ 2 │ 1022385747 Serum lipidomics 1 NA 1 1 NA - - 2 278 38 41 1.07894736842105
3 │ 1022385761 Serum lipidomics 1 NA 1 1 NA - - 2 246 22 27 1.22727272727273
4 │ 1022385792 Serum lipidomics 1 NA 1 3 NA - 1c 3 283 20 18 0.9
5 │ 1022385816 Serum lipidomics 1 NA 2 1 NA - - 3 280 NA NA NA ⋯ 6 │ 1022385825 Serum lipidomics 1 NA 2 1 NA - NA 3 252 116 69 0.594827586206897
⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋱ 622 │ 1022386897 Serum lipidomics NA Y NA NA NA NA NA NA 267 32 32 1
623 │ 1026694057 Serum lipidomics - N - - NA - - - NA 27 21 0.777777777777778
624 │ 1028937993 Serum lipidomics - N - - NA NA - NA NA 26 27 1.03846153846154 ⋯ 625 │ 1028939944 Serum lipidomics - N - - NA - - - 187 29 26 0.896551724137931
626 │ 1026694049 Serum lipidomics - Y - - NA - - - NA 18 20 1.11111111111111
627 │ 1022385827 Serum lipidomics 1 NA 1 1 NA - - 2 NA 35 22 0.628571428571429
5 columns and 615 rows omittedMetabolomicsWorkbenchAPI.fetch_study_info — Methodfetch_study_info(studyname::String) => DataFrameReturns a dataframe containing the available study information such as the study title, summary, institute name, total number of subjects and much more.
Example:
julia> df = fetch_study_info("ST000001");
julia> select(dftest, [:STUDY_TITLE, :INSTITUTE])
1×2 DataFrame
Row │ STUDY_TITLE INSTITUTE
│ String String
─────┼────────────────────────────────────────────────────────────────────
1 │ Fatb Induction Experiment (FatBI… University of California, Davis 5 columns and 615 rows omittedMetabolomicsWorkbenchAPI.fetch_total_subjects — Methodfetch_total_subjects(studyname::String) => IntegerReturn the total number of subjects of the study.
Example:
julia> fetch_total_subjects("ST001052")
51 5 columns and 615 rows omittedMetabolomicsWorkbenchAPI.filt_json — Methodfilt_json(s::String) => StringRemove any text before the first '{' in a string.
MetabolomicsWorkbenchAPI.fix_unbalanced_name — Methodfix_unbalanced_name(s::String) => StringRecursive function that fixes unbalanced parentheses in a string, and returns balanced string.
Example:
julia> my_s = "DG(18:1(/1(8:1)";
julia> fix_unbalanced_name(my_s)
"DG(18:1/18:1)"
julia> my_s = "DG(18:1/18:1))";
julia> fix_unbalanced_name(my_s)
"DG(18:1/18:1)"
julia> my_s = "DG(((((18:1/18:1))";
julia> fix_unbalanced_name(my_s)
"DG((18:1/18:1))" MetabolomicsWorkbenchAPI.get_output — Methodget_output(url::String) => StringGets output body from a URL.
MetabolomicsWorkbenchAPI.get_variables_names — Methodget_variable_names(vDF::Vector{DataFrame}) => Vector{String}Return the union variable names of all samples as a vector of String.
MetabolomicsWorkbenchAPI.json2df — Methodjson2df(s) => DataFrameConverts a string from a single JSON entry into a dataframe.
MetabolomicsWorkbenchAPI.mw_match — Methodmw_match(metabolite_name::String) => DataFrameStandardize metabolite name or PubChem/KEGG/HMDB/ChEBI/LIPID MAPS identifier to RefMet, and fetch refmet name, formula, exact mass, super class, main class, sub class.
Details:
The “match” input item performs a search against a customized synonym table in the database. The submitted synonyms are matched in a ‘fuzzy’ manner by dropping the following types of characters from the specified input value: <space>+-/(){}[]*";@. In addition, some common ion adduct suffixes (e.g. [M+H]+) are removed. The output item is ignored and the following output information is retrieved: refmetname, formula, exact mass, main class, sub class.
https://www.metabolomicsworkbench.org/tools/MWRestAPIv1.0.pdf
MetabolomicsWorkbenchAPI.mw_mwtab — Methodmw_mwtab(studyname::String; format = "json") => StringFetch the mwtab output for a study in json (default) or txt format.
MetabolomicsWorkbenchAPI.mw_url — Methodmw_url() => StringReturns the default Metabolomics Workbench REST API URL.
Example
julia> mw_url()
"https://www.metabolomicsworkbench.org/"MetabolomicsWorkbenchAPI.parse_json — Methodparse_json(s) => JSON3.ObjectRead JSON.
MetabolomicsWorkbenchAPI.url2df — Methodurl2df(url::String) => DataFrameGets the response from REST URL and converts a single JSON entry to dataframe