Mercurial > repos > fgiacomoni > downloader_bank_hmdb
comparison lib/hmdb_api.pm @ 2:be504ccbc41c draft default tip
master branch Updating with tag :CI_COMMIT_TAG - - Fxx
author | fgiacomoni |
---|---|
date | Wed, 30 Nov 2022 16:14:27 +0000 |
parents | 7c9269bded0e |
children |
comparison
equal
deleted
inserted
replaced
1:4373f936111d | 2:be504ccbc41c |
---|---|
212 my $tmp_mass = $metabolites->{$id}{'monisotopic_molecular_weight'} ; | 212 my $tmp_mass = $metabolites->{$id}{'monisotopic_molecular_weight'} ; |
213 $metabolites->{$id}{'[M+H]+'} = ( $tmp_mass + $proton_mass - $electron_mass) * $charge ; | 213 $metabolites->{$id}{'[M+H]+'} = ( $tmp_mass + $proton_mass - $electron_mass) * $charge ; |
214 $metabolites->{$id}{'[M-H]-'} = ( $tmp_mass - $proton_mass + $electron_mass) * $charge ; | 214 $metabolites->{$id}{'[M-H]-'} = ( $tmp_mass - $proton_mass + $electron_mass) * $charge ; |
215 } | 215 } |
216 else { | 216 else { |
217 warn "No monisotopic_molecular_weight field exists with metabolite $id\n " ; | 217 warn "No monoisotopic_molecular_weight field exists with metabolite $id - this entry is not added in dumped file\n " ; |
218 } | 218 } |
219 } | 219 } |
220 } | 220 } |
221 elsif ( ($format eq 'CARD') ) { | 221 elsif ( ($format eq 'CARD') ) { |
222 foreach my $entry (@$metabolites) { | 222 foreach my $entry (@$metabolites) { |
224 my $tmp_mass = $entry->{'MZ_MONO'} ; | 224 my $tmp_mass = $entry->{'MZ_MONO'} ; |
225 $entry->{'MZ_[M+H]+'} = ( $tmp_mass + $proton_mass - $electron_mass) * $charge ; | 225 $entry->{'MZ_[M+H]+'} = ( $tmp_mass + $proton_mass - $electron_mass) * $charge ; |
226 $entry->{'MZ_[M-H]-'} = ( $tmp_mass - $proton_mass + $electron_mass) * $charge ; | 226 $entry->{'MZ_[M-H]-'} = ( $tmp_mass - $proton_mass + $electron_mass) * $charge ; |
227 } | 227 } |
228 else { | 228 else { |
229 warn "No MZ_MONO field exists with metabolite $entry->{'HMDB_ID'}\n " ; | 229 warn "No MZ_MONO field exists with metabolite $entry->{'HMDB_ID'} - this entry is not added in dumped file\n " ; |
230 } | 230 } |
231 } | 231 } |
232 } | 232 } |
233 | 233 |
234 | 234 |
268 push (@tmp, $metabolites->{$id}{'metabolite_name'}) ; | 268 push (@tmp, $metabolites->{$id}{'metabolite_name'}) ; |
269 push (@tmp, $metabolites->{$id}{'chemical_formula'}) ; | 269 push (@tmp, $metabolites->{$id}{'chemical_formula'}) ; |
270 push (@tmp, $metabolites->{$id}{'inchikey'}) ; | 270 push (@tmp, $metabolites->{$id}{'inchikey'}) ; |
271 | 271 |
272 # merge | 272 # merge |
273 push (@metabolitesSorted, \@tmp) ; | 273 |
274 ## filter entry if no monisotopic_molecular_weight is present | |
275 if ($metabolites->{$id}{'monisotopic_molecular_weight'} ne '') { | |
276 push (@metabolitesSorted, \@tmp) ; | |
277 } | |
274 } | 278 } |
275 | 279 |
276 return (\@metabolitesSorted) ; | 280 return (\@metabolitesSorted) ; |
277 } | 281 } |
278 ### END of SUB | 282 ### END of SUB |