ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/yamap/blast_parse_artemis.pl
Revision: 1.2
Committed: Thu Sep 28 13:14:51 2006 UTC (9 years, 10 months ago) by knirirr
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
Log Message:
Updated labels in parser scripts.

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
9 # usage
10 unless (@ARGV)
11 {
12 print "Usage: ./blast_parse_artemis.pl <infiles>\n";
13 exit;
14 }
15
16
17 # open files, and convert
18 my @files = @ARGV;
19 my %dup = ();
20
21 foreach my $file (@files)
22 {
23 my $basename = &basename($file);
24 #my $name = [split(/\./,$basename)]->[0];
25 my $name = $basename;
26 $name =~ s/selfblast\.//;
27 $name =~ s/consblast\.//;
28 $name =~ s/dbblast\.//;
29 my $infile = "yamap_out/$name/$basename";
30 my $outfile = $infile;
31 $outfile =~ s/selfblast\.out/selfblast.tab/;
32 $outfile =~ s/dbblast\.out/dbblast.tab/;
33 $outfile =~ s/consblast\.out/consblast.tab/;
34
35 # files
36 open (IN, "<$infile") or die "Can't open $infile: $!";
37 open (OUT, ">$outfile") or die "Can't open $infile: $!";
38
39 # read blast report
40 my $type = "BLAST_HIT ";
41 while (my $line = <IN>)
42 {
43 chomp($line);
44 if (grep /BLAST/, $line)
45 {
46 $type = [split(/\s+/,$line)]->[1] . "_HIT ";
47 }
48 elsif (grep /BLAST/, $line)
49 {
50 $type = [split(/\s+/,$line)]->[1] . "_HIT";
51 }
52
53 next if ($line =~ /^#/);
54 my @parts = split(/\s+/,$line);
55 my $query = $parts[0];
56 my $subject = $parts[1];
57 my $ident = $parts[2];
58 my $length = $parts[3];
59 my $mismatches = $parts[4];
60 my $gap = $parts[5];
61 my $qstart = $parts[6];
62 my $quend = $parts[7];
63 my $sstart = $parts[8];
64 my $send = $parts[9];
65 my $evalue = $parts[10];
66 my $score = $parts[11];
67
68 # ignore self hits
69 #next if ($query eq $subject and $ident == 100);
70 next if ($query eq $subject);
71
72 # print to tab file
73 print OUT <<EOF;
74 FT $type $qstart..$quend
75 FT /note="blastall match to $subject $sstart..$send blast score $score percent identity $ident"
76 FT /label=$subject
77 FT /score=$score
78 FT /colour=0 255 0
79 EOF
80 }
81 close OUT;
82 close IN;
83 }
84
85
86 __END__