[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.2, Tue Oct 25 11:38:23 2005 UTC revision 1.3, Tue Nov 22 14:57:50 2005 UTC
# Line 29  Line 29 
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";
32    print STDERR "Reading data from $tarfile\n";
33    
34  ($output_dir = shift @ARGV) || die "no Output-Dir given\n\usage:$usage\n\n";  ($output_dir = shift @ARGV) || die "no Output-Dir given\n\usage:$usage\n\n";
35    
# Line 50  Line 51 
51  (-d $dir) || mkpath($dir, 1, 0777) || die "could not create $dir";  (-d $dir) || mkpath($dir, 1, 0777) || die "could not create $dir";
52  # chdir($dir) || die "Could not change working-directory to $dir";  # chdir($dir) || die "Could not change working-directory to $dir";
53    
54  if (($tarfile !~ m{^\/}) && (-s "$base_dir/$tarfile"))  if ($tarfile !~ m{^\/})
55    {
56        if (-s "$base_dir/$tarfile")
57  {  {
58      $tarfile = "$base_dir/$tarfile";      $tarfile = "$base_dir/$tarfile";
59  }  }
# Line 58  Line 61 
61  {  {
62      die "Could not locate $base_dir/$tarfile";      die "Could not locate $base_dir/$tarfile";
63  }  }
64    }
65    else
66    {
67        print STDERR "Reading data from $tarfile\n";
68    }
69    
70  &FIG::run("tar xpzvf $tarfile -C $dir");  &FIG::run("tar xpzvf $tarfile -C $dir");
71    
72  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";
73  &FIG::run("cat RAW_DATA/*_contig.fas | reformat_contigs > contigs");  &FIG::run("cat RAW_DATA/*\.fas | reformat_contigs > contigs");
   
74  open(TMP, "<contigs") || die "could not read-open contigs";  open(TMP, "<contigs") || die "could not read-open contigs";
75  while (($id, $seqP) = &read_fasta_record(\*TMP)) { $len{$id} = length($$seqP); }  while (($id, $seqP) = &read_fasta_record(\*TMP)) { $len{$id} = length($$seqP); }
76  close(TMP) || die "could not close contigs";  close(TMP) || die "could not close contigs";
77    
78    if ($num_contigs = (scalar keys %len))
79    {
80        print STDERR "Read $num_contigs contigs\n";
81    }
82    else
83    {
84        die "ERROR: no contigs found in contigs file\n";
85    }
86    
87    
88  $dir = "Features/peg";  $dir = "Features/peg";
89  (-d $dir) || mkpath($dir, 1, 0777) || die "could not create $dir";  (-d $dir) || mkpath($dir, 1, 0777) || die "could not create $dir";
90  open(CDS_TBL, ">$dir/tbl")         || die "could not open $dir/tbl";  open(CDS_TBL, ">$dir/tbl")         || die "could not open $dir/tbl";

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3