Skip to content

Commit

Permalink
Use File::Basename to handle parsing of Silva file path
Browse files Browse the repository at this point in the history
Regex to extract Silva version breaks if the folder name also contains
`SILVA_`. Use fileparse to extract only the basename.

This resolves issue #98
  • Loading branch information
kbseah committed Jan 8, 2020
1 parent 4996d7c commit af9a52f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions phyloFlash_makedb.pl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ =head2 INPUT FILES
This should be the Fasta-formatted SILVA SSURef file, clustered at 99% identity,
with SILVA taxonomy strings in file header, and sequences truncated to SSU gene
boundaries. The file name should be in the form
I<SILVA_[Release]_SSURef_Nr99_tax_silva_trunc.fasta.gz>
I<SILVA_[Release]_SSURef_Nr99_tax_silva_trunc.fasta.gz> (release 132 and before) or
I<SILVA_[Release]_SSURef_NR99_tax_silva_trunc.fasta.gz> (from release 138 onwards)
=item --univec_file F<path/to/univec_db>
Expand Down Expand Up @@ -172,6 +173,7 @@ =head1 COPYRIGHT AND LICENSE
use Cwd;
use Storable;
use File::Spec;
use File::Basename;

# URLS
my $silva_url = "ftp.arb-silva.de/current/Exports/*_SSURef_N?99_tax_silva_trunc.fasta.gz";
Expand Down Expand Up @@ -252,7 +254,11 @@ =head1 COPYRIGHT AND LICENSE
}

# extract SILVA version
my ($silva_release) = ($silva_file =~ m/SILVA_([^_]+)_/);
# get file basename, in case a path is specified
my ($silva_file_filename,
$silva_file_dirs,
$silva_file_suffix) = fileparse($silva_file);
my ($silva_release) = ($silva_file_filename =~ m/SILVA_([^_]+)_/);

if (!$&) {
err("Unable to extract version from SILVA database filename:",
Expand Down

0 comments on commit af9a52f

Please sign in to comment.