Bioinf
view release on metacpan or search on metacpan
@files_made_with_rv, @files_made, %hash, $seq, $sec_str_hash_form_given);
my($output_file) ='default_out.fa'; ### when no output file name is given, this is used
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
# Try and determin the output file name
#________________________________________________________
if(@file>0){
if($file[0]=~/\S\.[n]?fa/){ ## to handle .nfa and .fa files
$output_file = $file[0]; $out_file_name_provided=1;
if(-s $output_file){
rename($output_file, "$output_file\.bak");
print "\n# (INFO) $output_file is present. $output_file\.bak will be created for backup\n";
}
}elsif($file[0]=~/(\S+)\.\S+/){
$output_file = "$1\.fa"; $out_file_name_provided=1;
}
}else{ $output_file='default_out.fa'; }
if($char_opt=~/s/){ $sort_seq_names='s'; }
if($char_opt=~/o/){ $write_pure_seq_only='o' }
if($char_opt=~/R/){ $write_rv_seq_as_well='R'; print "\n# (INFO) You wanted REVerse seq as well\n"; }
\@raw_string=\"@raw_string\"\n\t\@array=\"@array\"\n\t\@num_opt=\"@num_opt\"
\@char_opt=\"@char_opt\"\n\t\@file=\"@file\"\n\t\@string=\"@string\"\n" }
#""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
## Reading self and the template headbox in this subroutine.
my %correct_head_box_entry = %{&read_correct_head_box()};
for($p=0; $p < @file; $p++){
$in_file = $file[$p];
##""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
## Make backup of the input file
##""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
&cp( "$in_file", "$in_file\.bak$$");
print "\n $in_file\.bak$$ is created as a backup \n\n";
print chr(7);
##""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
## Open files
##""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
open(TARGET, "$in_file\.bak$$");
open(RESULT, ">$in_file");
my(@whole_file) = <TARGET>;
my(@keys) = keys %correct_head_box_entry;
@files_made_with_rv, @files_made, %hash, $seq, $sec_str_hash_form_given);
my($output_file) ='default_out.fa'; ### when no output file name is given, this is used
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
# Try and determin the output file name
#________________________________________________________
if(@file>0){
if($file[0]=~/\S\.[n]?fa/){ ## to handle .nfa and .fa files
$output_file = $file[0]; $out_file_name_provided=1;
if(-s $output_file){
rename($output_file, "$output_file\.bak");
print "\n# (INFO) $output_file is present. $output_file\.bak will be created for backup\n";
}
}elsif($file[0]=~/(\S+)\.\S+/){
$output_file = "$1\.fa"; $out_file_name_provided=1;
}
}else{ $output_file='default_out.fa'; }
if($char_opt=~/s/){ $sort_seq_names='s'; }
if($char_opt=~/o/){ $write_pure_seq_only='o' }
if($char_opt=~/R/){ $write_rv_seq_as_well='R'; print "\n# (INFO) You wanted REVerse seq as well\n"; }
\@raw_string=\"@raw_string\"\n\t\@array=\"@array\"\n\t\@num_opt=\"@num_opt\"
\@char_opt=\"@char_opt\"\n\t\@file=\"@file\"\n\t\@string=\"@string\"\n" }
#""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
## Reading self and the template headbox in this subroutine.
my %correct_head_box_entry = %{&read_correct_head_box()};
for($p=0; $p < @file; $p++){
$in_file = $file[$p];
##""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
## Make backup of the input file
##""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
&cp( "$in_file", "$in_file\.bak$$");
print "\n $in_file\.bak$$ is created as a backup \n\n";
print chr(7);
##""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
## Open files
##""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
open(TARGET, "$in_file\.bak$$");
open(RESULT, ">$in_file");
my(@whole_file) = <TARGET>;
my(@keys) = keys %correct_head_box_entry;
( run in 1.264 second using v1.01-cache-2.11-cpan-49f99fa48dc )