4 use CXGN
::Page
::FormattingHelpers qw
/ page_title_html
8 use CXGN
::DB
::Connection
;
9 use CXGN
::Transcript
::Unigene
;
10 use CXGN
::Transcript
::CDS
;
13 my $page = CXGN
::Page
->new( "ESTScan Details", "Chenwei Lin");
14 my ($unigene_id) = $page->get_encoded_arguments("unigene_id");
17 my $dbh = CXGN
::DB
::Connection
->new();
20 my $unigene = CXGN
::Transcript
::Unigene
->new($dbh, $unigene_id);
21 my $unigene_seq = uc($unigene->get_sequence());
22 my @cds = $unigene->get_cds_list(); ##gets list of cds ids associated with the given unigene_id
24 my $estscan_pep_content = "";
25 my $estscan_clean_cds_content = "";
26 my $estscan_edit_cds_content = "";
27 my $direction_content = "";
28 my $score_content = "";
31 foreach my $c (@cds) {
32 if ($c->get_method() eq "estscan") {
33 my $seq_text = $c->get_seq_text();
34 my $seq_edits = $c->get_seq_edits();
35 my $protein_seq = $c->get_protein_seq();
36 my $begin = $c->get_begin();
37 my $end = $c->get_end();
38 my $direction = $c->get_direction();
39 my $score = $c->get_score();
41 $estscan_pep_content = html_break_string
($protein_seq,90);
42 $estscan_clean_cds_content = html_break_string
($seq_edits,90);
43 $estscan_pep_content = qq{<tr
><td
class="sequence">$estscan_pep_content</td></tr
>};
44 $estscan_clean_cds_content = qq{<tr
><td
class="sequence">$estscan_clean_cds_content</td></tr
>};
45 $direction_content = ($direction eq 'F')
46 ?
'<tr><td>Forward</td></tr>'
47 : '<tr><td>Reverse</td></tr>';
49 $score_content = "<tr><td>$score</td></tr>";
51 $estscan_edit_cds_content = reformat_unigene_sequence_with_edits
($c,$unigene_seq, $direction, $begin, $end, $seq_text);
56 my $note_content = <<EOH;
57 <br /><span style="color: blue">ACTGX</span><span style="color: gray"> -- Inserted by ESTScan</span>
58 <br /><span style="color: red">actgn</span><span style="color: gray"> -- Deleted by ESTScan</span>
59 <br /><span style="color: gray">ACTGN</span><span style="color: gray"> -- UTR Deleted by ESTScan</span>
64 print page_title_html
("ESTScan Details for Unigene SGN-U$unigene_id");
65 print blue_section_html
('Score','<table width="100%" cellpadding="0" cellspacing="0" border="0">'.$score_content.'</table>');
66 print blue_section_html
('Direction', '<table width="100%" cellpadding="0" cellspacing="0" border="0">'.$direction_content.'</table>');
67 print blue_section_html
('Predicted Peptide Sequence','<table width="100%" cellpadding="0" cellspacing="0" border="0">'.$estscan_pep_content.'</table>');
68 print blue_section_html
('Predicted Coding Sequence','<table width="100%" cellpadding="0" cellspacing="0" border="0">'.$estscan_clean_cds_content.'</table>');
69 print blue_section_html
('Edits in Original Sequence','<table width="100%" cellpadding="0" cellspacing="0" border="0">'.$estscan_edit_cds_content.'<tr><td>'. $note_content.'</td></tr>'.'</table>');
80 <b>No unigene search criteria specified</b>
90 my ($unigene_id) = @_;
96 <b>The specified unigene identifer ($unigene_id) does not result in a valid search.</b>
105 sub reformat_unigene_sequence_with_edits
{
108 my $unigene_seq = shift;
109 my $direction = shift;
112 my $seq_text = shift;
113 my $estscan_edit_cds_content = "";
115 #correctly gets reverse compliment of a unigene sequence
116 if ($direction eq 'R'){
117 my $u = Bio
::Seq
->new();
118 $u->seq($unigene_seq);
119 my $rc = $u->revcom();
120 $unigene_seq = $rc->seq();
122 my $up_seq = substr($unigene_seq, 0, ($begin-1));
123 my $down_seq = substr($unigene_seq,$end);
125 $down_seq =~ s/\s//g;
127 $seq_text =~ s/\s//g;
129 $seq_text = "${up_seq}(5')${seq_text}(3')${down_seq}";
130 $estscan_edit_cds_content = html_break_string
($seq_text,90);
132 #my @text_components = split /\(5'\)|\(3'\)/,$estscan_edit_cds_content; ##doesn't split if the (5') or (3') markers are split on two lines
133 my @text_components = split /5|3/,$estscan_edit_cds_content;
136 ##Color the edited nucleotides
137 foreach my $comp (@text_components) {
138 $comp =~ s/[\(\)\']//g;
139 $comp =~ s!([actgn])!<span style="color: red">$1</span>!g;
140 $comp =~ s!X!<span style="color: blue">X</span>!g;
144 $estscan_edit_cds_content = qq{<span style
="color: gray">$text_components[0]</span>(5')$text_components[1](3')<span style="color: gray">$text_components[2]</span
>};
146 $estscan_edit_cds_content = qq{<tr
><td
class="sequence">$estscan_edit_cds_content</td></tr
>};
148 return $estscan_edit_cds_content;