ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/yamap/quickmine_parse_artemis.pl
Revision: 1.1
Committed: Wed Dec 13 10:48:57 2006 UTC (9 years, 9 months ago) by gawi79
Branch: MAIN
CVS Tags: HEAD
Log Message:
A QuickMine script

Line File contents
1 #!/usr/bin/perl
2
3 # A script to read in fasta files and Artemis feature tables,
4 # and to write out as EMBL formatted files
5
6 use strict;
7 use File::Basename;
8 use Config::Simple;
9
10 unless (@ARGV ==4) {
11 die "\n\nProper Command Line Usage: quickmine_parse_artemis.pl infile outfile multiseq quickmine_config_file\nPlease try again.\n\n\n";}
12
13 my $infile = shift;
14 my $outfile = shift;
15 my $multiseq = shift;
16 my $config_file = shift;
17
18 my $cfg = new Config::Simple($config_file);
19 my $path2output = $cfg->param('PATHS.path2output');
20
21 if ($multiseq == 0)
22 {
23 my $query = "$infile"."orf0001";
24 my $filename = "$infile"."_tabinfo.txt";
25 open (IN, "<$path2output/$filename") or die "Can't open file: $filename";
26 open (OUT, ">$outfile/$infile".".quickmine.tab");
27 while (my $line = <IN>)
28 {
29 chomp($line);
30 my @parts = split(/\t/,$line);
31 my $type = $parts[1];
32 $type = uc $type;
33 $type = "$type"."_HIT";
34 my $tab_query = $parts[0];
35 my $subject = $parts[2];
36 my $ident = $parts[3];
37 my $qstart = $parts[5];
38 my $quend = $parts[6];
39 my $sstart = $parts[7];
40 my $send = $parts[8];
41 my $score = $parts[4];
42
43 # print to tab file
44 print OUT <<EOF;
45 FT $type $qstart..$quend
46 FT /note="blastall match to $subject $sstart..$send blast score $score percent identity $ident"
47 FT /label=$subject
48 FT /score=$score
49 FT /colour=0 255 0
50 EOF
51 }
52 close OUT;
53 close IN;
54 }
55 else
56 {
57 my $query = $infile;
58 $query =~s/\.fasta//;
59 $infile =~m/(.*)orf.*/;
60 my $abbr = $1;
61 my $filename = "$abbr"."_tabinfo.txt";
62 open (IN, "<$path2output/$filename") or die "Can't open file: $filename";
63 open (OUT, ">$outfile/$infile".".quickmine.tab");
64 while (my $line = <IN>)
65 {
66 chomp($line);
67 if ($line =~m/^$query/)
68 {
69 my @parts = split(/\t/,$line);
70 my $type = $parts[1];
71 $type = uc $type;
72 $type = "$type"."_HIT";
73 my $tab_query = $parts[0];
74 my $subject = $parts[2];
75 my $ident = $parts[3];
76 my $qstart = $parts[5];
77 my $quend = $parts[6];
78 my $sstart = $parts[7];
79 my $send = $parts[8];
80 my $score = $parts[4];
81
82 # print to tab file
83 print OUT <<EOF;
84 FT $type $qstart..$quend
85 FT /note="blastall match to $subject $sstart..$send blast score $score percent identity $ident"
86 FT /label=$subject
87 FT /score=$score
88 FT /colour=0 255 0
89 EOF
90 }
91 }
92 close OUT;
93 close IN;
94 }