annotate MISA/p3_out.pl @ 2:16b5aa275b42 default tip

Uploaded minor revision to gff converter
author john-mccallum
date Wed, 23 Nov 2011 19:15:31 -0500
parents 3006582bfc76
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
1 #!/usr/bin/perl -w
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
2 # Author: Thomas Thiel
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
3 # Program name: prim_output.pl
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
4 # Description: converts the Primer3 output into an table
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
5
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
6 open (SRC,"<$ARGV[0]") || die ("\nError: Couldn't open Primer3 results file (*.p3out) !\n\n");
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
7 my $filename = $ARGV[0];
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
8 $filename =~ s/\.p3out//;
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
9 open (IN,"<$ARGV[1]") || die ("\nError: Couldn't open source file containing MISA (*.misa) results !\n\n");
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
10 open (OUT,">$ARGV[2]") || die ("nError: Couldn't create file !\n\n");
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
11
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
12 my ($seq_names_failed,$count_failed,$count);
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
13 print OUT "ID\tSSR nr.\tSSR type\tSSR\tsize\tstart\tend\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
14 print OUT "FORWARD PRIMER1 (5'-3')\tTm(°C)\tsize\tREVERSE PRIMER1 (5'-3')\tTm(°C)\tsize\tPRODUCT1 size (bp)\tstart (bp)\tend (bp)\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
15 print OUT "FORWARD PRIMER2 (5'-3')\tTm(°C)\tsize\tREVERSE PRIMER2 (5'-3')\tTm(°C)\tsize\tPRODUCT2 size (bp)\tstart (bp)\tend (bp)\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
16 print OUT "FORWARD PRIMER3 (5'-3')\tTm(°C)\tsize\tREVERSE PRIMER3 (5'-3')\tTm(°C)\tsize\tPRODUCT3 size (bp)\tstart (bp)\tend (bp)\n";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
17
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
18 undef $/;
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
19 my $in = <IN>;
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
20 study $in;
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
21
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
22 $/ = "=\n";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
23
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
24 while (<SRC>)
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
25 {
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
26 my ($id,$ssr_nr) = (/PRIMER_SEQUENCE_ID=(\S+)_(\d+)/);
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
27
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
28 $in =~ /($id\t$ssr_nr\t.*)\n/;
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
29 my $misa = $1;
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
30
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
31 /PRIMER_LEFT_SEQUENCE=(.*)/ || do {$count_failed++;print OUT "$misa\n"; next};
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
32 my $info = "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
33
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
34 /PRIMER_LEFT_TM=(.*)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
35 /PRIMER_LEFT=\d+,(\d+)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
36
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
37 /PRIMER_RIGHT_SEQUENCE=(.*)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
38 /PRIMER_RIGHT_TM=(.*)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
39 /PRIMER_RIGHT=\d+,(\d+)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
40
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
41 /PRIMER_PRODUCT_SIZE=(.*)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
42 /PRIMER_LEFT=(\d+),\d+/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
43 /PRIMER_RIGHT=(\d+),\d+/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
44
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
45
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
46 /PRIMER_LEFT_1_SEQUENCE=(.*)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
47 /PRIMER_LEFT_1_TM=(.*)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
48 /PRIMER_LEFT_1=\d+,(\d+)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
49
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
50 /PRIMER_RIGHT_1_SEQUENCE=(.*)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
51 /PRIMER_RIGHT_1_TM=(.*)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
52 /PRIMER_RIGHT_1=\d+,(\d+)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
53
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
54 /PRIMER_PRODUCT_SIZE_1=(.*)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
55 /PRIMER_LEFT_1=(\d+),\d+/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
56 /PRIMER_RIGHT_1=(\d+),\d+/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
57
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
58
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
59 /PRIMER_LEFT_2_SEQUENCE=(.*)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
60 /PRIMER_LEFT_2_TM=(.*)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
61 /PRIMER_LEFT_2=\d+,(\d+)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
62
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
63 /PRIMER_RIGHT_2_SEQUENCE=(.*)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
64 /PRIMER_RIGHT_2_TM=(.*)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
65 /PRIMER_RIGHT_2=\d+,(\d+)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
66
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
67 /PRIMER_PRODUCT_SIZE_2=(.*)/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
68 /PRIMER_LEFT_2=(\d+),\d+/; $info .= "$1\t";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
69 /PRIMER_RIGHT_2=(\d+),\d+/; $info .= "$1";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
70
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
71 $count++;
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
72 print OUT "$misa\t$info\n"
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
73 };
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
74
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
75 #print "\nPrimer modelling was successful for $count sequences.\n";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
76 #print "Primer modelling failed for $count_failed sequences.\n";