comparison t/hmdb_managerTest.pl @ 10:4eb2de7c24d1 draft

Master branch Updating - - Fxx
author fgiacomoni
date Mon, 01 Oct 2018 10:36:30 -0400
parents c32280662103
children 2d8a310e86ce
comparison
equal deleted inserted replaced
9:c32280662103 10:4eb2de7c24d1
45 'Method \'prepare_multi_masses_query\' works with a list of and return a well formated string for hmdb querying'); 45 'Method \'prepare_multi_masses_query\' works with a list of and return a well formated string for hmdb querying');
46 46
47 print "\n** Test $current_test get_matches_from_hmdb_ua with a well-formated string of mzs **\n" ; $current_test++; 47 print "\n** Test $current_test get_matches_from_hmdb_ua with a well-formated string of mzs **\n" ; $current_test++;
48 is_deeply( get_matches_from_hmdb_uaTest( 48 is_deeply( get_matches_from_hmdb_uaTest(
49 '175.01%0D%0A420.16%0D%0A780.32%0D%0A956.25%0D%0A1100.45%0D%0A', 0.001, 'positive'), 49 '175.01%0D%0A420.16%0D%0A780.32%0D%0A956.25%0D%0A1100.45%0D%0A', 0.001, 'positive'),
50 [
51 'query_mass,compound_id,compound_name,kegg_id,formula,monoisotopic_mass,adduct,adduct_type,adduct_m/z,delta(ppm)',
52 # '175.01,HMDB60293,H2O3S2,113.94453531,M+IsoProp+H,+,175.009875,0.000125',
53 # '175.01,HMDB03745,C2H6O3S2,141.975835438,M+CH3OH+H,+,175.009324,0.000676',
54 # '175.01,HMDB31436,H4O4Si,95.987885149,M+DMSO+H,+,175.009105,0.000895',
55 # '175.01,HMDB33657,C17H10O6,310.047738052,M+H+K,+,175.009086,0.000914',
56 # '175.01,HMDB35230,C17H10O6,310.047738052,M+H+K,+,175.009086,0.000914',
57 # '420.16,HMDB60838,C17H17N3O4S,359.093976737,M+IsoProp+H,+,420.159317,0.000683',
58 # '420.16,HMDB60836,C17H17N3O4S,359.093976737,M+IsoProp+H,+,420.159317,0.000683'
59 ## Update format - 2018-01-19... HMDB V04
60 # '175.01,HMDB0060293,Hydroxidodioxidosulfidosulfate,C05529,H2O3S2,113.94453531,M+IsoProp+H,+,175.009875,1',
61 # '175.01,HMDB0003745,Mesna,C03576,C2H6O3S2,141.975835438,M+CH3OH+H,+,175.009324,4',
62 # '175.01,HMDB0031436,Silicic acid,n/a,H4O4Si,95.987885149,M+DMSO+H,+,175.009105,5',
63 # '175.01,HMDB0033657,De-o-methylsterigmatocystin,C03683,C17H10O6,310.047738052,M+H+K,+,175.009086,5',
64 # '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',
65 # '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',
66 # '420.16,HMDB0060836,N-Desmethyl O-hydroxyrosiglitazone,n/a,C17H17N3O4S,359.093976737,M+IsoProp+H,+,420.159317,2',
67 ## Update results - 2018-09-20... HMDBv4
68 #'query_mass,compound_id,compound_name,kegg_id,formula,monoisotopic_mass,adduct,adduct_type,adduct_m/z,delta(ppm)',
69 '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',
70 '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',
71 '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',
72 '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',
73 '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',
74 '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',
75 '175.01,HMDB0000257,Thiosulfate,C05529,H2O3S2,113.94453531,M+IsoProp+H,+,175.009875,1',
76 '175.01,HMDB0060293,Thiosulfate,C05529,H2O3S2,113.94453531,M+IsoProp+H,+,175.009875,1',
77 '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',
78 '175.01,HMDB0141389,{3-[(1E)-3-oxo-3-phenylprop-1-en-1-yl]phenyl}oxidanesulfonic acid,n/a,C15H12O5S,304.04054466,M+2Na,+,175.00949,3',
79 '175.01,HMDB0135622,{4-[(2E)-3-phenylprop-2-enoyl]phenyl}oxidanesulfonic acid,n/a,C15H12O5S,304.04054466,M+2Na,+,175.00949,3',
80 '175.01,HMDB0135448,{3-[(2E)-3-phenylprop-2-enoyl]phenyl}oxidanesulfonic acid,n/a,C15H12O5S,304.04054466,M+2Na,+,175.00949,3',
81 '175.01,HMDB0240280,Methanesulfonic acid,C11145,CH4O3S,95.988114684,M+DMSO+H,+,175.009335,4',
82 '175.01,HMDB0003745,Coenzyme m,C03576,C2H6O3S2,141.975835438,M+CH3OH+H,+,175.009324,4',
83 '175.01,HMDB0142159,[2-hydroxy-2-(2-hydroxyphenyl)-1-phenylethoxy]sulfonic acid,n/a,C14H14O6S,310.051109345,M+H+K,+,175.010772,4',
84 '175.01,HMDB0142160,[2-hydroxy-1-(2-hydroxyphenyl)-2-phenylethoxy]sulfonic acid,n/a,C14H14O6S,310.051109345,M+H+K,+,175.010772,4',
85 '175.01,HMDB0142162,"[3-(1,2-dihydroxy-2-phenylethyl)phenyl]oxidanesulfonic acid",n/a,C14H14O6S,310.051109345,M+H+K,+,175.010772,4',
86 '175.01,HMDB0142166,"[4-(1,2-dihydroxy-2-phenylethyl)phenyl]oxidanesulfonic acid",n/a,C14H14O6S,310.051109345,M+H+K,+,175.010772,4',
87 '175.01,HMDB0142164,[2-hydroxy-1-(3-hydroxyphenyl)-2-phenylethoxy]sulfonic acid,n/a,C14H14O6S,310.051109345,M+H+K,+,175.010772,4',
88 '175.01,HMDB0142163,[2-hydroxy-2-(3-hydroxyphenyl)-1-phenylethoxy]sulfonic acid,n/a,C14H14O6S,310.051109345,M+H+K,+,175.010772,4',
89 '175.01,HMDB0142167,[2-hydroxy-2-(4-hydroxyphenyl)-1-phenylethoxy]sulfonic acid,n/a,C14H14O6S,310.051109345,M+H+K,+,175.010772,4',
90 '175.01,HMDB0142168,[2-hydroxy-1-(4-hydroxyphenyl)-2-phenylethoxy]sulfonic acid,n/a,C14H14O6S,310.051109345,M+H+K,+,175.010772,4',
91 '175.01,HMDB0129951,"{3-[2-(3,5-dihydroxyphenyl)ethyl]phenyl}oxidanesulfonic acid",n/a,C14H14O6S,310.051109345,M+H+K,+,175.010772,4',
92 '175.01,HMDB0031436,Silicic acid,n/a,H4O4Si,95.987885149,M+DMSO+H,+,175.009105,5',
93 '175.01,HMDB0033657,"11,15-Dihydroxy-6,8,20-trioxapentacyclo[10.8.0.0²,⁹.0³,⁷.0¹⁴,¹⁹]icosa-1(12),2(9),4,10,14,16,18-heptaen-13-one",C03683,C17H10O6,310.047738052,M+H+K,+,175.009086,5',
94 '175.01,HMDB0035230,"6,7-Dihydroxy-3-(4-hydroxyphenyl)-2H-furo[3,2-b]chromen-2-one",n/a,C17H10O6,310.047738052,M+H+K,+,175.009086,5',
95 '175.01,HMDB0155176,5-Hydroxy-6-hydrouracil,n/a,C4H6N2O3,130.037842061,M+2Na-H,+,175.009002,6',
96 '420.16,HMDB0060838,N-Desmethyl-p-hydroxyrosiglitazone,n/a,C17H17N3O4S,359.093976737,M+IsoProp+H,+,420.159317,2',
97 '420.16,HMDB0060836,N-Desmethyl-O-hydroxy rosiglitazone,n/a,C17H17N3O4S,359.093976737,M+IsoProp+H,+,420.159317,2',
98 '420.16,HMDB0160148,"6-[(5-carboxy-3-methylpentanoyl)oxy]-3,4,5-trihydroxyoxane-2-carboxylic acid",n/a,C13H20O10,336.105646844,M+IsoProp+Na+H,+,420.160757,2',
99 '420.16,HMDB0160149,"6-[(5-carboxy-4-methylpentanoyl)oxy]-3,4,5-trihydroxyoxane-2-carboxylic acid",n/a,C13H20O10,336.105646844,M+IsoProp+Na+H,+,420.160757,2',
100 '420.16,HMDB0165020,"6-{[2-(acetyloxy)-3-methylbutanoyl]oxy}-3,4,5-trihydroxyoxane-2-carboxylic acid",n/a,C13H20O10,336.105646844,M+IsoProp+Na+H,+,420.160757,2',
101 '420.16,HMDB0175397,"6-{[3-(acetyloxy)-3-methylbutanoyl]oxy}-3,4,5-trihydroxyoxane-2-carboxylic acid",n/a,C13H20O10,336.105646844,M+IsoProp+Na+H,+,420.160757,2',
102 '420.16,HMDB0184353,"6-[(4-carboxy-3,3-dimethylbutanoyl)oxy]-3,4,5-trihydroxyoxane-2-carboxylic acid",n/a,C13H20O10,336.105646844,M+IsoProp+Na+H,+,420.160757,2'
103 ],
104 'Method \'get_matches_from_hmdb_ua\' works with a well-formated string of mzs and return a complete csv from hmdb');
105
106 print "\n** Test $current_test test_matches_from_hmdb_ua to get hmdb status **\n" ; $current_test++;
107 is_deeply (test_matches_from_hmdb_uaTest (),
108 \'200',
109 'The HMDB server is available: returns successful HTTP requests' ) ;
110
111 print "\n** Test $current_test check_state_from_hmdb_ua to manage script execution with the hmdb server status **\n" ; $current_test++;
112 is_deeply (check_state_from_hmdb_uaTest (\'200'),
113 1,
114 'The status 200 returns no error/warn' ) ;
115
116 print "\n** Test $current_test prepare_multi_masses_query with an empty list of mzs **\n" ; $current_test++;
117 throws_ok{ check_state_from_hmdb_uaTest(\'504')}
118 '/Gateway Timeout: The HMDB server was acting as a gateway or proxy and did not receive a timely response from the upstream server/',
119 'Method \'check_state_from_hmdb_ua\' detects HTTP error code returned by HMDB and died correctly' ;
120
121 print "\n** Test $current_test parse_hmdb_csv_results with the correct inputs for hmdb outputs parsing (csv format) **\n" ; $current_test++;
122 is_deeply ( parse_hmdb_csv_resultsTest (
50 [ 123 [
51 'query_mass,compound_id,compound_name,kegg_id,formula,monoisotopic_mass,adduct,adduct_type,adduct_m/z,delta(ppm)', 124 'query_mass,compound_id,compound_name,kegg_id,formula,monoisotopic_mass,adduct,adduct_type,adduct_m/z,delta(ppm)',
52 # '175.01,HMDB60293,H2O3S2,113.94453531,M+IsoProp+H,+,175.009875,0.000125', 125 # '175.01,HMDB60293,H2O3S2,113.94453531,M+IsoProp+H,+,175.009875,0.000125',
53 # '175.01,HMDB03745,C2H6O3S2,141.975835438,M+CH3OH+H,+,175.009324,0.000676', 126 # '175.01,HMDB03745,C2H6O3S2,141.975835438,M+CH3OH+H,+,175.009324,0.000676',
54 # '175.01,HMDB31436,H4O4Si,95.987885149,M+DMSO+H,+,175.009105,0.000895', 127 # '175.01,HMDB31436,H4O4Si,95.987885149,M+DMSO+H,+,175.009105,0.000895',
63 '175.01,HMDB0033657,De-o-methylsterigmatocystin,C03683,C17H10O6,310.047738052,M+H+K,+,175.009086,5', 136 '175.01,HMDB0033657,De-o-methylsterigmatocystin,C03683,C17H10O6,310.047738052,M+H+K,+,175.009086,5',
64 '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', 137 '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',
65 '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', 138 '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',
66 '420.16,HMDB0060836,N-Desmethyl O-hydroxyrosiglitazone,n/a,C17H17N3O4S,359.093976737,M+IsoProp+H,+,420.159317,2', 139 '420.16,HMDB0060836,N-Desmethyl O-hydroxyrosiglitazone,n/a,C17H17N3O4S,359.093976737,M+IsoProp+H,+,420.159317,2',
67 ], 140 ],
68 'Method \'get_matches_from_hmdb_ua\' works with a well-formated string of mzs and return a complete csv from hmdb');
69
70 print "\n** Test $current_test test_matches_from_hmdb_ua to get hmdb status **\n" ; $current_test++;
71 is_deeply (test_matches_from_hmdb_uaTest (),
72 \'200',
73 'The HMDB server is available: returns successful HTTP requests' ) ;
74
75 print "\n** Test $current_test check_state_from_hmdb_ua to manage script execution with the hmdb server status **\n" ; $current_test++;
76 is_deeply (check_state_from_hmdb_uaTest (\'200'),
77 1,
78 'The status 200 returns no error/warn' ) ;
79
80 print "\n** Test $current_test prepare_multi_masses_query with an empty list of mzs **\n" ; $current_test++;
81 throws_ok{ check_state_from_hmdb_uaTest(\'504')}
82 '/Gateway Timeout: The HMDB server was acting as a gateway or proxy and did not receive a timely response from the upstream server/',
83 'Method \'check_state_from_hmdb_ua\' detects HTTP error code returned by HMDB and died correctly' ;
84
85 print "\n** Test $current_test parse_hmdb_csv_results with the correct inputs for hmdb outputs parsing (csv format) **\n" ; $current_test++;
86 is_deeply ( parse_hmdb_csv_resultsTest (
87 [
88 'query_mass,compound_id,compound_name,kegg_id,formula,monoisotopic_mass,adduct,adduct_type,adduct_m/z,delta(ppm)',
89 # '175.01,HMDB60293,H2O3S2,113.94453531,M+IsoProp+H,+,175.009875,0.000125',
90 # '175.01,HMDB03745,C2H6O3S2,141.975835438,M+CH3OH+H,+,175.009324,0.000676',
91 # '175.01,HMDB31436,H4O4Si,95.987885149,M+DMSO+H,+,175.009105,0.000895',
92 # '175.01,HMDB33657,C17H10O6,310.047738052,M+H+K,+,175.009086,0.000914',
93 # '175.01,HMDB35230,C17H10O6,310.047738052,M+H+K,+,175.009086,0.000914',
94 # '420.16,HMDB60838,C17H17N3O4S,359.093976737,M+IsoProp+H,+,420.159317,0.000683',
95 # '420.16,HMDB60836,C17H17N3O4S,359.093976737,M+IsoProp+H,+,420.159317,0.000683'
96 ## Update format - 2018-01-19... HMDB V04
97 '175.01,HMDB0060293,Hydroxidodioxidosulfidosulfate,C05529,H2O3S2,113.94453531,M+IsoProp+H,+,175.009875,1',
98 '175.01,HMDB0003745,Mesna,C03576,C2H6O3S2,141.975835438,M+CH3OH+H,+,175.009324,4',
99 '175.01,HMDB0031436,Silicic acid,n/a,H4O4Si,95.987885149,M+DMSO+H,+,175.009105,5',
100 '175.01,HMDB0033657,De-o-methylsterigmatocystin,C03683,C17H10O6,310.047738052,M+H+K,+,175.009086,5',
101 '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',
102 '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',
103 '420.16,HMDB0060836,N-Desmethyl O-hydroxyrosiglitazone,n/a,C17H17N3O4S,359.093976737,M+IsoProp+H,+,420.159317,2',
104 ],
105 ['175.01', '238.19', '420.16'], 141 ['175.01', '238.19', '420.16'],
106 10 142 10
107 ), 143 ),
108 [ 144 [
109 [ 145 [