comparison t/hmdb_managerTest.pl @ 4:6091a80df951 draft

planemo upload commit e2dfb6f7afeeb7767ef83e9e2c3a2d3e6a94ae98
author fgiacomoni
date Fri, 19 Jan 2018 09:38:17 -0500
parents 6d0a0f8f672a
children c32280662103
comparison
equal deleted inserted replaced
3:505956db90c5 4:6091a80df951
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 [ 50 [
51 'query_mass,compound_id,formula,compound_mass,adduct,adduct_type,adduct_mass,delta', 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', 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', 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', 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', 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', 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', 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' 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',
59 ], 67 ],
60 'Method \'get_matches_from_hmdb_ua\' works with a well-formated string of mzs and return a complete csv from hmdb'); 68 'Method \'get_matches_from_hmdb_ua\' works with a well-formated string of mzs and return a complete csv from hmdb');
61 69
62 print "\n** Test $current_test test_matches_from_hmdb_ua to get hmdb status **\n" ; $current_test++; 70 print "\n** Test $current_test test_matches_from_hmdb_ua to get hmdb status **\n" ; $current_test++;
63 is_deeply (test_matches_from_hmdb_uaTest (), 71 is_deeply (test_matches_from_hmdb_uaTest (),
75 'Method \'check_state_from_hmdb_ua\' detects HTTP error code returned by HMDB and died correctly' ; 83 'Method \'check_state_from_hmdb_ua\' detects HTTP error code returned by HMDB and died correctly' ;
76 84
77 print "\n** Test $current_test parse_hmdb_csv_results with the correct inputs for hmdb outputs parsing (csv format) **\n" ; $current_test++; 85 print "\n** Test $current_test parse_hmdb_csv_results with the correct inputs for hmdb outputs parsing (csv format) **\n" ; $current_test++;
78 is_deeply ( parse_hmdb_csv_resultsTest ( 86 is_deeply ( parse_hmdb_csv_resultsTest (
79 [ 87 [
80 'query_mass,compound_id,formula,compound_mass,adduct,adduct_type,adduct_mass,delta', 88 'query_mass,compound_id,compound_name,kegg_id,formula,monoisotopic_mass,adduct,adduct_type,adduct_m/z,delta(ppm)',
81 '175.01,HMDB60293,H2O3S2,113.94453531,M+IsoProp+H,+,175.009875,0.000125', 89 # '175.01,HMDB60293,H2O3S2,113.94453531,M+IsoProp+H,+,175.009875,0.000125',
82 '175.01,HMDB03745,C2H6O3S2,141.975835438,M+CH3OH+H,+,175.009324,0.000676', 90 # '175.01,HMDB03745,C2H6O3S2,141.975835438,M+CH3OH+H,+,175.009324,0.000676',
83 '175.01,HMDB31436,H4O4Si,95.987885149,M+DMSO+H,+,175.009105,0.000895', 91 # '175.01,HMDB31436,H4O4Si,95.987885149,M+DMSO+H,+,175.009105,0.000895',
84 '175.01,HMDB33657,C17H10O6,310.047738052,M+H+K,+,175.009086,0.000914', 92 # '175.01,HMDB33657,C17H10O6,310.047738052,M+H+K,+,175.009086,0.000914',
85 '175.01,HMDB35230,C17H10O6,310.047738052,M+H+K,+,175.009086,0.000914', 93 # '175.01,HMDB35230,C17H10O6,310.047738052,M+H+K,+,175.009086,0.000914',
86 '420.16,HMDB60838,C17H17N3O4S,359.093976737,M+IsoProp+H,+,420.159317,0.000683', 94 # '420.16,HMDB60838,C17H17N3O4S,359.093976737,M+IsoProp+H,+,420.159317,0.000683',
87 '420.16,HMDB60836,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',
88 ], 104 ],
89 ['175.01', '238.19', '420.16'] 105 ['175.01', '238.19', '420.16'],
106 10
90 ), 107 ),
91 [ 108 [
92 [ 109 [
93 { 'ENTRY_ADDUCT' => 'M+IsoProp+H', 'ENTRY_DELTA' => '0.000125', 'ENTRY_ADDUCT_TYPE' => '+', 'ENTRY_FORMULA' => 'H2O3S2', 'ENTRY_ENTRY_ID' => 'HMDB60293', 'ENTRY_ADDUCT_MZ' => '175.009875', 'ENTRY_CPD_MZ' => '113.94453531' }, 110 { 'ENTRY_CPD_MZ' => '113.94453531', 'ENTRY_ENTRY_ID' => 'HMDB0060293', 'ENTRY_FORMULA' => 'H2O3S2', 'ENTRY_ADDUCT_MZ' => '175.009875', 'ENTRY_DELTA' => '1', 'ENTRY_ADDUCT_TYPE' => '+', 'ENTRY_ADDUCT' => 'M+IsoProp+H' },
94 { 'ENTRY_ADDUCT' => 'M+CH3OH+H', 'ENTRY_ADDUCT_TYPE' => '+', 'ENTRY_DELTA' => '0.000676', 'ENTRY_FORMULA' => 'C2H6O3S2', 'ENTRY_ENTRY_ID' => 'HMDB03745', 'ENTRY_ADDUCT_MZ' => '175.009324', 'ENTRY_CPD_MZ' => '141.975835438' }, 111 {'ENTRY_DELTA' => '4','ENTRY_ADDUCT_TYPE' => '+','ENTRY_ADDUCT' => 'M+CH3OH+H','ENTRY_CPD_MZ' => '141.975835438','ENTRY_ENTRY_ID' => 'HMDB0003745','ENTRY_FORMULA' => 'C2H6O3S2','ENTRY_ADDUCT_MZ' => '175.009324'},
95 { 'ENTRY_CPD_MZ' => '95.987885149', 'ENTRY_FORMULA' => 'H4O4Si', 'ENTRY_ENTRY_ID' => 'HMDB31436', 'ENTRY_ADDUCT_MZ' => '175.009105', 'ENTRY_DELTA' => '0.000895', 'ENTRY_ADDUCT_TYPE' => '+', 'ENTRY_ADDUCT' => 'M+DMSO+H' }, 112 {'ENTRY_ENTRY_ID' => 'HMDB0031436','ENTRY_CPD_MZ' => '95.987885149','ENTRY_ADDUCT_MZ' => '175.009105','ENTRY_FORMULA' => 'H4O4Si','ENTRY_DELTA' => '5','ENTRY_ADDUCT_TYPE' => '+','ENTRY_ADDUCT' => 'M+DMSO+H'},
96 { 'ENTRY_ADDUCT_TYPE' => '+', 'ENTRY_DELTA' => '0.000914', 'ENTRY_ADDUCT' => 'M+H+K', 'ENTRY_CPD_MZ' => '310.047738052', 'ENTRY_ENTRY_ID' => 'HMDB33657', 'ENTRY_ADDUCT_MZ' => '175.009086', 'ENTRY_FORMULA' => 'C17H10O6' }, 113 {'ENTRY_ADDUCT_MZ' => '175.009086','ENTRY_FORMULA' => 'C17H10O6','ENTRY_ENTRY_ID' => 'HMDB0033657','ENTRY_CPD_MZ' => '310.047738052','ENTRY_ADDUCT' => 'M+H+K','ENTRY_ADDUCT_TYPE' => '+','ENTRY_DELTA' => '5'},
97 { 'ENTRY_ADDUCT' => 'M+H+K', 'ENTRY_DELTA' => '0.000914', 'ENTRY_ADDUCT_TYPE' => '+', 'ENTRY_FORMULA' => 'C17H10O6', 'ENTRY_ADDUCT_MZ' => '175.009086', 'ENTRY_ENTRY_ID' => 'HMDB35230', 'ENTRY_CPD_MZ' => '310.047738052' } 114 {'ENTRY_ADDUCT_MZ' => '175.009086','ENTRY_FORMULA' => 'C17H10O6','ENTRY_ENTRY_ID' => 'HMDB0035230','ENTRY_CPD_MZ' => '310.047738052','ENTRY_ADDUCT_TYPE' => '+','ENTRY_ADDUCT' => 'M+H+K','ENTRY_DELTA' => '5'}
98 ], 115 ],
99 [], 116 [],
100 [ 117 [
101 { 'ENTRY_ADDUCT' => 'M+IsoProp+H', 'ENTRY_ADDUCT_TYPE' => '+', 'ENTRY_DELTA' => '0.000683', 'ENTRY_ENTRY_ID' => 'HMDB60838', 'ENTRY_ADDUCT_MZ' => '420.159317', 'ENTRY_FORMULA' => 'C17H17N3O4S', 'ENTRY_CPD_MZ' => '359.093976737' }, 118 {'ENTRY_FORMULA' => 'C17H17N3O4S','ENTRY_ADDUCT_MZ' => '420.159317','ENTRY_CPD_MZ' => '359.093976737','ENTRY_ENTRY_ID' => 'HMDB0060838','ENTRY_ADDUCT' => 'M+IsoProp+H','ENTRY_ADDUCT_TYPE' => '+','ENTRY_DELTA' => '2'},
102 { 'ENTRY_CPD_MZ' => '359.093976737', 'ENTRY_FORMULA' => 'C17H17N3O4S', 'ENTRY_ENTRY_ID' => 'HMDB60836', 'ENTRY_ADDUCT_MZ' => '420.159317', 'ENTRY_ADDUCT_TYPE' => '+', 'ENTRY_DELTA' => '0.000683', 'ENTRY_ADDUCT' => 'M+IsoProp+H' } 119 {'ENTRY_DELTA' => '2','ENTRY_ADDUCT_TYPE' => '+','ENTRY_ADDUCT' => 'M+IsoProp+H','ENTRY_ENTRY_ID' => 'HMDB0060836','ENTRY_CPD_MZ' => '359.093976737','ENTRY_ADDUCT_MZ' => '420.159317','ENTRY_FORMULA' => 'C17H17N3O4S'}
103 ] 120 ]
104 ], 121 ],
105 'Method \'parse_hmdb_csv_results\' works with a well-formated csv output and returns a a well formated array' ) ; 122 'Method \'parse_hmdb_csv_results\' works with a well-formated csv output and returns a a well formated array' ) ;
106 123
107 print "\n** Test $current_test parse_hmdb_csv_results with a void hmdb output and a list of mzs **\n" ; $current_test++; 124 print "\n** Test $current_test parse_hmdb_csv_results with a void hmdb output and a list of mzs **\n" ; $current_test++;