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

Diff of /FigKernelScripts/bielefeld_tarfile_to_seed.pl

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

revision 1.1, Wed Sep 28 21:45:36 2005 UTC revision 1.2, Tue Oct 25 11:38:23 2005 UTC
# Line 5  Line 5 
5    
6  use File::Path;  use File::Path;
7    
8  $usage = "bielefeld_gff_to_seed.pl [-update] input_tarfile output_dir";  $usage = "bielefeld_gff_to_seed.pl [-update] [-discard] input_tarfile output_dir";
9    
10  if ($ARGV[0] =~ m/-update/) { $update = shift; }  $trouble = 0;
11    while ($ARGV[0] =~ m/^-/)
12    {
13        if    ($ARGV[0] =~ m/-update/)
14        {
15            $update  = shift @ARGV;
16        }
17        elsif ($ARGV[0] =~ m/-discard/)
18        {
19            $discard = shift @ARGV;
20        }
21        else
22        {
23            warn "\tInvalid argument $ARGV[0]\n";
24            $trouble = shift @ARGV;
25        }
26    }
27    
28    if ($trouble)  { die "\nThere were invalid arguments\n\n\tusage = $usage\n\n"; }
29    
30  (($tarfile = shift) && (-s $tarfile))  (($tarfile = shift) && (-s $tarfile))
31      || die "Input tarfile $tarfile does not exist.\n\n\tusage: $usage\n\n";      || die "Input tarfile $tarfile does not exist.\n\n\tusage: $usage\n\n";
# Line 30  Line 48 
48    
49  $dir = "$base_dir/$output_dir/RAW_DATA";  $dir = "$base_dir/$output_dir/RAW_DATA";
50  (-d $dir) || mkpath($dir, 1, 0777) || die "could not create $dir";  (-d $dir) || mkpath($dir, 1, 0777) || die "could not create $dir";
51  chdir($dir) || die "Could not change working-directory to $dir";  # chdir($dir) || die "Could not change working-directory to $dir";
52    
53  &FIG::run("tar xpzvf $tarfile");  if (($tarfile !~ m{^\/}) && (-s "$base_dir/$tarfile"))
54    {
55        $tarfile = "$base_dir/$tarfile";
56    }
57    else
58    {
59        die "Could not locate $base_dir/$tarfile";
60    }
61    
62    &FIG::run("tar xpzvf $tarfile -C $dir");
63    
64  chdir("$base_dir/$output_dir") || "Could not change working-directory to $output_dir";  chdir("$base_dir/$output_dir") || "Could not change working-directory to $output_dir";
65  &FIG::run("cat RAW_DATA/*_contig.fas | reformat_contigs > contigs");  &FIG::run("cat RAW_DATA/*_contig.fas | reformat_contigs > contigs");
# Line 86  Line 113 
113    
114          ($contig, undef, $type, $left, $right, undef, $strand, undef, $comment) = split /\t/, $line;          ($contig, undef, $type, $left, $right, undef, $strand, undef, $comment) = split /\t/, $line;
115    
116            next if ($discard && ($comment =~ m/^discarded/));
117    
118          if ($left <= 0)          if ($left <= 0)
119          {          {
120              ++$bad;              ++$bad;
# Line 131  Line 160 
160  }  }
161  print STDERR "bad=$bad\n" if $bad;  print STDERR "bad=$bad\n" if $bad;
162    
163    close(CDS_TBL) || die "Could not close peg tbl";
164    close(RNA_TBL) || die "Could not close rna tbl";
165    
166  $dir = "$base_dir/$output_dir";  $dir = "$base_dir/$output_dir";
167  if (-s "$dir/Features/rna/tbl")  if (-s "$dir/Features/rna/tbl")
168  {  {

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3