[Bio] / FigKernelScripts / test_generate_anno_gff.pl Repository:
ViewVC logotype

Annotation of /FigKernelScripts/test_generate_anno_gff.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (view) (download) (as text)

1 : olson 1.3 #
2 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
3 :     # for Interpretations of Genomes. All Rights Reserved.
4 :     #
5 :     # This file is part of the SEED Toolkit.
6 :     #
7 :     # The SEED Toolkit is free software. You can redistribute
8 :     # it and/or modify it under the terms of the SEED Toolkit
9 :     # Public License.
10 :     #
11 :     # You should have received a copy of the SEED Toolkit Public License
12 :     # along with this program; if not write to the University of Chicago
13 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14 :     # Genomes at veronika@thefig.info or download a copy from
15 :     # http://www.theseed.org/LICENSE.TXT.
16 :     #
17 :    
18 : olson 1.1 use FIG;
19 :     use strict;
20 :     use Data::Dumper;
21 :     use URI::Escape;
22 :     use POSIX;
23 :    
24 :     sub iso_time
25 :     {
26 :     my($t) = @_;
27 :    
28 :     my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($t);
29 :    
30 :     return POSIX::strftime("%Y-%m-%dT%H:%M:%S",
31 :     $sec, $min, $hour, $mday, $mon, $year);
32 :     }
33 :    
34 :    
35 :     my $fig = new FIG;
36 :    
37 : olson 1.2 my $outfile = "tstout";
38 :     print "Writing output to $outfile\n";
39 :    
40 : olson 1.1 my $end = time;
41 :     my $start = $end - 100 * 86400;
42 :     #$start= 0;
43 : olson 1.2 my($annos) = $fig->annotations_made_fast(['633.1'], $start, $end);
44 : olson 1.1
45 :     my $w = $fig->get_gff_writer(outputtype => ['cds'],
46 : olson 1.2 linelength => 78,
47 :     with_assignments => 0,
48 :     with_aliases => 1);
49 : olson 1.1
50 :     my(@clist, @flist);
51 :     my $count;
52 :    
53 :     my %contig_names;
54 :    
55 : olson 1.2 open(F, ">$outfile");
56 : olson 1.1
57 :     print F "#gff-version\t3\n";
58 :    
59 :     print F "#seed\tanno_start\t" . iso_time($start) . "\n";
60 :     print F "#seed\tanno_end\t" . iso_time($end) . "\n";
61 :     for my $genome_anno (@$annos)
62 :     {
63 :     my($genome, $gpegs) = @$genome_anno;
64 :    
65 :     for my $peg (sort { &FIG::by_fig_id($a, $b) } keys(%$gpegs))
66 :     {
67 :     my $alist = $gpegs->{$peg};
68 :    
69 :     #
70 :     # Create notes for the annos.
71 :     #
72 :    
73 :     my @notes;
74 :     for my $ent (@$alist)
75 :     {
76 :     my($peg, $time, $who, $anno) = @$ent;
77 :    
78 :     my $nbody = "$time:$who:$anno";
79 :     push(@notes, uri_escape($nbody));
80 :     }
81 :    
82 :     my $ntxt = "anno=" . join(",", @notes);
83 :    
84 :     my($contigs, $fasta) = $w->gff3_for_feature($peg, undef, $ntxt);
85 :    
86 :     map { $contig_names{$_}++ } keys(%$contigs);
87 :    
88 :     push(@clist, $contigs);
89 :     push(@flist, $fasta);
90 :     }
91 :    
92 :     print F "#seed\tgenome_md5\t$genome\t" . $fig->genome_md5sum($genome) . "\n";
93 : olson 1.2
94 :     #
95 :     # We don't need contig checksums.
96 :     #
97 :     # for my $cname (sort keys %contig_names)
98 :     # {
99 :     # print F "#seed\tcontig_md5\t$genome\t$cname\t" . $fig->contig_md5sum($genome, $cname) . "\n";
100 :     # }
101 : olson 1.1 }
102 :    
103 :    
104 :    
105 :     $w->write_gff3(\*F, '83333.1', \@clist, \@flist);
106 :    
107 :     close(F);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3