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

Diff of /FigKernelScripts/correct_gff_missing_contigs.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2, Tue Feb 6 01:31:21 2007 UTC revision 1.3, Wed Apr 11 17:47:15 2007 UTC
# Line 4  Line 4 
4  #  #
5  # this should be run as a complement to seed2gff during the install in the unlikely case that you have some sequences that don't have features on them. This is almost exclusively a problem for the 454 metagenomes, so I haven't consituted a wide-eyed fix that could involve altering the gff3 spec.  # this should be run as a complement to seed2gff during the install in the unlikely case that you have some sequences that don't have features on them. This is almost exclusively a problem for the 454 metagenomes, so I haven't consituted a wide-eyed fix that could involve altering the gff3 spec.
6    
7  my $usage="$0 <fasta file> <genome ID>";  use raelib;
8    use strict;
9    
10    my $usage="$0 [-orgdir organism-dir] <fasta file> <genome ID>";
11    
12    my $orgdir;
13    
14    my $rae = new raelib;
15    
16    while (@ARGV)
17    {
18        my $arg = $ARGV[0];
19        if ($arg =~ /^-(.*)/)
20        {
21            my $flag = $1;
22            shift;
23    
24            if ($flag eq 'orgdir')
25            {
26                $orgdir = shift;
27            }
28            else
29            {
30                die $usage;
31            }
32        }
33        else
34        {
35            last;
36        }
37    }
38    
39  my ($faf, $gid)=@ARGV;  my ($faf, $gid)=@ARGV;
40  die $usage unless ($faf && $gid);  die $usage unless ($faf && $gid);
41    
# Line 14  Line 45 
45  # figure out the contigs for the genome id  # figure out the contigs for the genome id
46  # we're not going to use the database in case it's a new genome and we haven't loaded the data yet  # we're not going to use the database in case it's a new genome and we haven't loaded the data yet
47    
48  my $cf=$FIG_Config::organisms."/$gid/contigs";  my $cf;
49    if ($orgdir)
50    {
51        $cf = "$orgdir/contigs";
52    }
53    else
54    {
55        $cf=$FIG_Config::organisms."/$gid/contigs";
56    }
57  my $cfa=$rae->read_fasta($cf);  my $cfa=$rae->read_fasta($cf);
58  my @contigs=keys %$cfa;  my @contigs=keys %$cfa;
59    
# Line 38  Line 77 
77    
78  # if we get here we want to copy the data  # if we get here we want to copy the data
79    
80  open(OUT, ">$FIG_Config::organisms/$gid/contigs") || die "Can't write to $FIG_Config::organisms/$gid/contigs";  open(OUT, ">$cf") || die "Can't write to $cf";
81  map {print OUT ">$_\n", $fasta->{$_}, "\n"} sort keys %$fasta;  map {print OUT ">$_\n", $fasta->{$_}, "\n"} sort keys %$fasta;
82  close OUT;  close OUT;
83    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3