3 use CXGN
::DB
::Connection
;
4 use CXGN
::Marker
::Tools
;
6 use CXGN
::Accession
::Tools
;
10 my $dbh=CXGN
::DB
::Connection
->new();
12 my $login=CXGN
::Login
->new($dbh);
13 $login->verify_session();
15 my $page=CXGN
::Page
->new('cosii_submission.pl','john');
17 $page->header('Submit COSII primer experiment');
18 my($action,$marker_name,$accession_id,$primer_type,$temp,$mg,$bands)=$page->get_encoded_arguments('action','marker_name','accession_id','primer_type','temp','mg','bands');
22 if($action eq 'verify' or $action eq 'insert') {
23 my @marker_ids=CXGN
::Marker
::Tools
::marker_name_to_ids
($dbh,$marker_name);
26 $page->message_page("Marker '$marker_name' not found.");
29 #i don't want to write any error handling here, because all cosii marker names (currently) refer to one marker each
31 $page->message_page("Multiple markers found with name '$marker_name'. Please contact us to resolve this issue.");
34 ($marker_id)=@marker_ids;
37 my $accession=CXGN
::Accession
->new($dbh,$accession_id);
39 $page->message_page("Accession ID '$accession_id' not found in database");
41 $accession_name=$accession->verbose_name();
44 unless($primer_type eq 'iUPA' or $primer_type eq 'eUPA') {
45 $page->message_page("Primer type '$primer_type' is unknown");
49 unless($temp=~/^\d+$/) {
50 $page->message_page("Temperature '$temp' is unrecognized, please submit a whole number only");
53 $page->message_page("Temperature '$temp' is invalid");
57 unless(CXGN
::Tools
::Text
::is_number
($mg)) {
58 $page->message_page("Mg concentration is unrecognized, please submit a number or a number including one decimal point only");
62 unless($bands eq 'M' or $bands eq 'm' or $bands=~/^\d+$/ or $bands=~/^\d+\+\d+$/) {
63 $page->message_page("Band sizes are unrecognized, please see examples and be sure not to include any spaces in your input");
74 if($action eq 'verify')
76 print CXGN
::Page
::FormattingHelpers
::page_title_html
('Verify data');
77 print"<b>Marker name:</b> $marker_name (SGN-M$marker_id)<br />";
78 print"<b>Accession:</b> $accession_name (SGN accession ID:</b> $accession_id)<br />";
79 print"<b>Primer type:</b> $primer_type<br />";
80 print"<b>Temperature:</b> $temp<br />";
81 print"<b>Mg concentration:</b> $mg<br />";
82 print"<b>Bands:</b> $bands<br /><br />";
84 <form method="post" action="">
85 <input type="hidden" name="marker_id" value="$marker_id" />
86 <input type="hidden" name="marker_name" value="$marker_name" />
87 <input type="hidden" name="accession_id" value="$accession_id" />
88 <input type="hidden" name="primer_type" value="$primer_type" />
89 <input type="hidden" name="temp" value="$temp" />
90 <input type="hidden" name="mg" value="$mg" />
91 <input type="hidden" name="bands" value="$bands" />
92 <input type="hidden" name="action" value="insert" />
93 <input type="submit" value="Add new data" />
102 if($action eq 'insert')
104 print CXGN::Page::FormattingHelpers::page_title_html('Pretended to add this data');
105 print"<a href=\"/search/markers/markerinfo.pl?marker_id=$marker_id\">[View marker with new data]</a><br /><br />";
106 print"<b>Marker name:</b> $marker_name (SGN-M$marker_id)<br />";
107 print"<b>Accession:</b> $accession_name (SGN accession ID:</b> $accession_id)<br />";
108 print"<b>Primer type:</b> $primer_type<br />";
109 print"<b>Temperature:</b> $temp<br />";
110 print"<b>Mg concentration:</b> $mg<br />";
111 print"<b>Bands:</b> $bands<br />";
119 my $marker_name_filled_in='C2_At';
122 $marker_name_filled_in=$marker_name;
124 my $temp_filled_in='55';
127 $temp_filled_in=$temp;
129 my $mg_filled_in='1.5';
134 my $bands_filled_in='';
137 $bands_filled_in=$bands;
139 my @accessions=CXGN::Accession::Tools::all_accessions($dbh);
140 my $accessions_selector='<select name="accession_id">';
141 for my $accession_hash(sort {$a->{verbose_name} cmp $b->{verbose_name}} @accessions)
143 my $each_accession_id=$accession_hash->{accession_id};
144 my $each_accession_name=$accession_hash->{verbose_name};
145 #warn"$each_accession_id\n";
147 if($each_accession_id==$accession_id)
149 $selected=' selected="selected" ';
151 $accessions_selector.="<option value=\"$each_accession_id\" $selected>$each_accession_name</option>";
153 $accessions_selector.='</select>';
154 my $iupa_selected='checked="checked"';
155 my $eupa_selected='';
156 if($primer_type and $primer_type eq 'eUPA')
159 $eupa_selected='checked="checked"';
163 <form method
="post" action
="">
164 <table cellspacing
="10" cellpadding
="10" border
="0">
169 <input type
="text" name
="marker_name" value
="$marker_name_filled_in" /><br />
173 <input type
="radio" name
="primer_type" value
="iUPA" $iupa_selected />iUPA<br />
174 <input type
="radio" name
="primer_type" value
="eUPA" $eupa_selected />eUPA
182 <br
/>To add an accession to this list, <a href="/contact
/form">contact SGN</a>.
188 Temperature
(C
)<br
/>
189 <input type
="text" name
="temp" value
="$temp_filled_in" /><br />
192 Mg concentration
<br
/>
193 <input type
="text" name
="mg" value
="$mg_filled_in" /><br /><br
/>
200 <input type
="text" name
="bands" value
="$bands_filled_in" />
203 Band size examples
:<br
/>
204 1 band
: <b
>300</b><br />
205 2 bands separated by a
'+' sign
: <b
>300+500</b><br />
206 'M' for more than
2: <b
>M
</b
>
212 <input type
="hidden" name
="action" value
="verify" />
213 <input type
="submit" value
="Verify" />