Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- #
- # nuskaityti bindingdb sdf failus
- # H-Se/DB26984_50278320.sdf kaip testas imtas
- #
- # VR
- #
- #use warnings;
- use Data::Dumper;
- #nuskaityti failus i @molekules
- die "usage VR_bindingdb_parse.pl file.sdf 'TARGET Biomolecule'" if (@ARGV != 2);
- $FILE = $ARGV[0];
- $target = $ARGV[1];
- open FILE, "<", $FILE or die $!;
- $x=0;
- $key='str';
- while(<FILE>) {
- chop($_);
- next if ($_ =~ /^$/); #jei eilute tuscia praleidziam
- if ($_ =~ /\$\$\$\$/) { #jei eiluteje yra: $$$$
- $x++;
- $key = 'str';
- next;
- }
- #print $x, $_;
- if ($_ =~ /^\>/) { #jei eilute prasideda: >
- chop();
- $_ =~ s/> <//;
- $key = $_;
- } else {
- #$molekules[molekules nr.]{irasas}
- push @{ $molekules[$x]{$key} }, $_;
- }
- }
- close FILE;
- #print STDERR Dumper \@molekules;
- print STDERR $FILE, " ", $target, "\n";
- #rasti nuo kur prasideda kitokia molekule
- #pirmoji kita yra $ta_pati+1
- kita();
- sub kita {
- $y=0;
- $ta_pati=0;
- while($molekules[$y]{'str'}) {
- #print STDERR Dumper $molekules[$y]{'str'}, "\n";
- $z=0;
- while($molekules[$y]{'str'}[$z]) {
- #jei z eilute nesutampa y ir y+1 nors karta tai kita molekule
- if ($molekules[$y]{'str'}[$z] ne $molekules[$y+1]{'str'}[$z]) {
- $ta_pati=$y;
- #print STDERR $y, " :", $molekules[$y]{'str'}[$z], " ir ", $molekules[$y+1]{'str'}[$z], "\n";
- last;
- }
- $z++;
- }
- last if ($ta_pati);
- $y++;
- }
- }
- #print STDERR Dumper $molekules[0], "\n";
- #eiti per molekules iki pirmos tos pacios ir
- #nuo pirmos tos pacios eiti per visas ir rasti vienoda 'TARGET Biomolecule'
- $x=0;
- $skaitiklis=0;
- while($x <= $ta_pati) {
- $y=$ta_pati+1;
- while($molekules[$y]{'str'}[0]) {
- if (($target eq $molekules[$x]{'TARGET Biomolecule'}[0]) && ($target eq $molekules[$y]{'TARGET Biomolecule'}[0])) {
- #print STDERR "Target: ", $molekules[$x]{'TARGET Biomolecule'}[0], "\n";
- print STDERR "Ki ", $molekules[$x]{'BindingDB Display Name'}[0], " molekulei: ", $molekules[$x]{'Enzymologic: Ki nM'}[0], " nM\n";
- print STDERR "Ki ", $molekules[$y]{'BindingDB Display Name'}[0], " molekulei: ", $molekules[$y]{'Enzymologic: Ki nM'}[0], " nM\n";
- #kiek x molekule geresne uz y nM skaitiklis
- $skaitiklis=$skaitiklis+($molekules[$x]{'Enzymologic: Ki nM'}[0]-$molekules[$y]{'Enzymologic: Ki nM'}[0]);
- }
- $y++;
- }
- $x++;
- }
- print $molekules[0]{'BindingDB Display Name'}[0], " geriau uz ", $molekules[$ta_pati+1]{'BindingDB Display Name'}[0],
- " vidutiniskai\t", $skaitiklis/$x, "\tnM\n";
- #print STDERR "Ki ", $molekules[0]{'BindingDB Display Name'}[0], " molekulei:\n";
- #print STDERR Dumper @pirma;
- #print STDERR "Ki ", $molekules[$ta_pati+1]{'BindingDB Display Name'}[0], " molekulei:\n";
- #print STDERR Dumper @antra;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement