Mercurial > repos > fgiacomoni > bank_inhouse
comparison t/bih_managerTest.t @ 1:52798007c6b2 draft default tip
Master branch Updating - - Fxx
author | fgiacomoni |
---|---|
date | Thu, 24 Jan 2019 10:02:05 -0500 |
parents | be582bcd6585 |
children |
comparison
equal
deleted
inserted
replaced
0:be582bcd6585 | 1:52798007c6b2 |
---|---|
2 use diagnostics; | 2 use diagnostics; |
3 use warnings; | 3 use warnings; |
4 no warnings qw/void/; | 4 no warnings qw/void/; |
5 use strict; | 5 use strict; |
6 no strict "refs" ; | 6 no strict "refs" ; |
7 use Test::More tests => 36 ; | 7 use Test::More tests => 37 ; |
8 use FindBin ; | 8 use FindBin ; |
9 use Data::Dumper ; | 9 use Data::Dumper ; |
10 | 10 |
11 ## Specific Modules | 11 ## Specific Modules |
12 use lib $FindBin::Bin ; | 12 use lib $FindBin::Bin ; |
73 ## testing mz_delta_conversion | 73 ## testing mz_delta_conversion |
74 print "\n-- Test mz_delta_conversion lib\n\n" ; | 74 print "\n-- Test mz_delta_conversion lib\n\n" ; |
75 #17 | 75 #17 |
76 is ( mz_delta_conversion_Testmin(100, 'Da', 0.005), 99.995, 'Works with \'100, Da, 0.005\' for minimum'); | 76 is ( mz_delta_conversion_Testmin(100, 'Da', 0.005), 99.995, 'Works with \'100, Da, 0.005\' for minimum'); |
77 #18 | 77 #18 |
78 is ( mz_delta_conversion_Testmax(100, 'Da', 0.005), 100.0050000001, 'Works with \'100, Da, 0.005\' for maximum'); | 78 is ( mz_delta_conversion_Testmax(100, 'Da', 0.005), 100.0051, 'Works with \'100, Da, 0.005\' for maximum'); |
79 #19 | 79 #19 |
80 is ( mz_delta_conversion_Testmin(500, 'Da', 0.005), 499.995, 'Works with \'500, Da, 0.005\' for minimum'); | 80 is ( mz_delta_conversion_Testmin(500, 'Da', 0.005), 499.995, 'Works with \'500, Da, 0.005\' for minimum'); |
81 #20 | 81 #20 |
82 is ( mz_delta_conversion_Testmax(500, 'Da', 0.005), 500.0050000001, 'Works with \'500, Da, 0.005\' for maximum'); | 82 is ( mz_delta_conversion_Testmax(500, 'Da', 0.005), 500.0051, 'Works with \'500, Da, 0.005\' for maximum'); |
83 #20.1 | |
84 is ( mz_delta_conversion_Testmax(500.159989, 'Da', 0.005), 500.1649891, 'Works with \'500, Da, 0.005\' for maximum'); | |
85 | |
83 #21 | 86 #21 |
84 is ( mz_delta_conversion_Testmin(100, 'ppm', 5), 99.9995, 'Works with \'100, ppm, 5\' for minimum'); | 87 is ( mz_delta_conversion_Testmin(100, 'ppm', 5), 99.9995, 'Works with \'100, ppm, 5\' for minimum'); |
85 #22 | 88 #22 |
86 is ( mz_delta_conversion_Testmax(100, 'ppm', 5), 100.0005000001, 'Works with \'100, ppm, 5\' for maximum'); | 89 is ( mz_delta_conversion_Testmax(100, 'ppm', 5), 100.00051, 'Works with \'100, ppm, 5\' for maximum'); |
87 #23 | 90 #23 |
88 is ( mz_delta_conversion_Testmin(500, 'ppm', 5), 499.9975, 'Works with \'500, ppm, 5\' for minimum'); | 91 is ( mz_delta_conversion_Testmin(500, 'ppm', 5), 499.9975, 'Works with \'500, ppm, 5\' for minimum'); |
89 #24 | 92 #24 |
90 is ( mz_delta_conversion_Testmax(500, 'ppm', 5), 500.0025000001, 'Works with \'500, ppm, 5\' for maximum'); | 93 is ( mz_delta_conversion_Testmax(500, 'ppm', 5), 500.00251, 'Works with \'500, ppm, 5\' for maximum'); |
91 print "\n--\n" ; | 94 print "\n--\n" ; |
92 | 95 |
93 ## testing dichotomi_search | 96 ## testing dichotomi_search |
94 print "\n-- Test dichotomi_search lib\n\n" ; | 97 print "\n-- Test dichotomi_search lib\n\n" ; |
95 #25 | 98 #25 |
109 #32 | 112 #32 |
110 is ( dichotomi_search_Test(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'], '10.5'), 10, 'Works with \'10.5\' between the 10th and the 11th element return \'10\'(the index of the 11th)'); | 113 is ( dichotomi_search_Test(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'], '10.5'), 10, 'Works with \'10.5\' between the 10th and the 11th element return \'10\'(the index of the 11th)'); |
111 print "\n--\n" ; | 114 print "\n--\n" ; |
112 | 115 |
113 ## test of input bank parsing | 116 ## test of input bank parsing |
114 print "\n-- Test bank parsing\n\n" ; | 117 #print "\n-- Test bank parsing\n\n" ; |
115 is_deeply ( parse_bank_interest_Test( | 118 #is_deeply ( parse_bank_interest_Test( |
116 '/Users/fgiacomoni/Inra/labs/perl/galaxy_tools/tool-bank_inhouse/test_data/in_test2.tabular', 1), | 119 # '/Users/fgiacomoni/Inra/labs/perl/galaxy_tools/tool-bank_inhouse/test_data/in_test2.tabular', 1), |
117 { '422.0849114' => [ [ 'C19H18O11', '422.0849114' ] ], '98.952389' => [ [ 'Halothane', '98.952389' ] ], '209.987659' => [ [ 'Bismuth', '209.987659' ] ], '18.0105647' => [ [ 'H2O', '18.0105647' ] ], '199.951068' => [ [ 'Picolinic acid', '199.951068' ] ], '535.3181236' => [ [ 'C18H45N7O11', '535.3181236' ] ] }, | 120 # { '422.0849114' => [ [ 'C19H18O11', '422.0849114' ] ], '98.952389' => [ [ 'Halothane', '98.952389' ] ], '209.987659' => [ [ 'Bismuth', '209.987659' ] ], '18.0105647' => [ [ 'H2O', '18.0105647' ] ], '199.951068' => [ [ 'Picolinic acid', '199.951068' ] ], '535.3181236' => [ [ 'C18H45N7O11', '535.3181236' ] ] }, |
118 "Parsing a bank method works an return a well organized hash\n" ) ; | 121 # "Parsing a bank method works an return a well organized hash\n" ) ; |
119 | 122 # |
120 print "\n--\n" ; | 123 #print "\n--\n" ; |
121 | 124 |
122 | 125 |
123 ## test of rest ws of PeakForest | 126 ## test of rest ws of PeakForest |
124 print "\n-- Test PeakForest WS\n\n" ; | 127 #print "\n-- Test PeakForest WS\n\n" ; |
125 is_deeply ( db_pforest_get_clean_range_Test( | 128 #is_deeply ( db_pforest_get_clean_range_Test( |
126 'https://rest.peakforest.org', '/spectra/lcms/peaks/get-range-clean', '190.0', '200.0', 'negative'), | 129 # 'https://rest.peakforest.org', '/spectra/lcms/peaks/get-range-clean', '190.0', '200.0', 'negative'), |
127 [{ 'cpds' => [ 186 ], 'thMass' => '195.0877', 'sp' => 25, 'ri' => '100', 'deltaPPM' => '0.245', 'composition' => 'C8H11N4O2', 'attribution' => '[M+H]+', 'mz' => '195.0875' }, { 'composition' => 'C9H9O5', 'attribution' => '[M-H]-', 'ri' => '100', 'deltaPPM' => '0.271', 'cpds' => [ 360 ], 'thMass' => '197.0456', 'sp' => 37, 'mz' => '197.0452' }, { 'composition' => 'C9H12NO4', 'attribution' => '[M+H]+', 'deltaPPM' => '-0.426098891623529', 'ri' => '100', 'thMass' => '198.0760844', 'sp' => 77, 'cpds' => [ 1841 ], 'mz' => '198.076' }, { 'mz' => '196.0614', 'composition' => 'C9H10NO4', 'attribution' => '[M-H]-', 'cpds' => [ 1841 ], 'thMass' => '196.0615311', 'sp' => 78, 'ri' => '100', 'deltaPPM' => '-0.668667633415113' }, { 'cpds' => [ 1841 ], 'thMass' => '198.0760844', 'sp' => 79, 'ri' => '100', 'deltaPPM' => '-0.426098891623529', 'composition' => 'C9H12NO4', 'attribution' => '[M+H]+', 'mz' => '198.076' }], | 130 # [{ 'cpds' => [ 186 ], 'thMass' => '195.0877', 'sp' => 25, 'ri' => '100', 'deltaPPM' => '0.245', 'composition' => 'C8H11N4O2', 'attribution' => '[M+H]+', 'mz' => '195.0875' }, { 'composition' => 'C9H9O5', 'attribution' => '[M-H]-', 'ri' => '100', 'deltaPPM' => '0.271', 'cpds' => [ 360 ], 'thMass' => '197.0456', 'sp' => 37, 'mz' => '197.0452' }, { 'composition' => 'C9H12NO4', 'attribution' => '[M+H]+', 'deltaPPM' => '-0.426098891623529', 'ri' => '100', 'thMass' => '198.0760844', 'sp' => 77, 'cpds' => [ 1841 ], 'mz' => '198.076' }, { 'mz' => '196.0614', 'composition' => 'C9H10NO4', 'attribution' => '[M-H]-', 'cpds' => [ 1841 ], 'thMass' => '196.0615311', 'sp' => 78, 'ri' => '100', 'deltaPPM' => '-0.668667633415113' }, { 'cpds' => [ 1841 ], 'thMass' => '198.0760844', 'sp' => 79, 'ri' => '100', 'deltaPPM' => '-0.426098891623529', 'composition' => 'C9H12NO4', 'attribution' => '[M+H]+', 'mz' => '198.076' }], |
128 "PForest WS call works an return a clean range og mz between 190 and 200\n" ) ; | 131 # "PForest WS call works an return a clean range og mz between 190 and 200\n" ) ; |
129 | 132 # |
130 print "\n--\n" ; | 133 #print "\n--\n" ; |
131 | 134 |
132 ## test of rest ws of PeakForest | 135 ## test of rest ws of PeakForest |
133 print "\n-- Test PeakForest JSON Bank parsing\n\n" ; | 136 #print "\n-- Test PeakForest JSON Bank parsing\n\n" ; |
134 | 137 # |
135 my ($bank, $headers) = map_pfjson_bankobject_Test([ { 'cpds' => [ 186 ], 'mz' => '195.0875' }, {'mz' => '198.076', 'cpds' => [ 190 ]} ]) ; | 138 #my ($bank, $headers) = map_pfjson_bankobject_Test([ { 'cpds' => [ 186 ], 'mz' => '195.0875' }, {'mz' => '198.076', 'cpds' => [ 190 ]} ]) ; |
136 is_deeply ( | 139 #is_deeply ( |
137 $bank, | 140 # $bank, |
138 { '198.076' => [ [ 190, '198.076' ] ], '195.0875' => [ [ 186, '195.0875' ] ] }, | 141 # { '198.076' => [ [ 190, '198.076' ] ], '195.0875' => [ [ 186, '195.0875' ] ] }, |
139 "Parsing json bank from PeakForest works an return a well organized hash for data\n" ) ; | 142 # "Parsing json bank from PeakForest works an return a well organized hash for data\n" ) ; |
140 | 143 # |
141 is_deeply ( | 144 #is_deeply ( |
142 $headers, | 145 # $headers, |
143 ['id', 'mz'], | 146 # ['id', 'mz'], |
144 "Parsing json bank from PeakForest works an return a well organized array for headers\n" ) ; | 147 # "Parsing json bank from PeakForest works an return a well organized array for headers\n" ) ; |