-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetTmIMAGE.pl
executable file
·102 lines (87 loc) · 3.09 KB
/
getTmIMAGE.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/usr/bin/perl -w
use strict;
use FindBin;
use lib $FindBin::Bin;
use DrawUtils::Transmembrane;
$| = 1;
main:
{
my $id = $ARGV[0];
my $OB = {};
getDataFromFile($OB, $id);
createImage($OB, $id);
printImage($OB, $id);
}
sub getDataFromFile
{
my ($OBJ, $id) = @_;
$OBJ->{'SIGNAL'} = 0;
$OBJ->{'ANCHOR'} = 0;
$OBJ->{'NTERM'} = 'in';
$OBJ->{'TM_TOPOL'} = "";
my $i = 0;
open(IN, "<", "$id.featcfg");
while (<IN>)
{
chomp $_;
my @tmp = split(/\t/,$_);
$OBJ->{'SIGNAL'} = 1 if ($tmp[1] =~ /SIGNAL/);
$OBJ->{'ANCHOR'} = 1 if ($tmp[1] =~ /ANCHOR/);
$OBJ->{'NTERM'} = 'out' if (($tmp[1] =~ /SIGNAL/) || ($tmp[1] =~ /ANCHOR/));
if ($tmp[0] =~ /TM/)
{
$OBJ->{'TM'} = 1;
$OBJ->{'TM_TOPOL'} .= "$i\.$tmp[2]\,$tmp[3]\;";
$i++;
}
}
close(IN);
chop $OBJ->{'TM_TOPOL'} if ($OBJ->{'TM_TOPOL'} =~ /\;$/);
}
sub createImage
{
my ($OBJ, $id) = @_;
if (defined($OBJ->{'TM'}))
{
$OBJ->{'IMG'} = new Transmembrane(
-outside_label => 'Extracellular',
-inside_label => 'Cytoplasm',
-membrane_label => 'Membrane',
-vertical_padding => 50,
-horizontal_padding => 100,
-n_terminal_offset => 50,
-n_terminal_height => 220,
-c_terminal_offset => 30,
-c_terminal_height => 220,
-n_terminal => $OBJ->{'NTERM'},
-signal => $OBJ->{'SIGNAL'},
-anchor => $OBJ->{'ANCHOR'},
-helix_height => 60,
-helix_width => 30,
-short_loop_limit => 5,
-long_loop_limit => 10,
-n_terminal_height => 50,
-c_terminal_height => 50,
-topology_string => $OBJ->{'TM_TOPOL'},
#-labels => $OBJ->{'LABELS'},
-helix_label => 'helix',
-color_scheme => 'yellow'
);
}
}
sub printImage
{
my ($OBJ, $id)= @_;
my $fhPNG = new FileHandle("${id}_tm.png", 'w');
# Next block edited in this web server version in order to be compatible
# with FFPred 3, see "/webdata/binaries/current/FFPred3/README".
if (defined($OBJ->{'IMG'}))
{
print $fhPNG $OBJ->{'IMG'}->png;
}
else
{
print $fhPNG "NO TRANSMEMBRANE SEGMENTS\n";
}
$fhPNG->close;
}