-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathparse_primersearch.pl
executable file
·37 lines (30 loc) · 1.49 KB
/
parse_primersearch.pl
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
#!/usr/bin/perl
#parse_primersearch.pl
#reformat EMBOSS primersearch output into columnar Galaxy interval format
#usage perl parse_primersearch.pl <input primersearch file> <tabular output file>
#Copyright 2012 John McCallum
#New Zealand Institute for Plant and Food Research
#This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
open (IN, "<$ARGV[0]");
open (OUT, ">$ARGV[1]");
while (<IN>) {
/^Primer name (\S+)/ && ($name = $1); # get primer set name
# Modified to cope with unnamed sequence input 28/7/05
/Sequence: (\S+)/ && print OUT $name,"\t",$1;
/Sequence:(\s{4,})/ && print OUT $name,"\t","unnamed_seq";
/hits forward strand at (\d+) with (\d) mismatches/ && ($start = $1) && print OUT "\t",$2,"\t",$start,;
/Amplimer length: (\S+)/ && ($amp_length = $1) && print OUT "\t",$start + $amp_length,"\t",$1,"\n";
}
close( IN );
close( OUT );