diff 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
line wrap: on
line diff
--- a/lib/hmdb_api.pm	Tue Jan 21 16:09:45 2020 -0500
+++ b/lib/hmdb_api.pm	Wed Nov 30 16:14:27 2022 +0000
@@ -214,7 +214,7 @@
 				$metabolites->{$id}{'[M-H]-'} = ( $tmp_mass - $proton_mass + $electron_mass) * $charge ;
 			}
 			else {
-				warn "No monisotopic_molecular_weight field exists with metabolite $id\n " ;
+				warn "No monoisotopic_molecular_weight field exists with metabolite $id - this entry is not added in dumped file\n " ;
 			}
 	    }	
 	}
@@ -226,7 +226,7 @@
 					$entry->{'MZ_[M-H]-'} = ( $tmp_mass - $proton_mass + $electron_mass) * $charge ;
 				}
 				else {
-					warn "No MZ_MONO field exists with metabolite $entry->{'HMDB_ID'}\n " ;
+					warn "No MZ_MONO field exists with metabolite $entry->{'HMDB_ID'} - this entry is not added in dumped file\n " ;
 				}
 		}
 	}
@@ -270,7 +270,11 @@
     	push (@tmp, $metabolites->{$id}{'inchikey'}) ;
     	
     	# merge
-    	push (@metabolitesSorted, \@tmp) ;
+    	
+    	## filter entry if no monisotopic_molecular_weight is present
+    	if ($metabolites->{$id}{'monisotopic_molecular_weight'} ne '') {
+    		push (@metabolitesSorted, \@tmp) ;	
+    	}
     }
 
     return (\@metabolitesSorted) ;