3 use CXGN
::Page
::FormattingHelpers qw
/ page_title_html
6 #Get input, if this page is loaded from find_caps.pl
7 our $page = CXGN
::Page
->new( "Align Browser", "Chenwei");
8 my ($seq_data, $id_data, $format, $title, $type,
9 $show_prot_example, $show_cds_example, $show_id_example,
13 "seq_data", "id_data", "format", "title", "type",
14 "show_prot_example", "show_cds_example", "show_id_example",
15 "temp_file", "maxiters"
18 my ($intro_content, $input_content);
20 my $vhost_conf = CXGN
::VHost
->new();
21 our $HTML_ROOT = $vhost_conf->get_conf('basepath');
22 our $DOC_PATH = $vhost_conf->get_conf('tempfiles_subdir').'/align_viewer';
23 our $PATH = $HTML_ROOT . $DOC_PATH;
24 unless($temp_file =~ /\//){
25 $temp_file = $PATH . "/" . $temp_file;
30 $seq_data .= $_ while (<FH
>);
35 #############################################################
36 #Create introduction content'
37 $intro_content = <<HTML;
38 <p>This tool analyzes sequence alignment. Please input <b>aligned sequences only</b>, in either fasta or clustal format.</p>
39 Its functionality includes:
41 <li>Image display.</li>
42 <li>Calculation and output of pairwise similaity and putative splice variant or allelle pairs based on overlap and similarity between sequence pairs in an alignment.</li>
43 <li>Provides the user with options to hide some alignment sequences so that they are not included in the analysis.</li>
44 <li>Select a range of sequences to be analyzed.</li>
45 <li>Assess how an alignment member overlap with other members.</li>
46 <li>Calculate the non-gap mid point of each align sequence and group the sequences according to their overlap.</li>
52 #############################################################
54 $input_content = <<HTML;
55 <form method="post" action="show_align.pl" name="aligninput" enctype="multipart/form-data">
57 <input type="submit" name="submit" value="Analyze Alignment" /><br /><br />
58 <b>Title (optional): </b>
59 <input type="textbox" name="title" size="16" value="$title">
64 if(!$type) { $type = "pep" }
65 my %type_checked = ( pep
=> "", nt
=> "", cds
=> "" );
66 $type_checked{$type} = "checked=\"checked\"";
67 my ($tcn, $tcp, $tcc) = map { $type_checked{$_} } qw
/ nt pep cds /;
69 $input_content .= <<HTML;
70 <b>Type</b>
71 <input id="aligninput.radio.nt" type="radio" name="type" value="nt" $tcn/>nucleotide
72 <input id="aligninput.radio.pep" type="radio" name="type" value="pep" $tcp/>peptide
73 <input id="aligninput.radio.pep" type="radio" name="type" value="cds" $tcc/>CDS (most powerful)
77 #############################
78 #Input format let it be unaligned by default
79 if (!$format) { $format="fasta_unaligned"; }
81 my %format_checked = ( clustalw
=> "",
83 fasta_unaligned
=> "",
86 $format_checked{$format}="checked=\"checked\"";
88 my ($fcw, $fcf, $fcu) = map { $format_checked{$_} } qw
/clustalw fasta fasta_unaligned/;
90 $input_content .= <<HTML;
91 <b>Input format</b><br />
92 You may specify the species of the sequence with a forward slash, e.g. "AT1G01010.1/Arabidopsis" <br />
93 Make sure all the spaces in the id and species are replaced by '_'.<br />
94 <input type="radio" name="format" value="clustalw" $fcw/>Clustal Alignment<a target="blank" href="/about/clustal_file.pl"> [What is this?]</a><br />
95 <input type="radio" name="format" value="fasta" $fcf/>Fasta Alignment (With Gaps)<br /><br />
96 <input type="radio" name="format" value="fasta_unaligned" $fcu/>Fasta Unaligned (Will be aligned with <a href="http://www.drive5.com/muscle/">Muscle 3.6</a>, Limited to 200 Sequences)<br />
98 Max Iterations
99 <input type="text" name="maxiters" value=$maxiters>
100 Use more iterations for greater accuracy. The maximum is 1000.<br /><br />
102 <input type="radio" name="run" value="cluster" checked="1">run on cluster (preferred)<br />
103 <input type="radio" name="run" value="local">run on localhost<br /><br />
107 if($show_prot_example){
108 $seq_data = seq_from_file
($page->path_to("cgi-bin/tools/align_viewer/data/prot_example.txt"));
110 elsif($show_cds_example){
111 $seq_data = seq_from_file
($page->path_to("cgi-bin/tools/align_viewer/data/cds_example.txt"));
113 elsif($show_id_example){
114 $id_data = <<HEREDOC;
115 SGN-U282881 SGN-U228103 At1g09155.1 At1g56240.1 At1g56250.1 NP_178331.2 At2g02350.1 At2g02320.1 At2g02340.1 At2g02360.1 At2g02250.1 At2g02240.1 At2g02300.1 At2g02310.1 SGN-U211584 SGN-U219097 SGN-U219098 SGN-U311800 SGN-U218282 SGN-U218283 At5g24560.1 SGN-U204215 SGN-U221580 SGN-U282885 SGN-U234276 SGN-U220091 SGN-U305684 SGN-U219720
120 ###############################
121 #Text area for input sequences
122 $input_content .= <<HTML;
123 <b>Input fasta/clustal sequences</b>
125 <a href="index.pl" onclick="
126 document.getElementById('textarea_seq_data').value = '';
127 return false">(x) Clear</a><br />
128 <textarea id="textarea_seq_data" name="seq_data" rows="12" cols="80">$seq_data</textarea><br /><br />
129 <b>Or use identifiers, separated by spaces</b><br />
130 Supports TAIR AGI [AT1G01010.1], SGN Unigene [SGN-U332332], or any NCBI/Entrez identifier<br />
131 <textarea id="textarea_id_data" name="id_data" rows="2" cols="80">$id_data</textarea><br /><br />
132 <b>Or upload a fasta/clustal file</b> <input type="file" name="upload" /><br />
136 <input type="submit" name="submit" value="Analyze Alignment" />
147 my $example_link = <<HTML;
148 <span style="color:#669">
149 <a href="index.pl?&format=fasta&title=Alignment%20Example&type=pep&show_prot_example=1">
152 <a href="index.pl?&format=fasta_unaligned&maxiters=300&title=CDS%20Example&type=cds&show_cds_example=1">Unaligned Example</a>
154 <a href="index.pl?&maxiters=10&title=ID%20Input%20Example&&type=pep&format=fasta_unaligned&show_id_example=1">ID Input Example</a>
158 print page_title_html
("Alignment Analyzer");
160 #print blue_section_html('Introduction','<table width="100%" cellpadding="5" cellspacing="0" border="0" summary=""><tr><td>' . $intro_content . '</td></tr></table>');
162 print blue_section_html
(
163 "<span style=\"white-space:nowrap\">Query Input $example_link</span>",
164 '<table width="100%" cellpadding="5" cellspacing="0" border="0" summary=""><tr><td>' . $input_content . '</td></tr></table>');
173 open(FH
, $file) or return "File not found";
174 $seq .= $_ while(<FH
>);