-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed bug with filenames that have path component
- Loading branch information
Showing
1 changed file
with
30 additions
and
20 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ =head1 NAME | |
phyloFlash - A script to rapidly estimate the phylogenetic composition of | ||
an illumina (meta)genomic dataset. | ||
=head1 SYNOPSIS | ||
B<phyloFlash.pl> -dbhome F<dir> -lib B<name> -read1 F<<file>> -read2 F<<file>> | ||
|
@@ -46,7 +45,6 @@ =head1 OPTIONS | |
Invokes checking of working environment and dependencies without data input. | ||
Use to test setup. | ||
=item -dbhome F<dir> | ||
Directory containing phyloFlash reference databases. | ||
|
@@ -117,8 +115,7 @@ =head1 COPYRIGHT AND LICENSE | |
Copyright (C) 2014- by Harald Gruber-Vodicka <[email protected]> | ||
and Elmar A. Pruesse <[email protected]> | ||
with help from Brandon Seah mail: | ||
with help from Brandon Seah <[email protected]> | ||
LICENCE | ||
|
@@ -160,8 +157,10 @@ =head1 COPYRIGHT AND LICENSE | |
my $cwd = getcwd; | ||
|
||
# configuration variables / defaults | ||
my $readsf = undef; # forward read file | ||
my $readsr = undef; # reverse read file | ||
my $readsf_full = undef; # path to forward read file | ||
my $readsr_full = undef; # path to reverse read file | ||
my $readsf = undef; # forward read filename, stripped of directory names | ||
my $readsr = undef; # reverse read filename, stripped of directory names | ||
my $SEmode = 0; # single ended mode | ||
my $libraryNAME = undef; # output basename | ||
my $id = 70; # minimum %id for mapping | ||
|
@@ -254,8 +253,8 @@ sub process_required_tools { | |
# parse arguments passed on commandline and do some | ||
# sanity checks | ||
sub parse_cmdline { | ||
GetOptions('read1=s' => \$readsf, | ||
'read2=s' => \$readsr, | ||
GetOptions('read1=s' => \$readsf_full, | ||
'read2=s' => \$readsr_full, | ||
'lib=s' => \$libraryNAME, | ||
'dbhome=s' => \$DBHOME, | ||
'readlength=i' => \$readlength, | ||
|
@@ -293,25 +292,36 @@ sub parse_cmdline { | |
|
||
# check correct read file(s) | ||
pod2usage("\nPlease specify input forward read file with -read1") | ||
if !defined($readsf); | ||
pod2usage("\nUnable to open forward read file '$readsf'. ". | ||
if !defined($readsf_full); | ||
pod2usage("\nUnable to open forward read file '$readsf_full'. ". | ||
"Make sure the file exists and is readable by you.") | ||
if ! -e $readsf; | ||
if ! -e $readsf_full; | ||
|
||
# strip directory paths from forward read filename | ||
if ($readsf_full =~ m/.*\/(.+)/) { | ||
$readsf = $1; | ||
} else { $readsf = $readsf_full; } | ||
|
||
|
||
if (defined($readsr)) { | ||
pod2usage("\nUnable to open reverse read file '$readsr'.". | ||
"Make sure the file exists and is readable by you.") | ||
if ! -e $readsr; | ||
pod2usage("\nForward and reverse input read file need to be different") | ||
if ($readsr eq $readsf); | ||
if ($readsr_full =~ m/.*\/(.+)/) { # strip directory paths from reverse read filename | ||
$readsr = $1; | ||
} else { $readsr = $readsr_full; } | ||
|
||
} else { | ||
$SEmode = 1; # no reverse reads, we operate in single ended mode | ||
$readsr = "<NONE>"; | ||
$readsr_full = "<NONE>"; | ||
} | ||
|
||
msg("Forward reads $readsf"); | ||
msg("Forward reads $readsf_full"); | ||
if ($SEmode == 0) { | ||
msg("Reverse reads $readsr"); | ||
msg("Reverse reads $readsr_full"); | ||
} else { | ||
msg("Running in single ended mode"); | ||
} | ||
|
@@ -364,8 +374,8 @@ sub print_report { | |
$version - high throughput phylogenetic screening using SSU rRNA gene(s) abundance(s) | ||
Library name:\t$libraryNAME | ||
--- | ||
Forward read file\t$readsf | ||
Reverse read file\t$readsr | ||
Forward read file\t$readsf_full | ||
Reverse read file\t$readsr_full | ||
Current working directory\t$cwd | ||
--- | ||
Minimum mapping identity:\t$id% | ||
|
@@ -443,8 +453,8 @@ sub write_csv { | |
my @report = csv_escape(( | ||
"version",$version, | ||
"library, name",$libraryNAME, | ||
"forward read file",$readsf, | ||
"reverse read file",$readsr, | ||
"forward read file",$readsf_full, | ||
"reverse read file",$readsr_full, | ||
"cwd",$cwd, | ||
"minimum mapping identity",$id, | ||
"single ended mode",$SEmode, | ||
|
@@ -525,7 +535,7 @@ sub bbmap_fast_filter_run { | |
. "path=$DBHOME " | ||
. "outm=$libraryNAME.$readsf.SSU.1.fq " | ||
. "build=1 " | ||
. "in=$readsf " | ||
. "in=$readsf_full " | ||
. "bhist=tmp.$libraryNAME.basecompositionhistogram " | ||
. "ihist=$libraryNAME.inserthistogram " | ||
. "scafstats=$libraryNAME.hitstats " | ||
|
@@ -1167,15 +1177,15 @@ sub write_report_html { | |
<th>Forward read file</th> | ||
ENDHTML | ||
|
||
print {$fh} " <td>".$readsf."</td>\n"; | ||
print {$fh} " <td>".$readsf_full."</td>\n"; | ||
|
||
print {$fh} <<ENDHTML; | ||
</tr> | ||
<tr> | ||
<th>Reverse read file</th> | ||
ENDHTML | ||
|
||
print {$fh} " <td>".$readsr."</td>\n"; | ||
print {$fh} " <td>".$readsr_full."</td>\n"; | ||
|
||
print {$fh} <<ENDHTML; | ||
</tr> | ||
|