annotate MISA/p3_in.pl @ 0:3006582bfc76

Uploaded V1.0 MISA tools and helper scripts
author john-mccallum
date Wed, 14 Sep 2011 23:57:57 -0400
parents
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: primer3_in.pl
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
4 # Description: creates a PRIMER3 input file based on SSR search results
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 (IN,"<$ARGV[0]") || die ("\nError: Couldn't open misa.pl results file (*.misa) !\n\n");
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
7
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
8 #my $filename = $ARGV[0];
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
9 #$filename =~ s/\.misa//;
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
10 open (SRC,"<$ARGV[1]") || die ("\nError: Couldn't open source file containing original FASTA sequences !\n\n");
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
11 open (OUT,">$ARGV[2]");
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
12
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
13 undef $/;
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
14 $in = <IN>;
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
15 study $in;
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
16
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
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
19 #my $count;
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
20 while (<SRC>)
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 next unless (my ($id,$seq) = /(.*?)\n(.*)/s);
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
23 $seq =~ s/[\d\s>]//g;#remove digits, spaces, line breaks,...
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
24 while ($in =~ /$id\t(\d+)\t\S+\t\S+\t(\d+)\t(\d+)/g)
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 ($ssr_nr,$size,$start) = ($1,$2,$3);
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
27 #$count++;
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
28 print OUT "PRIMER_SEQUENCE_ID=$id"."_$ssr_nr\nSEQUENCE=$seq\n";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
29 print OUT "PRIMER_PRODUCT_SIZE_RANGE=100-280\n";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
30 print OUT "TARGET=",$start-3,",",$size+6,"\n";
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
31 print OUT "PRIMER_MAX_END_STABILITY=250\n=\n"
3006582bfc76 Uploaded V1.0 MISA tools and helper scripts
john-mccallum
parents:
diff changeset
32 };
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 #print "\n$count records created.\n";