11 my @fields = split /\s+/, $_;
13 (defined $annotLines{$fields[1]}) or $annotLines{$fields[1]}=[];
14 # this is the tab-separated set of fields forming a jalview annotation line
15 # we only use sequence IDs, not numbers
16 my $line = [$fields[2],$fields[0],"-1", $fields[3], $fields[4], $fields[2]];
17 $featureids{$fields[2]}="FF0000"; # red is the colour.
19 if (scalar @fields>5) {
20 $attribs->{"gff:score"}=$fields[5];
21 (scalar @fields>6) and $attribs->{"gff:strand"}=$fields[6];
22 (scalar @fields>7) and $attribs->{"gff:frame"}=$fields[7];
23 if (scalar @fields>8) {
24 for (my $i=7; ($i+1)<(scalar @fields); $i+=2) {
25 $attribs->{"gff:".$fields[$i]} = $fields[$i+1];
29 push @{$annotLines{$fields[1]}}, [$line, $attribs];
32 foreach my $labels (keys %featureids) {
33 print "$labels\t".$featureids{$labels}."\n";
35 foreach my $labels (keys %annotLines) {
36 print "STARTGROUP\t".$labels."\n";
37 foreach my $annot (@{$annotLines{$labels}}) {
38 # bare minimum is written - no attributes/links yet.
39 print "".(join "\t",@{$annot->[0]})."\n";
41 print "ENDGROUP\t".$labels."\n";
53 gff2annot.pl [one or more files containing gff annotation]
55 Generates a nominally usable Jalview Annotation file on B<STDOUT> from arbitrary GFF annotation lines.
59 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.
61 For a series of GFF annotation lines looking like :
63 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>]]
65 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.
69 Passing some GFF annotation through STDIN:
72 Seq1 blastx significant_hsp 1 5 0.9 + 1 link http://mylink/
74 Seq1 blasty significant_hsp 15 25 0.9 + 1 link http://mylink/
75 Seq1 blastz significant_hsp 32 43 0.9 + 1 link http://mylink/
76 Seq2 blastx significant_hsp 1 5 0.9 + 1 link http://mylink/
77 Seq2 blasty significant_hsp 1 5 0.9 + 1 link http://mylink/
78 Seq2 blastz significant_hsp 1 5 0.9
79 Seq3 blastx significant_hsp 50 70
84 significant_hsp FF0000
86 significant_hsp Seq1 -1 15 25 significant_hsp
87 significant_hsp Seq2 -1 1 5 significant_hsp
90 significant_hsp Seq1 -1 1 5 significant_hsp
91 significant_hsp Seq2 -1 1 5 significant_hsp
92 significant_hsp Seq3 -1 50 70 significant_hsp
95 significant_hsp Seq1 -1 32 43 significant_hsp
96 significant_hsp Seq2 -1 1 5 significant_hsp