-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathK-batch_primer3.pl
More file actions
executable file
·83 lines (60 loc) · 1.74 KB
/
K-batch_primer3.pl
File metadata and controls
executable file
·83 lines (60 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!usr/bin/perl
use strict;
use warnings;
use Bio::Seq;
use Bio::SeqIO;
use Bio::SearchIO;
use Getopt::Long;
my $usage=
"perl script.pl <options>
-i|--input input sequences in fasta format
-o|--output output file
";
my $filein;
my $fileout="primer3";
GetOptions(
'i|input:s' => \$filein,
'o|output:s' => \$fileout,
);
die $usage unless defined ($filein);
my $inseq = Bio::SeqIO->new(
-file => $filein,
-format => 'Fasta',
);
open (FILEOUT1, ">", "$fileout.primers.txt");
while (my $seq = $inseq->next_seq){
my $primer3_output= run_primer3($seq->id,$seq->seq());
print FILEOUT1 $primer3_output, "\n";
my $primer_left_0 = qx(echo "$primer3_output" | grep PRIMER_LEFT_0_SEQUENCE | cut -f 2 -d "=");
chomp $primer_left_0;
my $primer_left_0_tm = qx(echo "$primer3_output" | grep PRIMER_LEFT_0_TM | cut -f 2 -d "=");
chomp $primer_left_0_tm;
print $seq->id, "_fw", "\t", $primer_left_0, "\t", $primer_left_0_tm, "\n";
my $primer_right_0 = qx(echo "$primer3_output" | grep PRIMER_RIGHT_0_SEQUENCE | cut -f 2 -d "=");
chomp $primer_right_0;
my $primer_right_0_tm = qx(echo "$primer3_output" | grep PRIMER_RIGHT_0_TM | cut -f 2 -d "=");
chomp $primer_right_0_tm;
print $seq->id, "_rev", "\t", $primer_right_0, "\t", $primer_right_0_tm, "\n";
}
sub run_primer3{
my ($id, $seq)=@_;
my $length=length($seq) . "-" . length($seq);
my $input="SEQUENCE_ID=$id
SEQUENCE_TEMPLATE=$seq
PRIMER_TASK=generic
PRIMER_PICK_LEFT_PRIMER=1
PRIMER_PICK_RIGHT_PRIMER=1
PRIMER_OPT_SIZE=20
PRIMER_MIN_SIZE=12
PRIMER_MAX_SIZE=35
PRIMER_MAX_NS_ACCEPTED=0
PRIMER_MIN_GC=10
PRIMER_PRODUCT_SIZE_RANGE=$length
P3_FILE_FLAG=1
PRIMER_EXPLAIN_FLAG=1
PRIMER_MIN_TM=55
PRIMER_MAX_TM=68
=";
my $output = qx(echo "$input" | primer3_core);
return $output;
}