Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- #VR
- #is *.mol isrenka ta kurio -SO2NH2 yra arciausiai Zn
- use Chemistry::MacroMol;
- use Chemistry::File::MDLMol;
- use Chemistry::File::PDB;
- use List::Util qw[min max];
- while (@ARGV[$x]) {
- $macromol = Chemistry::MacroMol->read("@ARGV[$x]");
- #print "\nTikrinamas ", @ARGV[$x], ": ";
- #imam Zn geroj padetyje
- $znmol = Chemistry::MacroMol->read("ZN.pdb");
- $Zn = $znmol->atoms_by_name('ZN');
- if ($topd > tikrinti(rastiN()) || $x == 0) {
- $topd = tikrinti(rastiN());
- $geriausias = $x;
- }
- $x++;
- }
- print @ARGV[$geriausias], "\n";
- sub tikrinti {
- @d = ();
- $i = 0;
- while (@_[$i]) {
- #print @S[$b]->distance($Zn), " ";
- @d[$i] = @_[$i]->distance($Zn);
- $i++;
- }
- return min(@d);
- }
- while (@ARGV[$x]) {
- $macromol = Chemistry::MacroMol->read("@ARGV[$x]");
- print "\nKeiciamas ", @ARGV[$x], ": ";
- keisti();
- $x++;
- }
- sub rastiN {
- @sulfonamidN = ();
- #surenkami visi S atomai
- @all_atoms = $macromol->atoms;
- $a = 0;
- @S = ();
- while (@all_atoms[$a]) {
- push (@S, @all_atoms[$a]) if (@all_atoms[$a]->symbol eq 'S');
- $a++;
- }
- #randami 6valenciu S atomu kaimynai
- @Skaimynai = ();
- $b = 0;
- while (@S[$b]) {
- push (@Skaimynai, @S[$b]->neighbors) if (@S[$b]->valence == 6);
- $b++;
- }
- #print "Skaimynai ", @Skaimynai;
- #isrenkami kaimynai N
- @kaimynaiN = ();
- $c = 0;
- while (@Skaimynai[$c]) {
- push (@kaimynaiN, @Skaimynai[$c]) if (@Skaimynai[$c]->symbol eq 'N');
- $c++;
- }
- #print " kaimynaiN ", @kaimynaiN;
- #randami ju kaimynai
- @Nkaimynai = ();
- $d = 0;
- while (@kaimynaiN[$d]) {
- @Nkaimynai = @kaimynaiN[$d]->neighbors;
- #isrenkami kaimynai H kuriu turi buti 2
- @kaimynaiH = ();
- $e = 0;
- while (@Nkaimynai[$e]) {
- push (@kaimynaiH, @Nkaimynai[$e]) if (@Nkaimynai[$e]->symbol eq 'H');
- $e++;
- }
- #print " kaimynaiH ", @kaimynaiH;
- if (@kaimynaiH == 2) {
- push (@sulfonamidN, @kaimynaiN[$d]);
- }
- $d++;
- @Nkaimynai = ();
- }
- #print " Nkaimynai ", @Nkaimynai;
- #print @sulfonamidN;
- return @sulfonamidN;
- print "\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement