3 Author: Hu Xuesong @ BGI <huxuesong@genomics.org.cn>
4 Version: 1.0.0 @ 20170612
9 use Galaxy
::IO
::FASTA
qw(FastaReadNextA);
11 open O
,'>','toPCR.p3' or die "Error opening [toPCR.p3]: $!\n";
15 PRIMER_THERMODYNAMIC_PARAMETERS_PATH=/usr/local/opt/primer3/share/primer3/primer3_config/
16 PRIMER_PRODUCT_SIZE_RANGE=30-401
21 my $in = openfile
('toPCR.fa.gz');
22 while (my $ret = FastaReadNextA
($in)) {
23 my ($seqname,$genome,$seqdesc) = @
$ret;
24 #print $seqname," | $seqdesc\n";
25 $seqdesc = (split / /,$seqdesc)[0];
26 $seqdesc = (split /:/,$seqdesc)[1];
27 my ($begin,$end) = split /-/,$seqdesc;
28 my $thePos = (split /_/,$seqname)[-1];
31 my $seqlen = length $genome;
32 if( $begin > -20 or $end < 20 or $seqlen < 55) {
33 print "\n>$seqname $thePos-($begin,$end)->Skipped.\n";
38 #print "$thePos, $begin,$end\n";
39 # Position starts from 0.
40 my $targetPos = - $begin;
41 my $left = -55 - $begin;
42 $left = 0 if $begin < 0;
43 my $right = 20 - $begin;
44 my $maxL = $seqlen - $right;
45 $maxL = 55 if $maxL > 55;
46 #$end = $seqlen -1 if $end >= $seqlen;
49 SEQUENCE_TEMPLATE
=$genome
50 SEQUENCE_TARGET
=$targetPos,1
51 SEQUENCE_INTERNAL_EXCLUDED_REGION
=$targetPos,1
52 SEQUENCE_PRIMER_PAIR_OK_REGION_LIST
=$left,55,, ; ,,$right,$maxL
59 print "Run [primer3_core < toPCR.p3 > toPCR.out] now.\n";
61 primer3_core
-format_output
< toPCR
.p3
.test
62 primer3_core
< toPCR
.p3
.test