ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/pdbHighlight/scopHighlight_using_SCOP_RDB.plx
Revision: 1.1.1.1 (vendor branch)
Committed: Tue Feb 24 01:07:50 2004 UTC (12 years, 6 months ago) by dmb
Branch: START, MAIN
CVS Tags: HEAD, HEAD
Changes since 1.1: +0 -0 lines
Log Message:
First Import

Line File contents
1 #! /usr/bin/perl -w
2
3 # Released under the terms of the BiO Licence.
4 # http://biomatics.kaist.ac.kr/Research/Biolicense/
5
6 use strict;
7 use Getopt::Long;
8
9 use lib '/BiO/Research/Perl/Modules/';
10
11 use Mysql::Simple 'doQuery';
12 use PSIMAP '$scopDb';
13
14 my $PDB;
15
16 GetOptions (
17 "pdb=s" => \$PDB,
18 );
19
20 die( &usage ) unless $PDB;
21
22
23 my @color = qw(
24 Red
25 Green
26 Blue
27 Cyan
28 Magenta
29 Yellow
30 Orange
31 SeaGreen
32 Pink
33 SkyBlue
34 Gold
35 Brown
36 HotPink
37 Purple
38 BlueTint
39 Grey
40 GreenBlue
41 PinkTint
42 GreenTint
43 RedOrange
44 Violet
45 YellowTint
46 );
47
48
49 # Get domain data.
50
51 my $domain =
52 doQuery("
53 SELECT PDB, SUNID, SID, SCCS, DOMAIN
54 FROM $scopDb.domain
55 WHERE PDB = '$PDB'
56 ") or die "DBI::errstr\n";
57
58 die "$PDB NOT FOUND IN $scopDb\n" unless @$domain;
59
60
61 my $time = localtime();
62
63 print "
64 load inline
65 echo Protein Contact DB: $PDB\t$time
66 echo Author: Dan Bolser (MRC Dunn)
67 echo \n\n";
68
69 my %sccs; # Checks for
70 my %color; # multi groups.
71
72 # For each domain
73
74 for (my $i=0; $i<@$domain; $i++){
75
76 my ($pdb, $sunid, $sid, $sccs, $domainDef) = @{$domain->[$i]};
77
78 # Define domain name alias
79 my $color = $color[$i%@color];
80
81 # Spit some information
82 warn join("\t", $i, @{$domain->[$i]}, $color), "\n";
83
84 # Format SCCS for rasmol
85 my $sccs_name = $sccs;
86 $sccs_name =~ tr/\./_/;
87
88
89
90 # Deal with SCCS groups.
91 unless ( $sccs{$sccs} ){
92 print "
93 define $sccs_name
94 ";
95 $sccs{$sccs}++;
96 }
97
98 # Deal with color groups.
99 unless ( $color{$color} ){
100 print "
101 define x$color
102 ";
103 $color{$color}++;
104 }
105
106
107
108 # Format some text
109 my $details = sprintf( "%12s: %3s %5s %5s %-15s %-15s %8s\n",
110 ("DOMAIN($i)", $pdb, $sunid, $sid, $sccs_name, $domainDef, $color));
111
112 # Convert SCOP domain definition into rasmol format.
113 my $selectDomain
114 = &scop2rasmol( $domainDef );
115
116
117 # Do the main
118
119 print "
120 echo $details
121
122 select $selectDomain # Select domain
123 color $color\n # Color domain.
124
125 define px$sunid selected # Define alias...
126 define No$i selected # ...
127
128 # select within(5.0,selected) # Select domain contacts!
129
130 # define surf_px$sunid selected # Define alias...
131 # define surf_No$i selected
132
133
134 select px$sunid # Handle multi domain alias
135
136 select x$color # ...
137 define x$color selected, $selectDomain # ...
138
139 select $sccs_name # ...
140 define $sccs_name selected, $selectDomain # ...
141
142
143 select !* # Reset selection.
144 \n\n";
145 }
146
147 print "
148 select *
149 \n
150 echo
151 echo Each domain is defined as...
152 echo px00000 (scop sunid)
153 echo a_1_1_1_1 (scop sccs)
154 echo xCOLOR (COLOR = rasmol color, eg xRed)
155 echo No1 (n = domain number, eg No1)
156 echo
157 \n
158 exit # These newlines are important!
159 \n\n";
160
161 warn "OK\n";
162
163
164
165
166 sub scop2rasmol {
167 my $scopDomainDefinition = shift;
168 my @rasmolSelect;
169
170 # Split the domain definition into components.
171
172 foreach ( split(/,/, $scopDomainDefinition) ){
173
174 if ( /^(.{1}):$/o ){ push @rasmolSelect, "*$1" } # X:
175 elsif ( /^((?:-|)\d+)(?:\D|)-((?:-|)\d+)(?:\D|)$/o ){ push @rasmolSelect, "$1-$2" } # 40-90
176 elsif ( /^(.{1}):((?:-|)\d+)(?:\D|)-((?:-|)\d+)(?:\D|)$/o ){ push @rasmolSelect, "$2-$3$1" } # X:40-90
177 elsif ( /^-$/o ){ push @rasmolSelect, "*" } # -
178 else {
179 die "$_:BAD DOMAIN DEF!\n"
180 }
181 }
182 my $rasmolSelectString = join(",", @rasmolSelect);
183
184 return $rasmolSelectString;
185 }
186
187 sub usage{
188 warn <<"EOS";
189
190 Create a rasmol script for defining the SCOP domain structure of a PDB.
191
192 USAGE:
193 $0 PDBCode
194
195 EOS
196 }