Repository 'hmdb_ms_search'
hg clone https://toolshed.g2.bx.psu.edu/repos/fgiacomoni/hmdb_ms_search

Changeset 23:2d8a310e86ce (2022-05-19)
Previous changeset 22:453fbe98925a (2020-11-20) Next changeset 24:d8e2ede293a6 (2022-05-19)
Commit message:
Prod branch Updating with v.:CI_COMMIT_TAG- - Fxx
modified:
Dockerfile
README.md
README.txt
conf_hmdb.cfg
hmdb.tmpl
lib/conf.pm
lib/csv.pm
lib/hmdb.pm
static/images/hmdb.png
t/hmdb_managerTest.pl
t/lib/hmdbTest.pm
test-data/input_test01_fake-mzrt-input-with-id.tabular
test-data/input_test02_mzrt-input-with-id.tabular
test-data/out_test01.html
test-data/out_test01.tabular
test-data/out_test01.txt
test-data/out_test02.html
test-data/out_test02.tabular
test-data/out_test02.txt
test-data/out_test03.html
test-data/out_test03.tabular
test-data/out_test03.txt
test-data/out_test04.html
test-data/out_test04.tabular
test-data/out_test04.txt
wsdl_hmdb.pl
wsdl_hmdb.xml
b
diff -r 453fbe98925a -r 2d8a310e86ce lib/hmdb.pm
--- a/lib/hmdb.pm Fri Nov 20 17:29:18 2020 +0000
+++ b/lib/hmdb.pm Thu May 19 13:43:09 2022 +0000
[
b'@@ -21,8 +21,8 @@\n \r\n our $VERSION = "1.0";\r\n our @ISA = qw(Exporter);\r\n-our @EXPORT = qw( map_suppl_data_on_hmdb_results get_unik_ids_from_results get_hmdb_metabocard_from_id extract_sub_mz_lists test_matches_from_hmdb_ua prepare_multi_masses_query get_matches_from_hmdb_ua parse_hmdb_csv_results set_html_tbody_object add_mz_to_tbody_object add_entries_to_tbody_object write_html_skel set_lm_matrix_object set_hmdb_matrix_object_with_ids add_lm_matrix_to_input_matrix write_csv_skel write_csv_one_mass );\r\n-our %EXPORT_TAGS = ( ALL => [qw( map_suppl_data_on_hmdb_results get_unik_ids_from_results get_hmdb_metabocard_from_id extract_sub_mz_lists test_matches_from_hmdb_ua prepare_multi_masses_query get_matches_from_hmdb_ua parse_hmdb_csv_results set_html_tbody_object add_mz_to_tbody_object add_entries_to_tbody_object write_html_skel set_lm_matrix_object set_hmdb_matrix_object_with_ids add_lm_matrix_to_input_matrix write_csv_skel write_csv_one_mass )] );\r\n+our @EXPORT = qw( parseHmdb5CSVResults getMatchesFromHmdb5WithUA map_suppl_data_on_hmdb_results get_unik_ids_from_results get_hmdb_metabocard_from_id extract_sub_mz_lists test_matches_from_hmdb_ua prepare_multi_masses_query get_matches_from_hmdb_ua parse_hmdb_csv_results set_html_tbody_object add_mz_to_tbody_object add_entries_to_tbody_object write_html_skel set_lm_matrix_object set_hmdb_matrix_object_with_ids add_lm_matrix_to_input_matrix write_csv_skel write_csv_one_mass );\r\n+our %EXPORT_TAGS = ( ALL => [qw( parseHmdb5CSVResults getMatchesFromHmdb5WithUA map_suppl_data_on_hmdb_results get_unik_ids_from_results get_hmdb_metabocard_from_id extract_sub_mz_lists test_matches_from_hmdb_ua prepare_multi_masses_query get_matches_from_hmdb_ua parse_hmdb_csv_results set_html_tbody_object add_mz_to_tbody_object add_entries_to_tbody_object write_html_skel set_lm_matrix_object set_hmdb_matrix_object_with_ids add_lm_matrix_to_input_matrix write_csv_skel write_csv_one_mass )] );\r\n \r\n =head1 NAME\r\n \r\n@@ -273,7 +273,7 @@\n \r\n =head2 METHOD testMatchesFromHmdbWithUA\r\n \r\n-\t## Description : test a single query with tests parameters on hmdb - get the status of the complete server infra.\r\n+\t## Description : [DEPRECATED] test a single query with tests parameters on hmdb - get the status of the complete server infra.\r\n \t## Input : none\r\n \t## Output : $status_line\r\n \t## Usage : my ( $status_line ) = testMatchesFromHmdbWithUA( ) ;\r\n@@ -288,12 +288,14 @@\n     #based on https://stackoverflow.com/questions/17732916/perl-post-automation-and\r\n \r\n \tmy $mech = WWW::Mechanize->new(\r\n-\t\tagent => \'wonderbot for W4M 1.01\',\r\n-\t\tautocheck => 1,\t\r\n+#\t\tagent => \'wonderbot for W4M 1.01\',\r\n+\t\tagent => \'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:93.0) Gecko/20100101 Firefox/93.0\' ,\r\n+\t\tautocheck => 0,\r\n \t);\r\n \t\r\n \tmy $statusGetLine = 0 ;\r\n \tmy $statusPostLine = 0 ;\r\n+\tmy $csrftoken = undef ;\r\n \t\r\n \t#receiving cookies and authentication token (CFRS)\r\n \tmy $reqInit = $mech->get("http://www.hmdb.ca/spectra/ms/search");\r\n@@ -302,13 +304,23 @@\n \tif ($statusGetLine == 200 ) {\r\n \t\tdie \'no CSRF_REQUEST_TOKEN_VALUE in page found\'\r\n \t\tunless ($reqInit->decoded_content =~ /\\"csrf-token\\"\\s+content=\\"(.*)\\"/) ;\r\n-\t\tmy $csrftoken = $1;\r\n-#\t\tprint "\\nTOKEN: $csrftoken\\n" ;\r\n+\t\t$csrftoken = $1;\r\n+\t\tprint "\\nTOKEN: $csrftoken\\n" ;\r\n \t\t$mech->add_header("X-CSRFToken", $csrftoken);\r\n+\t\t$mech->add_header(\'Host\', \'specdb.wishartlab.com\');\r\n \t\t$mech->add_header(\'Connection\', \'keep-alive\');\r\n+\t\t$mech->add_header(\'Upgrade-Insecure-Requests\', \'1\');\r\n \t\t$mech->add_header(\'Content-Type\', \'application/x-www-form-urlencoded\');\r\n-\t\t$mech->add_header(\'Referer\', \'http://www.hmdb.ca/spectra/ms/search\');\r\n-\t\t$mech->add_header(\'Accept\', \'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\');\r\n+\t\t$mech->add_header(\'Accept-Language\', \'en-US,en;q=0.5\');\r\n+\t\t$mech->add_header(\'Accept-Encoding\', \'gzip, deflate\');\r\n+#\t\t$mech->add_header(\'Content-Length\', "300");\r\n+\t\t$mech->add_header(\'Origin\', \'null\');\r\n+\t\t$mech->add_header(\'DNT\', \'1\');\r\n+\t\t$me'..b'## Description : parse the csv results and get data - API 5.0 compliant\r\n+\t## Input : $csv\r\n+\t## Output : $results\r\n+\t## Usage : my ( $results ) = parseHmdb5CSVResults( $csv ) ;\r\n+\t\r\n+=cut\r\n+## START of SUB\r\n+sub parseHmdb5CSVResults {\r\n+\t## Retrieve Values\r\n+    my $self = shift ;\r\n+    my ( $csv, $masses, $max_query ) = @_ ;\r\n+    \r\n+    my $test = 0 ;\r\n+    my ($query_mass,$compound_id,$formula,$compound_mass,$adduct,$adduct_type,$adduct_mass,$delta) = (0, undef, undef, undef, undef, undef, undef, undef) ;\r\n+    \r\n+    my %result_by_entry = () ;\r\n+    my %features = () ;\r\n+    \r\n+#    print Dumper $csv ;\r\n+#    print Dumper $masses ;\r\n+#    print Dumper $max_query ;\r\n+    \r\n+    foreach my $line (@{$csv}) {\r\n+    \t## NEW HMDB format V5.0 - May2022\r\n+\t\tif ($line !~ /query_mass,compound_id,compound_name,formula,monoisotopic_mass,adduct,adduct_type,adduct_m\\/z,"delta\\(ppm\\),",ccs_value/) {\r\n+\t\t\t#query_mass,compound_id,compound_name,formula,monoisotopic_mass,adduct,adduct_type,adduct_m/z,"delta(ppm),",ccs_value\',\r\n+    \t\t\r\n+    \t\tif ( $line =~ /(\\d+\\.\\d+),(\\w+),(.*),(\\w+),(\\d+\\.\\d+),([\\w|n\\/a|\\s+]+)\\s*,(\\+|\\-),(\\d+\\.\\d+),(\\d+),(\\d*)/   ) {\r\n+    \t\t\tprint "$line\\n" ;\r\n+    \t\t#if ( $line =~ /(\\d+\\.\\d+),(\\w+),(.*),([\\w|n\\/a|\\s+]+)\\s*,(\\w+),(\\d+\\.\\d+),(.*),(\\+|\\-),(\\d+\\.\\d+),(\\d+)/  ) {\r\n+    \t\t\tmy @entry = ("$1","$2","$3","$4","$5","$6","$7","$8","$9","$10") ;\r\n+\r\n+    \t\t\tif ( !exists $result_by_entry{$entry[0]} ) { $result_by_entry{$entry[0]} = [] ; }\r\n+    \t\t\t    \t\t\r\n+\t    \t\t$features{ENTRY_ENTRY_ID} = $entry[1] ;\r\n+\t    \t\t$features{ENTRY_ENTRY_NAME} = $entry[2] ;\r\n+\t    \t\t$features{ENTRY_FORMULA} = $entry[3] ;\r\n+\t    \t\t$features{ENTRY_CPD_MZ} = $entry[4] ;\r\n+\t    \t\t$features{ENTRY_ADDUCT} = $entry[5] ;\r\n+\t    \t\t$features{ENTRY_ADDUCT_TYPE} = $entry[6] ;\r\n+\t    \t\t$features{ENTRY_ADDUCT_MZ} = $entry[7] ;\r\n+\t    \t\t$features{ENTRY_DELTA} = $entry[8] ;\r\n+\t    \t\t\r\n+\t    \t\tmy %temp = %features ;\r\n+\t    \t\tpush (@{$result_by_entry{$entry[0]} }, \\%temp) ;\r\n+    \t\t}\r\n+#    \t\telsif ($line =~ /(\\d+\\.\\d+)/) { #\r\n+#    \t\t\t## 288.082286511284,HMDB0002255,R-Methylmalonyl-CoA, C01213 ,C25H40N7O19P3S,867.131252359,M-3H,-,288.036475,159\r\n+#    \t\t\t## 283.108004472276,"Bicyclo_3,1,1heptane-2,3-diol,2,6,6_trimethyl","2,3-Pinanediol",n/a,C10H18O2,170.13067982,M+TFA-H,-,283.116266,29\r\n+#    \t\t\t## 174.034120330029,HMDB0011723,2-Methylhippuric acid,\t C01586,C10H11NO3,193.073893223,M-H20-H,-,174.055503,123\r\n+#    \t\t\t## 193.139160745841,HMDB0012109,"7-[(1R,2R,3R,5S)-3,5-Dihydroxy-2-[(1E,3S)-3-hydroxyoct-1-en-1-yl]cyclopentyl]-5,6-dihydroxyheptanoic acid", C06475,C20H36O7,388.246103506,M-2H,-,193.115776,121\r\n+#    \t\t\t## 214.018826827064,HMDB0011723,2-Methylhippuric acid,\t C01586,C10H11NO3,193.073893223,M+Na-2H,-,214.048559,139\r\n+#    \t\t}\r\n+#    \t\telse {\r\n+#    \t\t\t\r\n+#    \t\t\twarn "The parsed line ($line) does not match your pattern\\n " ;\r\n+#    \t\t}\r\n+    \t}\r\n+    \telse {\r\n+    \t\tprint "Header detected...Parsing is starting...\\n" ;\r\n+    \t\tnext ;\r\n+    \t}\r\n+    } ## end foreach\r\n+    \r\n+    ## manage per query_mzs (keep query masses order by array)\r\n+    my @results = () ;\r\n+    foreach (@{$masses}) {\r\n+    \tif ($result_by_entry{$_}) { \r\n+    \t\r\n+    \t\t## cut all entries > $max_query\t- all entries were already sorted...by hmdb\r\n+    \t\tmy @temp_entries = @{$result_by_entry{$_}} ;\r\n+    \t\tmy @temp_cut = () ;\r\n+    \t\tmy $current_query = 0 ;\r\n+    \t\tforeach (@temp_entries) {\r\n+    \t\t\t$current_query ++ ;\r\n+    \t\t\tif ($current_query > $max_query) {\r\n+    \t\t\t\tlast ;\r\n+    \t\t\t}\r\n+    \t\t\telse {\r\n+    \t\t\t\tpush (@temp_cut, $_) ;\r\n+    \t\t\t}\t\r\n+    \t\t}\r\n+    \t\tpush (@results, \\@temp_cut) ; \r\n+    \t}\r\n+    \telse { push (@results, [] ) ; } ;\r\n+\r\n+    }\r\n+    return(\\@results) ;\r\n+}\r\n+## END of SUB\r\n+\r\n \r\n =head2 METHOD parse_hmdb_csv_results\r\n \r\n-\t## Description : parse the csv results and get data\r\n+\t## Description : [DEPRECATED] parse the csv results and get data\r\n \t## Input : $csv\r\n \t## Output : $results\r\n \t## Usage : my ( $results ) = parse_hmdb_csv_results( $csv ) ;\r\n'
b
diff -r 453fbe98925a -r 2d8a310e86ce t/hmdb_managerTest.pl
--- a/t/hmdb_managerTest.pl Fri Nov 20 17:29:18 2020 +0000
+++ b/t/hmdb_managerTest.pl Thu May 19 13:43:09 2022 +0000
[
b'@@ -43,68 +43,36 @@\n \t\t[\'175.01\', \'238.19\', \'420.16\', \'780.32\', \'956.25\', \'1100.45\' ] ), \n \t\t\'175.01%0D%0A238.19%0D%0A420.16%0D%0A780.32%0D%0A956.25%0D%0A1100.45%0D%0A\', \n \t\t\'Method \\\'prepare_multi_masses_query\\\' works with a list of and return a well formated string for hmdb querying\');\n-\t\t\n+\t\n \tprint "\\n** Test $current_test get_matches_from_hmdb_ua with a well-formated string of mzs **\\n" ; $current_test++;\n-\tis_deeply( get_matches_from_hmdb_uaTest(\n+\tis_deeply( getMatchesFromHmdb5WithUATest(\n \t\t\'175.01%0D%0A420.16%0D%0A780.32%0D%0A956.25%0D%0A1100.45%0D%0A\', 0.001, \'positive\'),\n \t\t[\n-          \'query_mass,compound_id,compound_name,kegg_id,formula,monoisotopic_mass,adduct,adduct_type,adduct_m/z,delta(ppm)\',\n-#          \'175.01,HMDB60293,H2O3S2,113.94453531,M+IsoProp+H,+,175.009875,0.000125\',\n-#          \'175.01,HMDB03745,C2H6O3S2,141.975835438,M+CH3OH+H,+,175.009324,0.000676\',\n-#          \'175.01,HMDB31436,H4O4Si,95.987885149,M+DMSO+H,+,175.009105,0.000895\',\n-#          \'175.01,HMDB33657,C17H10O6,310.047738052,M+H+K,+,175.009086,0.000914\',\n-#          \'175.01,HMDB35230,C17H10O6,310.047738052,M+H+K,+,175.009086,0.000914\',\n-#          \'420.16,HMDB60838,C17H17N3O4S,359.093976737,M+IsoProp+H,+,420.159317,0.000683\',\n-#          \'420.16,HMDB60836,C17H17N3O4S,359.093976737,M+IsoProp+H,+,420.159317,0.000683\'\n-\t\t\t## Update format - 2018-01-19... HMDB V04\n-#\t\t\t\'175.01,HMDB0060293,Hydroxidodioxidosulfidosulfate,C05529,H2O3S2,113.94453531,M+IsoProp+H,+,175.009875,1\',\n-#\t\t\t\'175.01,HMDB0003745,Mesna,C03576,C2H6O3S2,141.975835438,M+CH3OH+H,+,175.009324,4\',\n-#\t\t\t\'175.01,HMDB0031436,Silicic acid,n/a,H4O4Si,95.987885149,M+DMSO+H,+,175.009105,5\',\n-#\t\t\t\'175.01,HMDB0033657,De-o-methylsterigmatocystin,C03683,C17H10O6,310.047738052,M+H+K,+,175.009086,5\',\n-#\t\t\t\'175.01,HMDB0035230,"6,7-Dihydroxy-3-(4-hydroxyphenyl)furo[3,2-b]chromen-2-one",n/a,C17H10O6,310.047738052,M+H+K,+,175.009086,5\',\n-#\t\t\t\'420.16,HMDB0060838,"4-hydroxy-5-[(4-{2-[(5-hydroxy-1,2-dihydropyridin-2-ylidene)amino]ethoxy}phenyl)methyl]-2,5-dihydro-1,3-thiazol-2-one",n/a,C17H17N3O4S,359.093976737,M+IsoProp+H,+,420.159317,2\',\n-#\t\t\t\'420.16,HMDB0060836,N-Desmethyl O-hydroxyrosiglitazone,n/a,C17H17N3O4S,359.093976737,M+IsoProp+H,+,420.159317,2\',\n-\t\t\t## Update results - 2018-09-20... HMDBv4\n-\t\t\t#\'query_mass,compound_id,compound_name,kegg_id,formula,monoisotopic_mass,adduct,adduct_type,adduct_m/z,delta(ppm)\',\n-          \'175.01,HMDB0149376,"2-{[5,6-dihydroxy-3-(4-hydroxyphenyl)-4-oxo-3,4-dihydro-2H-1-benzopyran-7-yl]oxy}-3-(sulfooxy)butanedioic acid",n/a,C19H16O14S,500.026076369,M+2H+Na,+,175.009949,0\',\n-          \'175.01,HMDB0149375,"2-({5,6-dihydroxy-4-oxo-3-[4-(sulfooxy)phenyl]-3,4-dihydro-2H-1-benzopyran-7-yl}oxy)-3-hydroxybutanedioic acid",n/a,C19H16O14S,500.026076369,M+2H+Na,+,175.009949,0\',\n-          \'175.01,HMDB0149419,"2-{[5,8-dihydroxy-3-(4-hydroxyphenyl)-4-oxo-3,4-dihydro-2H-1-benzopyran-7-yl]oxy}-3-(sulfooxy)butanedioic acid",n/a,C19H16O14S,500.026076369,M+2H+Na,+,175.009949,0\',\n-          \'175.01,HMDB0149418,"2-({5,8-dihydroxy-4-oxo-3-[4-(sulfooxy)phenyl]-3,4-dihydro-2H-1-benzopyran-7-yl}oxy)-3-hydroxybutanedioic acid",n/a,C19H16O14S,500.026076369,M+2H+Na,+,175.009949,0\',\n-          \'175.01,HMDB0149392,"2-{[3-(3,4-dihydroxyphenyl)-5-hydroxy-4-oxo-3,4-dihydro-2H-1-benzopyran-7-yl]oxy}-3-(sulfooxy)butanedioic acid",n/a,C19H16O14S,500.026076369,M+2H+Na,+,175.009949,0\',\n-          \'175.01,HMDB0149391,"2-hydroxy-3-({5-hydroxy-3-[4-hydroxy-3-(sulfooxy)phenyl]-4-oxo-3,4-dihydro-2H-1-benzopyran-7-yl}oxy)butanedioic acid",n/a,C19H16O14S,500.026076369,M+2H+Na,+,175.009949,0\',\n-          \'175.01,HMDB0000257,Thiosulfate,C05529,H2O3S2,113.94453531,M+IsoProp+H,+,175.009875,1\',\n-          \'175.01,HMDB0060293,Thiosulfate,C05529,H2O3S2,113.94453531,M+IsoProp+H,+,175.009875,1\',\n-          \'175.01,HMDB0141391,{4-[(1E)-3-oxo-3-phenylprop-1-en-1-yl]phenyl}oxidanesulfonic acid,n/a,C15H12O5S,304.04054466,M+2Na,+,175.00949,3\',\n-          \'175.01,HMDB0141389,{3-[(1E)-3-oxo-3-phenylprop-1-en-1-yl]phen'..b'\t\t[ [], [], [] ],\n+#\t\t\'Method \\\'parse_hmdb_csv_results\\\' works with a empty csv output and returns an empty but well formatted array\' ) ;\n+#\t\n+#\tprint "\\n** Test $current_test parse_hmdb_csv_results with a void hmdb output and a void mz list  **\\n" ; $current_test++;\n+#\tis_deeply ( parse_hmdb_csv_resultsTest ( [], [] ),\n+#\t\t[],\n+#\t\t\'Method \\\'parse_hmdb_csv_results\\\' works with a empty csv output/mz list and returns an empty but well formatted array\' ) ;\n+#\n+#\t## Other example... from mz 265.0567515\n+#\tprint "\\n** Test $current_test parse_hmdb_csv_results with mz 265.0567515 and the correct inputs for hmdb outputs parsing (csv format) **\\n" ; $current_test++;\n+#\tis_deeply ( parse_hmdb_csv_resultsTest (\n+#\t\t[\n+#        \'query_mass,compound_id,compound_name,kegg_id,formula,monoisotopic_mass,adduct,adduct_type,adduct_m/z,delta(ppm)\',\n+#\t\t\'265.0567515,HMDB0059667,3-Methylsulfolene,n/a,C5H8O2S,132.02450019,2M+H,+,265.056276,2\',\n+#\t\t\'265.0567515,HMDB0038767,Camelliaside b,n/a,C32H38O19,726.200729034,M+3Na,+,265.056128,2\',\n+#\t\t\'265.0567515,HMDB0039759,Kaempferol 3-(2g-apiosylrobinobioside),n/a,C32H38O19,726.200729034,M+3Na,+,265.056128,2\',\n+#\t\t\'265.0567515,HMDB0040875,Isoschaftoside 4\\\'-glucoside,n/a,C32H38O19,726.200729034,M+3Na,+,265.056128,2\',\n+#\t\t\'265.0567515,HMDB0040878,Schaftoside 4\\\'-glucoside,n/a,C32H38O19,726.200729034,M+3Na,+,265.056128,2\',\n+#\t\t\'265.0567515,HMDB0059600,erythro-5-Phosphonooxy-L-lysine,C03366,C6H15N2O6P,242.066772734,M+Na,+,265.055991,3\',\n+#\t\t\'265.0567515,HMDB0061174,"2,4-Imidazolidinedione, 3-ethyl-5-(4-hydroxyphenyl)-",n/a,C11H12N2O3,220.08479226,M+2Na-H,+,265.055952,3\',\n+#\t\t\'265.0567515,HMDB0015571,Oxitriptan,C00643,C11H12N2O3,220.08479226,M+2Na-H,+,265.055952,3\',\n+#\t\t\'265.0567515,HMDB0000472,5-hydroxy-l-tryptophan,C01017,C11H12N2O3,220.08479226,M+2Na-H,+,265.055952,3\',\n+#\t\t\'265.0567515,HMDB0030584,Silidianin,n/a,C25H24O10,484.136946988,M+2Na,+,265.057691,4\',\n+#        ],\n+#        [\'265.0567515\'],\n+#        5\n+#\t),\n+#\t\t[\n+#          [\n+#            {\n+#              \'ENTRY_DELTA\' => \'2\',\n+#              \'ENTRY_FORMULA\' => \'C5H8O2S\',\n+#              \'ENTRY_ENTRY_ID\' => \'HMDB0059667\',\n+#              \'ENTRY_ADDUCT_MZ\' => \'265.056276\',\n+#              \'ENTRY_ADDUCT_TYPE\' => \'+\',\n+#              \'ENTRY_CPD_MZ\' => \'132.02450019\',\n+#              \'ENTRY_ADDUCT\' => \'2M+H\'\n+#            },\n+#            {\n+#              \'ENTRY_ADDUCT_MZ\' => \'265.056128\',\n+#              \'ENTRY_ENTRY_ID\' => \'HMDB0038767\',\n+#              \'ENTRY_ADDUCT_TYPE\' => \'+\',\n+#              \'ENTRY_CPD_MZ\' => \'726.200729034\',\n+#              \'ENTRY_ADDUCT\' => \'M+3Na\',\n+#              \'ENTRY_DELTA\' => \'2\',\n+#              \'ENTRY_FORMULA\' => \'C32H38O19\'\n+#            },\n+#            {\n+#              \'ENTRY_DELTA\' => \'2\',\n+#              \'ENTRY_FORMULA\' => \'C32H38O19\',\n+#              \'ENTRY_ENTRY_ID\' => \'HMDB0039759\',\n+#              \'ENTRY_ADDUCT_MZ\' => \'265.056128\',\n+#              \'ENTRY_ADDUCT_TYPE\' => \'+\',\n+#              \'ENTRY_CPD_MZ\' => \'726.200729034\',\n+#              \'ENTRY_ADDUCT\' => \'M+3Na\'\n+#            },\n+#            {\n+#              \'ENTRY_FORMULA\' => \'C32H38O19\',\n+#              \'ENTRY_DELTA\' => \'2\',\n+#              \'ENTRY_ADDUCT_TYPE\' => \'+\',\n+#              \'ENTRY_ADDUCT_MZ\' => \'265.056128\',\n+#              \'ENTRY_ENTRY_ID\' => \'HMDB0040875\',\n+#              \'ENTRY_CPD_MZ\' => \'726.200729034\',\n+#              \'ENTRY_ADDUCT\' => \'M+3Na\'\n+#            },\n+#            {\n+#              \'ENTRY_ADDUCT_TYPE\' => \'+\',\n+#              \'ENTRY_ENTRY_ID\' => \'HMDB0040878\',\n+#              \'ENTRY_ADDUCT_MZ\' => \'265.056128\',\n+#              \'ENTRY_ADDUCT\' => \'M+3Na\',\n+#              \'ENTRY_CPD_MZ\' => \'726.200729034\',\n+#              \'ENTRY_FORMULA\' => \'C32H38O19\',\n+#              \'ENTRY_DELTA\' => \'2\'\n+#            }\n+#          ]\n+#        ],\n+#\t\t\'Method \\\'parse_hmdb_csv_results\\\' works with a well-formated csv output and returns a a well formated array\' ) ;\t\n+#\t\t\n+#\t\n \n-\n-\n-\n-\n-\n-\n-\n+}\n ## END of the script\n\\ No newline at end of file\n'
b
diff -r 453fbe98925a -r 2d8a310e86ce t/lib/hmdbTest.pm
--- a/t/lib/hmdbTest.pm Fri Nov 20 17:29:18 2020 +0000
+++ b/t/lib/hmdbTest.pm Thu May 19 13:43:09 2022 +0000
[
@@ -8,8 +8,8 @@
 
 our $VERSION = "1.0";
 our @ISA = qw(Exporter);
-our @EXPORT = qw( parse_hmdb_csv_resultsTest check_state_from_hmdb_uaTest test_matches_from_hmdb_uaTest extract_sub_mz_listsTest prepare_multi_masses_queryTest get_matches_from_hmdb_uaTest);
-our %EXPORT_TAGS = ( ALL => [qw( parse_hmdb_csv_resultsTest check_state_from_hmdb_uaTest test_matches_from_hmdb_uaTest extract_sub_mz_listsTest prepare_multi_masses_queryTest get_matches_from_hmdb_uaTest)] );
+our @EXPORT = qw( testMatchesFromHmdb5WithUATest parseHmdb5CSVResultsTest getMatchesFromHmdb5WithUATest parse_hmdb_csv_resultsTest check_state_from_hmdb_uaTest test_matches_from_hmdb_uaTest extract_sub_mz_listsTest prepare_multi_masses_queryTest get_matches_from_hmdb_uaTest);
+our %EXPORT_TAGS = ( ALL => [qw( testMatchesFromHmdb5WithUATest parseHmdb5CSVResultsTest getMatchesFromHmdb5WithUATest parse_hmdb_csv_resultsTest check_state_from_hmdb_uaTest test_matches_from_hmdb_uaTest extract_sub_mz_listsTest prepare_multi_masses_queryTest get_matches_from_hmdb_uaTest)] );
 
 use lib '/Users/fgiacomoni/Inra/labs/perl/galaxy_tools/hmdb' ;
 use lib::hmdb qw( :ALL ) ;
@@ -49,6 +49,17 @@
  return ($hmdb_pages) ;
 }
 
+## sub
+sub getMatchesFromHmdb5WithUATest {
+
+ my ( $hmdb_masses, $delta, $molecular_species ) = @_ ;
+
+ my $oHmdb = lib::hmdb->new() ;
+ my ($hmdb_pages, $status) = $oHmdb->getMatchesFromHmdb5WithUA($hmdb_masses, $delta, $molecular_species) ;
+ print Dumper $hmdb_pages ;
+ return ($hmdb_pages) ;
+}
+
 
 ## sub
 sub test_matches_from_hmdb_uaTest {
@@ -58,6 +69,13 @@
  return ($status) ;
 }
 
+## sub
+sub testMatchesFromHmdb5WithUATest {
+
+ my $oHmdb = lib::hmdb->new() ;
+ my $status = $oHmdb->testMatchesFromHmdb5WithUA() ;
+ return ($status) ;
+}
 
 ## sub
 sub check_state_from_hmdb_uaTest {
@@ -69,6 +87,15 @@
 }
 
 
+## sub
+sub parseHmdb5CSVResultsTest {
+ my ($hmdb_pages, $mzs, $max ) = @_ ;
+
+ my $oHmdb = lib::hmdb->new() ;
+ my $result = $oHmdb->parseHmdb5CSVResults($hmdb_pages, $mzs, $max) ; ## hash format result
+ #print Dumper $result ;
+ return($result) ;
+}
 
 ## sub
 sub parse_hmdb_csv_resultsTest {
b
diff -r 453fbe98925a -r 2d8a310e86ce wsdl_hmdb.pl
--- a/wsdl_hmdb.pl Fri Nov 20 17:29:18 2020 +0000
+++ b/wsdl_hmdb.pl Thu May 19 13:43:09 2022 +0000
b
@@ -49,7 +49,7 @@
  "output_tabular:s" => \$out_tab, ## option : path to the ouput (tabular : input+results )
  "output_html|v:s" => \$out_html, ## option : path to the results view (output2)
  "output_xlsx:s" => \$out_xls, ## option : path to the xls-like format output
- "advancedFeatures:i"=> \$advancedFeatures, ## option : set to 1 to get advanced options or 0 to get first level only.
+ #"advancedFeatures:i"=> \$advancedFeatures, ## option : set to 1 to get advanced options or 0 to get first level only.
  "verbose:i" => \$VERBOSE, ## VERBOSE Of the tool
             ) ;
 
@@ -137,7 +137,7 @@
  print "\tand ".scalar(@$masses)." masses are submitted as ".scalar(@$submasses)." queries to HMDB \n\n" if ($VERBOSE>1) ;
 
  ## get the hmdb server status by a test query - continuous queries or kill script.
- $status = $oHmdb->testMatchesFromHmdbWithUA() ;
+ $status = $oHmdb->testMatchesFromHmdb5WithUA() ;
  $oHmdb->check_state_from_hmdb_ua($status) ; ## can kill the script execution
 
  my $cluster = 1 ;
@@ -151,7 +151,7 @@
 
  print "\n\tSubmission of m/z cluster ".sprintf '%04s',$cluster."" if ($VERBOSE>1) ;
 
- ($hmdb_pages, $status) = $oHmdb->getMatchesFromHmdbWithUA($hmdb_masses, $delta, $molecular_species, $hmdb_adducts) ;
+ ($hmdb_pages, $status) = $oHmdb->getMatchesFromHmdb5WithUA($hmdb_masses, $delta, $molecular_species, $hmdb_adducts) ;
  print "...HMDB reply results with status: $status\n" if ($VERBOSE>1) ;
 
 # print Dumper $hmdb_pages ;
@@ -160,7 +160,7 @@
 
  ## hard modification with $max_query fixed at 1000 !!! Need to be refactoring
  ## Cutof will be done in next method after URI check
- ($result) = $oHmdb->parse_hmdb_csv_results($hmdb_pages, $mzs, 1000) ; ## hash format result
+ ($result) = $oHmdb->getMatchesFromHmdb5WithUA($hmdb_pages, $mzs, 1000) ; ## hash format result
 
  ## This previous step return results with cutoff on the number of entries returned !
 
@@ -215,6 +215,10 @@
  my ($tbody_object) = $oHtml->set_html_tbody_object( $nb_pages_for_html_out, $CONF->{HTML_ENTRIES_PER_PAGE} ) ;
  ($tbody_object) = $oHtml->add_mz_to_tbody_object($tbody_object, $CONF->{HTML_ENTRIES_PER_PAGE}, $masses, $ids) ;
  ($tbody_object) = $oHtml->add_entries_to_tbody_object($tbody_object, $CONF->{HTML_ENTRIES_PER_PAGE}, $masses, $results) ;
+
+ print Dumper $tbody_object ;
+
+
  my $output_html = $oHtml->write_html_skel(\$out_html, $tbody_object, $nb_pages_for_html_out, $search_condition, $CONF->{'HTML_TEMPLATE'}, $CONF->{'JS_GALAXY_PATH'}, $CONF->{'CSS_GALAXY_PATH'}) ;
 
 } ## END IF
@@ -305,7 +309,7 @@
 
 =head1 SYNOPSIS
 
-This script manages batch queries on HMDB server. 
+This script manages batch queries on HMDB server (v5.0). 
 
 =head1 DESCRIPTION
 
@@ -343,4 +347,6 @@
 
 version 1.6.1 : 30 / 01 / 2019 - Adding adducts and fixxing minors bugs and requirements
 
+version 1.7.0 : 19/ 05 / 2022 - Update HMDB API client - compliant with HMDB 5.0 web portal
+
 =cut
\ No newline at end of file
b
diff -r 453fbe98925a -r 2d8a310e86ce wsdl_hmdb.xml
--- a/wsdl_hmdb.xml Fri Nov 20 17:29:18 2020 +0000
+++ b/wsdl_hmdb.xml Thu May 19 13:43:09 2022 +0000
b
@@ -1,4 +1,4 @@
-<tool id="wsdl_hmdb" name="HMDB MS search" version="1.6.1">
+<tool id="wsdl_hmdb" name="HMDB MS search" version="1.7.0">
   <description>
         search by masses on HMDB online LCMS bank
   </description>
@@ -243,7 +243,7 @@
 
 .. class:: infomark
 
-**Authors** Marion Landi and Franck Giacomoni
+**Authors** Marion Landi, Yann Guitton and Franck Giacomoni
 
 ---------------------------------------------------
 
@@ -252,6 +252,7 @@
 **Please cite** If you use this tool, please add the following reference
   | Wishart DS, Jewison T, Guo AC, Wilson M, Knox C, et al., HMDB 3.0 — The Human Metabolome Database in 2013. Nucleic Acids Res. 2013.
   | Wishart DS, Feunang YD, Marcu A, Guo AC, Liang K, et al., HMDB 4.0 — The Human Metabolome Database for 2018. Nucleic Acids Res. 2018.
+  | Wishart DS et al, HMDB 5.0 - the Human Metabolome Database for 2022, Nucleic Acids Res. 2022.
 
 
 ---------------------------------------------------
@@ -376,7 +377,7 @@
 
 .. class:: warningmark
 
-And their "W4M courses 2018":
+And their "W4M courses 2021":
  | Using Galaxy4Metabolomics - W4M table format for Galaxy
  | Annotation Banks - Annotation  
 
@@ -386,5 +387,6 @@
   <citations>
     <citation type="doi">10.1093/nar/gks1065</citation>
     <citation type="doi">10.1093/nar/gkx1089</citation>
+    <citation type="doi">10.1093/nar/gkab1062</citation>
   </citations>
 </tool>
\ No newline at end of file