From: jseco <js...@mm...> - 2010-09-17 09:52:55
|
Hi All, I have recently installed Openbabel on my computer and trying to develop some code merging OB and Perl, but unfortunately, I have noticed the documentation present is not large enough to my comprehension because of my programming limitations. I have the same problem in how to access to the data of GetUMapList(). I have also read the post, but it seems was not clearly fixed it. I have tried the following code to finally confirm the $maplist is a HASH (using Scalar::Util, because Data::Dumper gave me $VAR1 = bless( {},'Chemistry::OpenBabel::vvInt' ); but I do not know how to interpret...) and I have unsuccessfully tried all perlistic ways to access to a given hash but I do not know how to really access to the content, even trying the solutions posted here. Am I missing anything ?, because the foreach loop does not return anything. Thanks in advance!! use Chemistry::OpenBabel; use Scalar::Util; my $smiles = "c1cc(CC(=O)CN)ccc1"; my $obMol = new Chemistry::OpenBabel::OBMol; my $obConversion = new Chemistry::OpenBabel::OBConversion; $obConversion->SetInFormat("smi"); $obConversion->ReadString($obMol,$smiles); my $obsmartpattern = new Chemistry::OpenBabel::OBSmartsPattern; $obsmartpattern->Init('C(=O)'); $obsmartpattern->Match($obMol); my $maplist = $obsmartpattern->GetMapList(); print UNIVERSAL::isa($maplist,'HASH'); foreach my $index1 (sort {$a cmp $b} keys %{$maplist}) { printf "index is %s\n",$index; } -- View this message in context: http://open-babel.957263.n4.nabble.com/WriteMapList-using-Perl-tp957583p2543611.html Sent from the openbabel-scripting mailing list archive at Nabble.com. |