#!/usr/local/bin/perl # raw2fa.pl use lib('/bio/work/meow/'); use euGenes::GenomeFeatures; use Getopt::Long; my $workpath= '/c7/eugenes/genomew/'; my @csome=(); my $subrange=''; $usage= < $workpath, 'org=s' => $org, -- input org & csome(s) 'csomes=s' => @csome, 'dnafile=s' => $dnafile, -- OR input dnafile 'subrange=s' => $subrange, -- null or subrange to extract 'debug!' => $debug, 'reverse!' => $reverse, USAGE #'outpath=s' => $outpath, #'run!' => $dorun, GetOptions( 'dnafile=s' => \$dnafile, 'subrange=s' => \$subrange, 'workpath=s' => \$workpath, 'org=s' => \$org, 'csomes=s' => \@csome, 'debug!' => \$debug, 'reverse!' => \$reverse, ); die $usage unless($dnafile || (@csome && $org)); #'outpath=s' => \$outpath, #'run!' => \$dorun, my $gnofeats= euGenes::GenomeFeatures->new( org => $org, workpath => $workpath, dnafile => $dnafile, ); ## test reverse if ($reverse) { local(*F); unless(open(F,$dnafile)) { warn "Can't open $dnafile"; return; } my ($len, $nr, $data); seek(F, 0, 2); $len= tell(F); seek(F, 0, 0); $n= read(F,$data,$len); print STDERR "read $n from $dnafile:\n"; print STDERR substr($data,0,75),"...\n"; print STDERR substr($data,$len-75,75),"\n"; print STDERR "start reverse...\n"; $revd= reverse $data; print STDERR "done reverse...\n"; print STDERR substr($revd,0,75),"...\n"; print STDERR substr($revd,$len-75,75),"\n"; exit; } ## or $ens->init( ... ); if (@csome) { foreach $csome (@csome) { $gnofeats->init( org => $org, chromosome => $csome, ); $gnofeats->raw2fasta($dnafile,$subrange); } } else { $gnofeats->raw2fasta($dnafile,$subrange); }