View difference between Paste ID: A1ZFavQ7 and n3eAW4FR
SHOW: | | - or go back to the newest paste.
1
#!/usr/bin/perl
2
#
3
# nuskaityti bindingdb sdf failus
4
# H-Se/DB26984_50278320.sdf kaip testas imtas
5
#
6
# VR
7
#
8
9
#use warnings;
10
use Data::Dumper;
11
12
13
#nuskaityti failus i @molekules
14
die "usage VR_bindingdb_parse.pl file.sdf" if (@ARGV != 1);
15
$FILE = $ARGV[0];
16
open FILE, "<", $FILE or die $!;
17
$x=0;
18
$key='str';
19
while(<FILE>) {
20
 chop($_);
21
 next if ($_ =~ /^$/);   #jei eilute tuscia praleidziam
22
 if ($_ =~ /\$\$\$\$/) { #jei eiluteje yra: $$$$
23
  $x++;
24
  $key = 'str';
25
  next;
26
 }
27
 #print $x, $_;
28
 if ($_ =~ /^\>/) {      #jei eilute prasideda: >
29
  chop();
30
  $_ =~ s/>  <//;
31
  $key = $_;
32
 } else {
33
  #$molekules[molekules nr.]{irasas}
34
  push @{ $molekules[$x]{$key} }, $_;
35
 }
36
}
37
close FILE;
38
#print STDERR Dumper \@molekules;
39
print $FILE, "\n";
40
41
42
#rasti nuo kur prasideda kitokia molekule
43
#pirmoji kita yra $ta_pati+1
44
kita();
45
sub kita {
46
$y=0;
47
print $y;
48
$ta_pati=0; 
49
while($molekules[$y]{'str'}) {
50
 #print STDERR Dumper $molekules[$y]{'str'}, "\n";
51
 $z=0;
52
 while($molekules[$y]{'str'}[$z]) {
53
  #jei z eilute nesutampa y ir y+1 nors karta tai kita molekule
54
  if ($molekules[$y]{'str'}[$z] ne $molekules[$y+1]{'str'}[$z]) {
55
   $ta_pati=$y;
56
   #print STDERR $y, " :", $molekules[$y]{'str'}[$z], " ir ", $molekules[$y+1]{'str'}[$z], "\n";
57
   last;
58
  }
59
  $z++;
60
 }
61
 last if ($ta_pati);
62
 $y++;
63
}
64
}
65-
print STDERR Dumper $molekules[$ta_pati+1]{'str'}, "\n";
65+
#print STDERR Dumper $molekules[0], "\n";
66
67
68
#Surinkti Ki vertes i du array:
69
$x=0;
70
while($molekules[$x]{'Enzymologic: Ki nM'}) {
71
#tik jei Ki apibrezta
72
if ($molekules[$x]{'Enzymologic: Ki nM'} > 0) {
73
 if ($x <= $ta_pati) {
74
  push @pirma, $molekules[$x]{'Enzymologic: Ki nM'};
75
 } else {
76
  push @antra, $molekules[$x]{'Enzymologic: Ki nM'};
77
 }
78
}
79
$x++;
80
}
81
print STDERR "Ki ", $molekules[0]{'BindingDB Display Name'}[0], " molekulei:\n";
82
print STDERR Dumper @pirma;
83
print STDERR "Ki ", $molekules[$ta_pati+1]{'BindingDB Display Name'}[0], " molekulei:\n";
84
print STDERR Dumper @antra;