Functions
Index
MetabolomicsWorkbenchAPI.build_df_data
MetabolomicsWorkbenchAPI.check_mw
MetabolomicsWorkbenchAPI.fetch_data
MetabolomicsWorkbenchAPI.fetch_metabolites
MetabolomicsWorkbenchAPI.fetch_properties
MetabolomicsWorkbenchAPI.fetch_samples
MetabolomicsWorkbenchAPI.fetch_study_info
MetabolomicsWorkbenchAPI.fetch_total_subjects
MetabolomicsWorkbenchAPI.filt_json
MetabolomicsWorkbenchAPI.fix_unbalanced_name
MetabolomicsWorkbenchAPI.get_output
MetabolomicsWorkbenchAPI.get_variables_names
MetabolomicsWorkbenchAPI.json2df
MetabolomicsWorkbenchAPI.mw_match
MetabolomicsWorkbenchAPI.mw_mwtab
MetabolomicsWorkbenchAPI.mw_url
MetabolomicsWorkbenchAPI.parse_json
MetabolomicsWorkbenchAPI.url2df
Description
MetabolomicsWorkbenchAPI.build_df_data
— Methodbuild_df_data(vDF::Vector{DataFrame}) => DataFrame
It 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) => String
Checks 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.
200
MetabolomicsWorkbenchAPI.fetch_data
— Methodfetch_data(studyname::String) => DataFrame
Return 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.9246
MetabolomicsWorkbenchAPI.fetch_metabolites
— Methodfetch_metabolites(studyname::String) => DataFrame
Return 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.630358494506
MetabolomicsWorkbenchAPI.fetch_properties
— Methodfetch_properties(metabolite_names::Vector{String}) => DataFrame
Returns 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 Glycerolipids
MetabolomicsWorkbenchAPI.fetch_samples
— Methodfetch_samples(studyname::String) => DataFrame
Return 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 omitted
MetabolomicsWorkbenchAPI.fetch_study_info
— Methodfetch_study_info(studyname::String) => DataFrame
Returns 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 omitted
MetabolomicsWorkbenchAPI.fetch_total_subjects
— Methodfetch_total_subjects(studyname::String) => Integer
Return the total number of subjects of the study.
Example:
julia> fetch_total_subjects("ST001052")
51 5 columns and 615 rows omitted
MetabolomicsWorkbenchAPI.filt_json
— Methodfilt_json(s::String) => String
Remove any text before the first '{' in a string.
MetabolomicsWorkbenchAPI.fix_unbalanced_name
— Methodfix_unbalanced_name(s::String) => String
Recursive 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) => String
Gets 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) => DataFrame
Converts a string from a single JSON entry into a dataframe.
MetabolomicsWorkbenchAPI.mw_match
— Methodmw_match(metabolite_name::String) => DataFrame
Standardize 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") => String
Fetch the mwtab output for a study in json (default) or txt format.
MetabolomicsWorkbenchAPI.mw_url
— Methodmw_url() => String
Returns the default Metabolomics Workbench REST API URL.
Example
julia> mw_url()
"https://www.metabolomicsworkbench.org/"
MetabolomicsWorkbenchAPI.parse_json
— Methodparse_json(s) => JSON3.Object
Read JSON.
MetabolomicsWorkbenchAPI.url2df
— Methodurl2df(url::String) => DataFrame
Gets the response from REST URL and converts a single JSON entry to dataframe