#!/usr/bin/perl use CGI; $q = new CGI; $input1 = $q->param('input1'); $input2 = $q->param('input2'); my $kd=$input1; my $miRNA=$input2; my $modelParameters = getUTRmod($kd); #print "$modelParameters\n"; $generatedSequences = `/home/httpd/embperl/GUI04/cgi-bin/igem_2010/Checkedscript.pl $miRNA`; chomp $generatedSequences; #open (MYFILE1, '>>blabla.txt') or die "Couldn't open file for processing"; #print MYFILE1 "$generatedSequences"; #close (MYFILE1); $TargetScanResult = `/home/httpd/embperl/GUI04/cgi-bin/igem_2010/TargetScanMod_arrayout.pl $miRNA $generatedSequences /home/httpd/embperl/GUI04/cgi-bin/igem_2010/predictions.txt /home/httpd/embperl/GUI04/cgi-bin/igem_2010/out.txt`; chop $TargetScanResult; #open (MYFILE, '>>lalala.txt') or die "Couldn't open file for processing"; #print MYFILE "$TargetScanResult"; #close (MYFILE); my @output = compare($modelParameters,$TargetScanResult); ########## # output 0 sequence 1 3p 2 au 3 perf 4 nperf 5 seed 6 bulge 7 nbs if ($output[5] == 1) { $seedtype = "7merA1"; } elsif ($output[5] == 2) { $seedtype = "7merM8" } elsif ($output[5] == 3) { $seedtype = "8mer" } if ($output[3] == 1) { $properties="Perfect matching binding site"; } elsif ($output[4] == 1) { $properties="Bulged binding site with a bulgesize of $output[6]"; } else { $properties="Binding site with a $seedtype-seed, a 3'-pairing contribution score of $output[1] and an AU-content score of $output[2]"; } my $forwardOligo = "CCGGG" . $output[0] . "TCTAGAGC"; my $reverseOligo = "TCGAGCTCTAGA" . (reverse comp($output[0])) . "C"; my $out1 = "shRNA: $miRNA"; my $out2 = "Binding site: $output[0]"; my $out3 = "Model calculated knockdown: $knockdownModelret"; my $out4 = "Binding site properties: $properties"; my $out5 = "Number of binding sites on the binding site oligo: $output[7]"; my $out6 = "Forward oligo: $forwardOligo"; my $out7 = "Reverse oligo: $reverseOligo"; #print <<"EndOfText"; # # # # #thats a test # #EndOfText print "Content-type: text/html\n\n"; print '', "\n"; print "\n"; print "\n"; print "\n"; print "thats a test $out1\n"; print "\n"; #Oligos have an XbaI site for test digestion. !!!!!!!!!!!!!!!!!!!!!!!! #print "Content-type: text/html\n\n"; #print '', "\n"; #print "\n"; #print "\n"; #print "

shRNA: $miRNA

\n"; #print "

Binding site: $output[0]

\n"; #print "

Model calculated knockdown: $knockdownModelret

\n"; #print "

Binding site properties: $properties

\n"; #print "

Number of binding sites on the binding site oligo: $output[7]

\n"; #print "

Forward oligo: $forwardOligo

\n"; #print "

Reverse oligo: $reverseOligo

\n"; #print "

Oligos have an XbaI site for test digestion.

\n"; #print "\n"; ################################### sub getUTRmod { my $input = shift @_; open (MYFILE, 'modelUTR.txt') or die "Couldn't open file for processing"; while () { chomp; #print "$_\n"; my @mod=split(/\t/,$_); my $key=$mod[0]; my $value=($mod[1]-$input)**2; $hash{$key}=$value; $knockdownModel{$key}=$mod[1]; } close (MYFILE); my $smallest_key; my $smallest_value; foreach (keys %hash) { if(not defined $smallest_value or $hash{$_} < $smallest_value) { $smallest_key = $_; $smallest_value = $hash{$_}; } } $knockdownModelret = $knockdownModel{$smallest_key}; return $smallest_key; } sub compare { my ($modelParameter,$TargetScanResult) = @_; open (MYFILE, 'generatedBSparameters') or die "Couldn't open file for processing"; my @sequenceG=(); my @auG=(); my @threeprimeG=(); my @perfectG=(); my @nearPerfectG=(); my @seedTypeG=(); my @bulgesizeG=(); my @numberbsG=(); my $Gcnt=0; while () { chomp; my @b=split(/\t/,$_); $perfectG[$Gcnt]=$b[0]; $nearPerfectG[$Gcnt]=$b[1]; $seedTypeG[$Gcnt]=$b[2]; $bulgesizeG[$Gcnt]=$b[3]; $numberbsG[$Gcnt]=$b[4]; $Gcnt++; } close (MYFILE); my @TargetScanResultSplit = split (/,/,$TargetScanResult); for (my $cntr = 0; $cntr < @TargetScanResultSplit; $cntr++) { my @f = split (/:/,$TargetScanResultSplit[$cntr]); $sequenceG[$cntr]=$f[0]; $threeprimeG[$cntr] = $f[1]; $auG[$cntr] = $f[2]; } my ($threeprimeM,$auM,$perfectM,$nearPerfectM,$seedTypeM,$bulgesizeM,$numberbsM) = split (/:/,$modelParameter); if ($perfectM == 1) { return $sequenceG[0]; } if ($nearPerfectM == 1) { if ($bulgesizeM == 1) { return $sequenceG[1]; } elsif ($bulgesizeM == 2) { return $sequenceG[2]; } elsif ($bulgesizeM == 3) { return $sequenceG[3]; } elsif ($bulgesizeM == 4) { return $sequenceG[4]; } } my %auhash = (); my $smallest_key; my $smallest_value; for (my $i = 0; $i < @sequenceG; $i++) { if ($threeprimeG[$i] == $threeprimeM) { my $aucompare = ($auG[$i]-$auM)**2; $auhash{$i} = $aucompare; } } my %threePrimeHash = (); my $smallest_threeprime_key; my $smallest_threeprime_value; my %auhashNotdef = (); my $smallest_keyNotdef; my $smallest_valueNotdef; if (not defined %auhash) { print "bla\n"; for (my $i = 0; $i < @sequenceG; $i++) { my $threeprimeCompare = ($threeprimeG[$i]-$threeprimeM)**2; $threePrimeHash{$i} = $threeprimeCompare; } foreach (keys %threePrimeHash) { if (not defined $smallest_threeprime_value or $threePrimeHash{$_} < $smallest_threeprime_value) { $smallest_threeprime_key = $_; $smallest_threeprime_value = $threePrimeHash{$_}; } } for (my $i = 0; $i < @sequenceG; $i++) { if ($threeprimeG[$i] == $threeprimeG[$smallest_threeprime_key]) { my $aucompareNotdef = ($auG[$i]-$auM)**2; $auhashNotdef{$i} = $aucompareNotdef; } } foreach (keys %auhashNotdef) { if (not defined $smallest_valueNotdef or $auhashNotdef{$_} < $smallest_valueNotdef) { $smallest_keyNotdef = $_; $smallest_valueNotdef = $auhashNotdef{$_}; } } $smallest_key = $smallest_keyNotdef; } foreach (keys %auhash) { if (not defined $smallest_value or $auhash{$_} < $smallest_value) { $smallest_key = $_; $smallest_value = $auhash{$_}; } } return @out=($sequenceG[$smallest_key],$threeprimeG[$smallest_key],$auG[$smallest_key],$perfectG[$smallest_key],$nearPerfectG[$smallest_key],$seedTypeG[$smallest_key],$bulgesizeG[$smallest_key],$numberbsG[$smallest_key]); } sub comp { my @in = (); @in = @_; my @mi_array = (); @mi_array = split('', $in[0]); my @complementary = (); for (my $n = 0; $n < @mi_array; $n++) { if ($mi_array[$n] eq "A") { $mi_array[$n] = "T"; } elsif ($mi_array[$n] eq "T") { $mi_array[$n] = "A"; } elsif ($mi_array[$n] eq "C") { $mi_array[$n] = "G"; } elsif ($mi_array[$n] eq "G") { $mi_array[$n] = "C"; } push(@complementary, $mi_array[$n]); } my $newcomplementary = join('', @complementary); return ($newcomplementary); }