GBrowse

 view release on metacpan or  search on metacpan

conf/plugins/PrimerDesigner.pm  view on Meta::CPAN

print <<JS;


<script type="text/javascript">


    Controller.segment_info = { $segment_info_string };

    /*helper function to create a form*/
    oPrimerDesigner.getNewSubmitForm = function (){
	var submitForm = document.createElement("form");
	document.body.appendChild(submitForm);
	submitForm.method = "post";
	return submitForm;
    }

    /*helper function to add elements to the form*/
    oPrimerDesigner.createNewFormElement = function (inputForm, elementName, elementValue){
	var newElement = document.createElement('input');
	newElement.name = elementName;
	newElement.type = 'hidden';
	newElement.value= elementValue
	inputForm.appendChild(newElement);
	return newElement;
    }

    /*Create submit form to get rubberband working*/
    //oPrimerDesigner.submitForm = oPrimerDesigner.getNewSubmitForm();
    //oPrimerDesigner.createNewFormElement(oPrimerDesigner.submitForm, "force_submit", "0");
    //oPrimerDesigner.createNewFormElement(oPrimerDesigner.submitForm, "plugin_action", "Go");

    //oPrimerDesigner.createNewFormElement(oPrimerDesigner.submitForm, "plugin", document.getElementsByName('plugin')[0].value);
    //oPrimerDesigner.submitForm.style.display = 'none';

    //var div = document.createElement('div');
    //div.innerHTML = '$div';
    //div.setAttribute('id', 'search_form_objects');
    //oPrimerDesigner.submitForm.appendChild(div);

    //document.searchform = oPrimerDesigner.submitForm;

    oPrimerDesigner.details_panel = document.getElementById('primer_panel');

    if (window.addEventListener) {  // W3C standard
	oPrimerDesigner.details_panel.addEventListener('mouseup', oPrimerDesigner.selectRegion, false); 
    } 
    else if (window.attachEvent) {  // Microsoft
	oPrimerDesigner.details_panel.attachEvent('onmouseup', oPrimerDesigner.selectRegion);
    }

</script>
JS



}

sub detail_select_menu {

<<DETAILS;
<div id="detailSelectMenu">
    <table style="width:100%">
	<tr>
	<th style="background:lightgrey;cell-padding:5">
	    SELECTION
	    <a style="right:0px;position:absolute;color:blue;cursor:pointer" 
		onclick="oPrimerDesigner.unselectRegion()">
	    [X]
	    </a> 
	</th>
	</tr>
	<tr>
	<td>
	    <a style="color:blue;cursor:pointer" onclick="oPrimerDesigner.designPrimers()" target="_BLANK">
	    Design primers for this region
	    </a>
	</td>
	</tr>
	<tr>
	<td>
	    <a style="color:blue;cursor:pointer" onclick="SelectArea.prototype.clearAndSubmit()">
	    Zoom in
	    </a>
	</td>
	</tr>
	<tr>
	<td>
	    <a style="color:blue;cursor:pointer" onclick="SelectArea.prototype.clearAndRecenter()">
	    Recenter on this region
	    </a>
	</td>
	</tr>
    </table>
</div>
DETAILS

}

sub design_primers {
  my ( $self, $segment, $lb, $rb ) = @_;
  my $conf    = $self->configuration;
  my %atts    = $self->get_primer3_params($lb,$rb);
  my $target  = $self->focus($segment);
  my $tlength = $rb - $lb || 1;
  my $offset  = $segment->start - 1;
  my $tstart  = $lb - $offset;
  my $exclude = join ',', $tstart, $tlength if $tlength > 1;

  $tstart += int(($rb - $lb)/2);
  my $ptarget = join ',', $tstart,1;
  
  # make the segment a manageable size 
  if (!$ptarget && $segment->length > DEFAULT_SEG_SIZE) {
    $segment = $self->refocus($segment, $target, DEFAULT_SEG_SIZE);
  }

  my $dna = $segment->seq;
  if ( ref $dna && $dna->can('seq') ) {
    $dna = $dna->seq;
  }
  elsif ( ref $dna ) {



( run in 3.121 seconds using v1.01-cache-2.11-cpan-cdf2f3d4e48 )