3 # Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
4 # Copyright (C) $$Year-Rel$$ The Jalview Authors
6 # This file is part of Jalview.
8 # Jalview is free software: you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License
10 # as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
12 # Jalview is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty
14 # of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 # PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 # The Jalview Authors are detailed in the 'AUTHORS' file.
29 my @fields = split /\s+/, $_;
31 (defined $annotLines{$fields[1]}) or $annotLines{$fields[1]}=[];
32 # this is the tab-separated set of fields forming a jalview annotation line
33 # we only use sequence IDs, not numbers
34 my $line = [$fields[2],$fields[0],"-1", $fields[3], $fields[4], $fields[2]];
35 $featureids{$fields[2]}="FF0000"; # red is the colour.
37 if (scalar @fields>5) {
38 $attribs->{"gff:score"}=$fields[5];
39 (scalar @fields>6) and $attribs->{"gff:strand"}=$fields[6];
40 (scalar @fields>7) and $attribs->{"gff:frame"}=$fields[7];
41 if (scalar @fields>8) {
42 for (my $i=7; ($i+1)<(scalar @fields); $i+=2) {
43 $attribs->{"gff:".$fields[$i]} = $fields[$i+1];
47 push @{$annotLines{$fields[1]}}, [$line, $attribs];
50 foreach my $labels (keys %featureids) {
51 print "$labels\t".$featureids{$labels}."\n";
53 foreach my $labels (keys %annotLines) {
54 print "STARTGROUP\t".$labels."\n";
55 foreach my $annot (@{$annotLines{$labels}}) {
56 # bare minimum is written - no attributes/links yet.
57 print "".(join "\t",@{$annot->[0]})."\n";
59 print "ENDGROUP\t".$labels."\n";
71 gff2annot.pl [one or more files containing gff annotation]
73 Generates a nominally usable Jalview Annotation file on B<STDOUT> from arbitrary GFF annotation lines.
77 This script will generate a jalview features file on standard out, from a set of GFF annotation lines input from STDIN and/or any provided filenames.
79 For a series of GFF annotation lines looking like :
81 E<lt>seqIdE<gt> E<lt>sourceE<gt> E<lt>nameE<gt> E<lt>startE<gt> E<lt>endE<gt> [E<lt>scoreE<gt> E<lt>strandE<gt> E<lt>frameE<gt> [E<lt>AttributeE<gt> E<lt>Attribute-Value<gt>]]
83 The script will generate a seuqence features file on B<STDOUT> where annotation with a particular B<source> string will be grouped together under that name.
87 Passing some GFF annotation through STDIN:
90 Seq1 blastx significant_hsp 1 5 0.9 + 1 link http://mylink/
92 Seq1 blasty significant_hsp 15 25 0.9 + 1 link http://mylink/
93 Seq1 blastz significant_hsp 32 43 0.9 + 1 link http://mylink/
94 Seq2 blastx significant_hsp 1 5 0.9 + 1 link http://mylink/
95 Seq2 blasty significant_hsp 1 5 0.9 + 1 link http://mylink/
96 Seq2 blastz significant_hsp 1 5 0.9
97 Seq3 blastx significant_hsp 50 70
102 significant_hsp FF0000
104 significant_hsp Seq1 -1 15 25 significant_hsp
105 significant_hsp Seq2 -1 1 5 significant_hsp
108 significant_hsp Seq1 -1 1 5 significant_hsp
109 significant_hsp Seq2 -1 1 5 significant_hsp
110 significant_hsp Seq3 -1 50 70 significant_hsp
113 significant_hsp Seq1 -1 32 43 significant_hsp
114 significant_hsp Seq2 -1 1 5 significant_hsp