ConnectorSet/Uniprot.pm untested

filter: Statementstmt 0.0% 0 / 134 Branchbran 0.0% 0 / 60 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 219 CC 31 SCAR 68.1
CC
31
Cov
0%
parse_entry
992.0
BEGIN
2.0
BEGIN
2.0
CRAP 904.6
1 package Bio::ConnectDots::ConnectorSet::Uniprot;
2  
3 use strict;
4 use vars qw(@ISA);
5 use Bio::ConnectDots::ConnectorSet;
6 @ISA = qw(Bio::ConnectDots::ConnectorSet);
7  
8 sub parse_entry {
9 my ($self) = @_;
10 my $input_fh = $self->input_fh;
11  
12 while (<$input_fh>) {
13 chomp;
14 if (/^\/\//) {
15 next unless $self->have_dots;
16 return 1;
17 } #end of if
18 if (/^ID/) {
19 my ( $field, $SP_entry_id, $others ) = split /\s+/;
20 $self->put_dot( 'SwissProtEntryName', $SP_entry_id );
21 }
22 if (/^AC/) {
23 my ( $field, $SwissProt ) = split /\s+/;
24 chop($SwissProt);
25 $self->put_dot( 'SwissProt', $SwissProt );
26 }
27  
28 # important that this comes before any entries in the entry that are after DE
29 if (/^DE/) {
30 my ( $field, $desc ) = /(^DE)\s+(.*)$/;
31 my $cont = 1;
32 while ($cont) {
33 $_ = <$input_fh>;
34 if (/^DE/) {
35 my ( $label, $desc_more ) = /(^DE)\s+(.*)$/;
36 $desc .= " $desc_more";
37 }
38 else { $cont = 0; }
39 }
40 $self->put_dot( 'Protein_Desc', $desc );
41 }
42 if (/^OS/) {
43 my ( $field, $Organism ) = /(^OS)\s+(.*)$/;
44 chop($Organism);
45 $self->put_dot( 'Organism', $Organism );
46 }
47 if (/^OX/) {
48 my ( $field, $taxID ) = split /\s+/;
49 chop($taxID);
50 $self->put_dot( 'NCBI_taxID', $taxID );
51 }
52  
53 if (/^RX/) {
54 my @RX = split /\s+/;
55 for my $rx (@RX) {
56 $rx =~ s/;//;
57 if ( $rx =~ /MEDLINE/ ) {
58 my ( $tmp, $medline ) = split( '=', $rx );
59 $self->put_dot( 'MEDLINE', $medline );
60 }
61 if ( $rx =~ /PubMed/ ) {
62 my ( $tmp, $pubmed ) = split( '=', $rx );
63 $self->put_dot( 'PubMed', $pubmed );
64 }
65 }
66 }
67  
68 if (/^CC.*-!- FUNCTION:/) {
69 my $function =~ /^CC.*-!- FUNCTION:\s*(.*)/;
70 my $cont = 1;
71 while ($cont) {
72 $_ = <$input_fh>;
73 chomp;
74 if (/^CC/ && !/^CC\s+-!-/) {
75 my $more = /^CC\s+(.*)$/;
76 $function .= " $more";
77 }
78 else { $cont = 0; }
79 }
80 $self->put_dot( 'Function', $function );
81 }
82 if (/^CC.*-!- CATALYTIC ACTIVITY:/) {
83 my $catyl =~ /^CC.*-!- CATALYTIC ACTIVITY:\s*(.*)/;
84 my $cont = 1;
85 while ($cont) {
86 $_ = <$input_fh>;
87 chomp;
88 if (/^CC/ && !/^CC\s+-!-/) {
89 my $more = /^CC\s+(.*)$/;
90 $catyl .= " $more";
91 }
92 else { $cont = 0; }
93 }
94 $self->put_dot( 'Catalytic_Activity', $catyl );
95 }
96 if (/^CC.*-!- SUBUNIT:/) {
97 my $subunit =~ /^CC.*-!- SUBUNIT:\s*(.*)/;
98 my $cont = 1;
99 while ($cont) {
100 $_ = <$input_fh>;
101 chomp;
102 if (/^CC/ && !/^CC\s+-!-/) {
103 my $more = /^CC\s+(.*)$/;
104 $subunit .= " $more";
105 }
106 else { $cont = 0; }
107 }
108 $self->put_dot( 'Subunit', $subunit );
109 }
110 if (/^CC.*-!- TISSUE SPECIFICITY:/) {
111 my $tissue =~ /^CC.*-!- TISSUE SPECIFICITY:\s*(.*)/;
112 my $cont = 1;
113 while ($cont) {
114 $_ = <$input_fh>;
115 chomp;
116 if (/^CC/ && !/^CC\s+-!-/) {
117 my $more = /^CC\s+(.*)$/;
118 $$tissue .= " $more";
119 }
120 else { $cont = 0; }
121 }
122 $self->put_dot( 'Tissue', $tissue );
123 }
124  
125 if (/^DR/) {
126 my @DR = split /\s+/;
127 if ( $DR[1] eq 'EMBL;' ) {
128 chop( $DR[2] );
129 $self->put_dot( 'EMBL_mRNA_protein', $DR[2] );
130 }
131 if ( $DR[1] eq 'PIR;' ) {
132 chop( $DR[2] );
133 $self->put_dot( 'PIR', $DR[2] );
134 }
135 if ( $DR[1] eq 'InterPro;' ) {
136 chop( $DR[2] );
137 $self->put_dot( 'InterPro', $DR[2] );
138 }
139 if ( $DR[1] eq 'pfam;' ) {
140 chop( $DR[2] );
141 $self->put_dot( 'pfam', $DR[2] );
142 }
143 if ( $DR[1] eq 'TIGRFAMs;' ) {
144 chop( $DR[2] );
145 $self->put_dot( 'TIGRFAMs', $DR[2] );
146 }
147  
148 }
149
150 if (/^KW/) {
151 chomp;
152 my ($keywords) =~ /^KW\s*(.*)/;
153 my $cont = 1;
154 while ($cont) {
155 $_ = <$input_fh>;
156 chomp;
157 if (/^KW/) {
158 my ($more) = /^KW\s+(.*)$/;
159 $keywords .= " $more";
160 }
161 else { $cont = 0; }
162 }
163 $self->put_dot( 'Keywords', $keywords );
164  
165 }
166
167 if (/^GN/) {
168 chomp;
169 my ($gene_name, $alias) =~ /^GN\s+Name=(.+);\s+Synonyms=(.+);/;
170 $self->put_dot( 'Gene_Name', $gene_name);
171 $self->put_dot( 'Alias_Symbol', $alias);
172 }
173
174 if (/^\/\//) {
175 next unless $self->have_dots;
176 return 1;
177 } #end of if
178  
179 } #end of while
180 return undef;
181 } #end of sub
182  
183 1;