P
pistachio
Hello all,
It's a ref question. I'm not getting what I'm doing wrong here. All
the other variables work but the sdf variable. When I try to print
that it just gives me an error. I've used data dumper to see what's
going on and now I'm really confused. Any help would be great.
Cheers,
PB
Abstract code below.
my $sdffile="SDF_database_file.sdf";
my @mols = Chemistry::Mol->read($sdffile);
for loop{
$formula[$i]=$mols[$i]->attr("sdf/data")->{FORMULA};
$mass[$i]=$mols[$i]->attr("sdf/data")->{EXACT_MASS};
my @smile;
$sdf[$i]=$mols[$i]->attr("sdf/data");
#my $temp={$sdf[$i]};
#$sdf[$i]=$mols[$i]->attr("sdf/data")->{SDF} . "\t";
print "$mass[$i] $name[$i] $formula[$i] $owner $date\n";
}
print $sdf[1] ."\n";
print Dumper $sdf[2] . "\n";
This gives:
517.270898 Choloyl-taurine C25H43NO8S dwong 2007-05-16 12:01:59
483.301819 Taurolithocholate C26H45NO5S dwong 2007-05-16 12:01:59
499.296729 Taurodeoxycholate C26H45NO6S dwong 2007-05-16 12:01:59
499.296729 Taurochenodeoxycholate C26H45NO6S dwong 2007-05-16
12:01:59
410.391251 hop-22(29)-ene C30H50 dwong 2007-05-16 12:01:59
HASH(0x84f45c8)
$VAR1 = 'HASH(0x84e6738)
';
Which I have no idea how to get my data from that. again thx for
any help.
It's a ref question. I'm not getting what I'm doing wrong here. All
the other variables work but the sdf variable. When I try to print
that it just gives me an error. I've used data dumper to see what's
going on and now I'm really confused. Any help would be great.
Cheers,
PB
Abstract code below.
my $sdffile="SDF_database_file.sdf";
my @mols = Chemistry::Mol->read($sdffile);
for loop{
$formula[$i]=$mols[$i]->attr("sdf/data")->{FORMULA};
$mass[$i]=$mols[$i]->attr("sdf/data")->{EXACT_MASS};
my @smile;
$sdf[$i]=$mols[$i]->attr("sdf/data");
#my $temp={$sdf[$i]};
#$sdf[$i]=$mols[$i]->attr("sdf/data")->{SDF} . "\t";
print "$mass[$i] $name[$i] $formula[$i] $owner $date\n";
}
print $sdf[1] ."\n";
print Dumper $sdf[2] . "\n";
This gives:
517.270898 Choloyl-taurine C25H43NO8S dwong 2007-05-16 12:01:59
483.301819 Taurolithocholate C26H45NO5S dwong 2007-05-16 12:01:59
499.296729 Taurodeoxycholate C26H45NO6S dwong 2007-05-16 12:01:59
499.296729 Taurochenodeoxycholate C26H45NO6S dwong 2007-05-16
12:01:59
410.391251 hop-22(29)-ene C30H50 dwong 2007-05-16 12:01:59
HASH(0x84f45c8)
$VAR1 = 'HASH(0x84e6738)
';
Which I have no idea how to get my data from that. again thx for
any help.