Skip to content

Instantly share code, notes, and snippets.

@andreitudor
Created March 25, 2011 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreitudor/886986 to your computer and use it in GitHub Desktop.
Save andreitudor/886986 to your computer and use it in GitHub Desktop.
if ($yn[0] eq "Yes")
{
my $wanted1 = sub {
if ($File::Find::name =~ m/\.gbk/)
{
push(@path_gb,$File::Find::name);
push(@path,$File::Find::dir);
} };
find($wanted1,$dir);
my $array_size1 = @path;
my $array_size2 = @path_gb;
my $wanted2 = sub
{
my $acc_number;
for (my $j=0;$j<$array_size2;$j++)
{
print $path_gb[$j];
$file_txt -> insert ('end',"Working on $File::Find::name!\n");
my $seqio_object = Bio::SeqIO->new(-file => "<$path_gb[$j]");
my $seq_object = $seqio_object->next_seq;
$acc_number = $seq_object->accession_number; ########## line 585
$file_txt -> insert ('end',"Got the accession number!\n");
}
if (-f $File::Find::name)
{
my @file = \&read_file($File::Find::name);
open (OUT,">$File::Find::name")|| die ("Couldn't open $File::Find::name, because:\n $!");
foreach my $line (@file)
{
$file_txt -> insert ('end',"$line\n");
$line =~ s/BASYS/$acc_number-/;
}
close (OUT)|| die ("Couldn't close $File::Find::name, because:\n $!");
$file_txt -> insert ('end',"Success with $File::Find::name!\n");
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment