-
Notifications
You must be signed in to change notification settings - Fork 0
/
mol2pdbqt.pl
executable file
·58 lines (45 loc) · 1.25 KB
/
mol2pdbqt.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/perl -w
use strict;
use warnings;
use Cwd;
use File::Copy;
my $original_dir=getcwd;
my @all_file_name;
opendir(DIR,$original_dir) || die $!;
@all_file_name=readdir(DIR);
close(DIR);
my @gene_name;
for my $i (0..$#all_file_name){
next if($all_file_name[$i]=~ /\.+$/);
next if($all_file_name[$i]=~ /git$/);
if(-d $all_file_name[$i]){
# print $all_file_name[$i]."\n";
push(@gene_name,$all_file_name[$i]);
}
}
for my $i (0..$#gene_name){
my $dir= "$original_dir/$gene_name[$i]/"."lig_file";
# print $dir;
my @drug_files;
opendir(DIR,$dir) || die "no this dir";
@drug_files = readdir(DIR);
close(DIR);
my @drug_mol2;
for my $i (0..$#drug_files){
next if($drug_files[$i]=~ /\.+$/);
if ($drug_files[$i]=~ /mol2$/){
push (@drug_mol2,$drug_files[$i]);
# print $drug_files[$i]."\n";
}
}
if(!(-d "$dir/old_mol2_files")){
mkdir ("$dir/old_mol2_files");
}
for my $i (0..$#drug_mol2){
my @arr=split('\.',$drug_mol2[$i]);
# print $arr[0]."\n";
# print "obabel -imol2 "."$dir"."$drug_mol2[$i]"." -opdbqt -O "."$dir"."$arr[0]".".pdbqt -h\n";
print `obabel -imol2 "$dir/$drug_mol2[$i]" -opdbqt -O "$dir/$arr[0]".pdbqt -h`;
move("$dir/$drug_mol2[$i]","$dir/old_mol2_files");
}
}