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" if (@ARGV != 1);
- $FILE = $ARGV[0];
- 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 $FILE, "\n";
- #rasti nuo kur prasideda kitokia molekule
- #pirmoji kita yra $ta_pati+1
- kita();
- sub kita {
- $y=0;
- print $y;
- $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[$ta_pati+1]{'str'}, "\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement