ConnectorSet/IPI.pm untested

filter: Statementstmt 0.0% 0 / 123 Branchbran 0.0% 0 / 56 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 184 CC 29 SCAR 66.7
CC
29
Cov
0%
parse_entry
870.0
BEGIN
2.0
BEGIN
2.0
CRAP 788.6
1 package Bio::ConnectDots::ConnectorSet::IPI;
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, $IPI, $others ) = split /\s+/;
20 $self->put_dot( 'IPI_id', $IPI );
21 $IPI =~ s/\.[0123456789]$//;
22 $self->put_dot( 'IPI_id_old', $IPI );
23 }
24 if (/^AC/) {
25 my ( $field, @retired ) = split /\s+/;
26 foreach my $id (@retired) {
27 $id =~ s/;//g;
28 $self->put_dot( 'Retired_id', $id );
29 }
30 }
31 if (/^DE/) {
32 my ( $field, $prot_name ) = /(^DE)\s+(.+)$/;
33 $prot_name =~ s/.$//;
34 $self->put_dot( 'Protein_Name', $prot_name );
35 }
36 if (/^OS/) {
37 $_ =~ /^OS\s+(\w+\s+\w+)\s+\(.+\)\./;
38 my $organism = $1;
39 $self->put_dot( 'Organism', $organism );
40 }
41 if (/^OX/) {
42 my ( $field, $TaxID ) = split /\s+/;
43 $TaxID =~ s/NCBI_TaxID=//g;
44 $TaxID =~ s/;//g;
45 $self->put_dot( 'NCBI_taxID', $TaxID );
46 }
47  
48 if (/^DR/) {
49 my @DR = split /\s+/;
50 if ( $DR[1] eq 'REFSEQ_XP;' ) {
51 chop( $DR[2] );
52 $DR[2] =~ s/;$//g;
53 $self->put_dot( 'REFSEQ_XP', $DR[2] );
54  
55 if ( $DR[3] =~ /GI:/ ) {
56 $DR[3] =~ s/^GI://g;
57 $DR[3] =~ s/;$//g;
58 $self->put_dot( 'GI', $DR[3] );
59 }
60 }
61 if ( $DR[1] eq 'PRINTS;' ) {
62 chop( $DR[2] );
63 $DR[2] =~ s/;//g;
64 $self->put_dot( 'PRINTS', $DR[2] );
65 }
66 if ( $DR[1] eq 'InterPro;' ) {
67 chop( $DR[2] );
68 $DR[2] =~ s/;//g;
69 $self->put_dot( 'InterPro', $DR[2] );
70 }
71 if ( $DR[1] eq 'Pfam;' ) {
72 chop( $DR[2] );
73 $DR[2] =~ s/;//g;
74 $self->put_dot( 'pfam', $DR[2] );
75 }
76 if ( $DR[1] eq 'ProDom;' ) {
77 chop( $DR[2] );
78 $DR[2] =~ s/;//g;
79 $self->put_dot( 'ProDom', $DR[2] );
80 }
81 if ( $DR[1] eq 'SMART;' ) {
82 chop( $DR[2] );
83 $DR[2] =~ s/;//g;
84 $self->put_dot( 'SMART', $DR[2] );
85 }
86 if ( $DR[1] eq 'PROSITE;' ) {
87 chop( $DR[2] );
88 $DR[2] =~ s/;//g;
89 $self->put_dot( 'PROSITE', $DR[2] );
90 }
91 if ( $DR[1] eq 'HUGO;' ) {
92 chop( $DR[3] );
93 $DR[3] =~ s/;//g;
94 $self->put_dot( 'HUGO', $DR[3] );
95 }
96 if ( $DR[1] eq 'LocusLink;' ) {
97 chop( $DR[2] );
98 $DR[2] =~ s/;//g;
99 $self->put_dot( 'LocusLink', $DR[2] );
100 }
101 if ( $DR[1] eq 'GO;' ) {
102 chop( $DR[2] );
103 $DR[2] =~ s/;//g;
104 $self->put_dot( 'GO_id', $DR[2] );
105 }
106 if ( $DR[1] eq 'UniProt/Swiss-Prot;' ) {
107 chop( $DR[2] );
108 $DR[2] =~ s/;//g;
109 $DR[2] =~ s/-\d//g;
110 $self->put_dot( 'SwissProt', $DR[2] );
111 }
112 if ( $DR[1] eq 'REFSEQ_NP;' ) {
113 chop( $DR[2] );
114 $DR[2] =~ s/;$//g;
115 $self->put_dot( 'REFSEQ_NP', $DR[2] );
116  
117 if ( $DR[3] =~ /GI:/ ) {
118 $DR[3] =~ s/^GI://g;
119 $DR[3] =~ s/;$//g;
120 $self->put_dot( 'GI', $DR[3] );
121 }
122 }
123 if ( $DR[1] eq 'UniProt/TrEMBL;' ) {
124 /^DR\s+UniProt\/TrEMBL;\s*(.*)$/;
125 $self->put_dot( 'TREMBL', $1 );
126 }
127 if ( $DR[1] eq 'TIGRFAMs;' ) {
128 chop( $DR[2] );
129 $DR[2] =~ s/;//g;
130 $self->put_dot( 'TIGRFAMs', $DR[2] );
131 }
132 if ( $DR[1] eq 'ENSEMBL;' ) {
133 chop( $DR[2] );
134 $DR[2] =~ s/;$//g;
135 $self->put_dot( 'ENSEMBL_peptide', $DR[2] );
136  
137 $DR[3] =~ s/;$//g;
138 $self->put_dot( 'ENSEMBL_gene', $DR[3] );
139 }
140 if ( $DR[1] eq 'RZPD;' ) {
141 /^DR\s+RZPD;\s*(.*)$/;
142 $self->put_dot( 'RZPD', $1 );
143 }
144 if ( $DR[1] eq 'Genew;' ) {
145 /^DR\s+Genew;\s*(.*)$/;
146 $self->put_dot( 'Genew', $1 );
147 }
148 } #if DR
149 if (/^SQ/) {
150 my @SQ = split /\s+/;
151 $self->put_dot( 'AA_length', $SQ[2] );
152 $self->put_dot( 'Molecular_Weight', $SQ[4] );
153  
154 # # process sequence
155 # my $cont = 1;
156 # my $sequence;
157 # while ($cont) {
158 # $_ = <$input_fh>;
159 # chomp;
160 # if (/^\s+/) {
161 # s/\s//g; # remove white spaces between sets of 10 AAs
162 # $sequence .= $_;
163 # }
164 # else { $cont = 0; }
165 # }
166 # $self->put_dot( 'Protein_Sequence', $sequence );
167 # if (/^\/\//) {
168 # next unless $self->have_dots;
169 # return 1;
170 # }
171 } # end SQ
172 } #end of while
173 return undef;
174 } #end of sub
175  
176 1;