1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| sub _copy_fasta_file_and_create_nfo {
my ( $self, $args ) = @_;
# throw exception if filename looks wrong
$self->is_word( $args->{basefilename}, 'Fasta filename' );
my $newfile = $self->_cat_path_filename( $self->settings->datapath,
$args->{basefilename} );
$args->{filename} = $newfile;
my %dbs = $self->get_databases;
if ( defined $dbs{ $args->{basefilename} } ) {
$self->warn( "Database with that name already exists.\n"
. 'Skipping database generation.' );
$args->{skip} = 1;
return;
}
if ( defined $args->{copy} && $args->{copy} ) {
copy( $args->{file}, $newfile )
or $self->throw(
-class => 'Bio::Root::IOException',
-text => q{Can't copy } . $args->{file} . " to $newfile",
-value => $OS_ERROR,
);
}
else {
my $abs_path = $self->is_path( abs_path( $args->{file} ) );
symlink $abs_path, $newfile || $self->throw(
-class => 'Bio::Root::IOException',
-text => q{Can't symlink } . $abs_path . " to $newfile",
-value => $OS_ERROR,
);
}
if ( defined $args->{description} ) {
open my $NFOFILE, '>', $newfile . '.nfo';
print ${NFOFILE} $args->{description} or
$self->_cannot_print("$newfile.nfo");
close $NFOFILE;
}
return;
} |
Partager