Created
March 25, 2011 15:09
-
-
Save andreitudor/886986 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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