-
Notifications
You must be signed in to change notification settings - Fork 7
/
create_npz.pl
executable file
·84 lines (71 loc) · 2.35 KB
/
create_npz.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/perl
## Pombert Lab 2020
my $version = '0.2';
my $name = 'create_npz.pl';
my $updated = '2021-07-23';
use strict;
use warnings;
use Getopt::Long qw(GetOptions);
use File::Basename;
## Usage definition
my $USAGE = <<"OPTIONS";
NAME ${name}
VERSION ${version}
UPDATED ${updated}
SYNOPSIS Creates .npz files with trRosetta from .a3m files created by hhblits
REQUIREMENTS trRosetta - https://github.com/gjoni/trRosetta
tensorflow 1.15 - https://www.tensorflow.org/
NOTES Probably best to run in a conda environment...
NOTES Can quickly eat through 8 Gb of VRAM with large a3m files...
NOTES If so, instead try with: pip install tensorflow-cpu==1.15
COMMAND ${name} \\
-a HHBLITS/*.a3m \\
-o NPZ/ \\
-t /media/Data_3/opt/trRosetta
OPTIONS:
-a (--a3m) .a3m files generated by hhblits
-o (--output) Output folder [Default: ./]
-t (--trrosetta) trRosetta installation directory (TRROSETTA_HOME)
-m (--model) trRosetta model directory [Default: model2019_07]
NOTE: The -t option is not required if the environment variable TRROSETTA_HOME is set, e.g.:
export TRROSETTA_HOME=/opt/tRosetta
OPTIONS
die "\n$USAGE\n" unless @ARGV;
## Defining options
my @a3m;
my $out = './';
my $trrosetta_home;
my $model = 'model2019_07';
GetOptions(
'a|a3m=s@{1,}' => \@a3m,
'o|output=s' => \$out,
't|trrosetta=s' => \$trrosetta_home,
'm|model=s' => \$model
);
### Checking for tRosetta installation; environment variables in Perl are loaded in %ENV
# Checking installation folder
if (!defined $trrosetta_home){
if (exists $ENV{'TRROSETTA_HOME'}){ $trrosetta_home = $ENV{'TRROSETTA_HOME'}; }
else {
print "WARNING: The trRosetta installation directory is not set as an environment variable (\$TRROSETTA_HOME) and the -r option was not entered.\n";
print "Please check if trRosetta was installed properly\n\n";
exit;
}
}
elsif (defined $trrosetta_home){
unless (-d $trrosetta_home){ die "WARNING: Can't find trRosetta installation folder: $trrosetta_home. Please check command line\n\n"; }
}
## Working on a3m files
unless (-d $out){
mkdir ($out,0755) or die "Can't create folder $out: $!\n";
}
while (my $a3m = shift@a3m){
my($name, $dir) = fileparse($a3m);
my ($prefix) = $name =~ /^(\S+)\.(\w+)$/;
print "\nWorking on file: $name\n\n";
system "python \\
$trrosetta_home/network/predict.py \\
-m $trrosetta_home/$model \\
$a3m \\
$out/$prefix.npz";
}