Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid conflicts with other taxonomy-based tools and keep script names consistent (also create taxonomy-directory during installation if not already existing) #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions KronaTools/install.pl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
}

my $scriptPath = abs_path('scripts');
my $currentPath = abs_path('.');

createDir($path);
createDir("$path/bin");
Expand Down Expand Up @@ -74,11 +75,24 @@
}
}

foreach my $script
(qw(
updateTaxonomy
updateAccessions
))
{
if ( system('ln', '-sf', "$currentPath/$script.sh", "$path/bin/kt$script") )
{
linkFail("$path/bin");
}
}

if ( defined $taxonomyDir )
{
if ( ! -e $taxonomyDir )
{
ktDie("$taxonomyDir does not exist.");
print "\n $taxonomyDir does not exist. --> creating it.\n";
createDir("$taxonomyDir");
}

if ( -e 'taxonomy')
Expand All @@ -89,19 +103,22 @@
print "Linking taxonomy to $taxonomyDir...\n";
system('ln -s -f -F ' . $taxonomyDir . ' taxonomy');
}

else
{
createDir("$currentPath/taxonomy");
}
print '
Installation complete.

Run ./updateTaxonomy.sh to use scripts that rely on NCBI taxonomy:
Run ktupdateTaxonomy to use scripts that rely on NCBI taxonomy:
ktClassifyBLAST
ktGetLCA
ktGetTaxInfo
ktImportBLAST
ktImportTaxonomy
ktImportMETAREP-BLAST

Run ./updateAccessions.sh to use scripts that get taxonomy IDs from accessions:
Run ktupdateAccessions to use scripts that get taxonomy IDs from accessions:
ktClassifyBLAST
ktGetTaxIDFromAcc
ktImportBLAST
Expand Down
12 changes: 6 additions & 6 deletions KronaTools/lib/KronaTools.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@ sub getTaxInfo

if ( ! open TAX, "<$options{'taxonomy'}/$fileTaxonomy" )
{
print "ERROR: Taxonomy not found in $options{'taxonomy'}. Was updateTaxonomy.sh run?\n";
print "ERROR: Taxonomy not found in $options{'taxonomy'}. Was ktupdateTaxonomy run?\n";
exit 1;
}

Expand Down Expand Up @@ -1348,7 +1348,7 @@ sub getTaxIDFromAcc

if ( ! open ACC, "<$options{'taxonomy'}/$fileTaxByAcc" )
{
print "ERROR: Sorted accession to taxID list not found. Was updateAccessions.sh run?\n";
print "ERROR: Sorted accession to taxID list not found. Was ktupdateAccessions run?\n";
exit 1;
}

Expand Down Expand Up @@ -1527,7 +1527,7 @@ sub loadMagnitudes
sub loadTaxonomy
{
open INFO, "<$options{'taxonomy'}/$fileTaxonomy" or die
"Taxonomy not found in $options{'taxonomy'}. Was updateTaxonomy.sh run?";
"Taxonomy not found in $options{'taxonomy'}. Was ktupdateTaxonomy run?";

while ( my $line = <INFO> )
{
Expand All @@ -1545,7 +1545,7 @@ sub loadTaxonomy
ktDie
(
"Local taxonomy database is out of date and does not support the
-$optionFormats{'noRank'} option. Update using updateTaxonomy.sh."
-$optionFormats{'noRank'} option. Update using ktupdateTaxonomy."
);
}
close INFO;
Expand Down Expand Up @@ -1678,7 +1678,7 @@ sub printWarnings
{
ktWarn
(
"The following accessions were not found in the local database (if they were recently added to NCBI, use updateAccessions.sh to update the local database):\n" .
"The following accessions were not found in the local database (if they were recently added to NCBI, use ktupdateAccessions to update the local database):\n" .
join ' ', (keys %missingAccs)
);

Expand All @@ -1689,7 +1689,7 @@ sub printWarnings
{
ktWarn
(
"The following taxonomy IDs were not found in the local database and were set to root (if they were recently added to NCBI, use updateTaxonomy.sh to update the local database):\n" .
"The following taxonomy IDs were not found in the local database and were set to root (if they were recently added to NCBI, use ktupdateTaxonomy to update the local database):\n" .
join ' ', (keys %missingTaxIDs)
);

Expand Down
7 changes: 6 additions & 1 deletion KronaTools/updateAccessions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
#
# See the LICENSE.txt file included with this software for license information.

ktPath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )"
# This would not resolve symlink:
# ktPath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )"
# Therefore this:
# perl function to resolve symlinks that will function on Linux and OSX (since 'readlink -f' is different under OSX)
readlink_f(){ perl -MCwd -e 'print Cwd::abs_path shift' "$1";}
ktPath=$(dirname $(readlink_f $0))

$ktPath/updateTaxonomy.sh --accessions $@
2 changes: 2 additions & 0 deletions KronaTools/updateTaxonomy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ fi
readlink_f(){ perl -MCwd -e 'print Cwd::abs_path shift' "$1";}
ktPath=$(dirname $(readlink_f $0))

echo $ktPATH

makefileAcc2taxid="scripts/accession2taxid.make"
makefileTaxonomy="scripts/taxonomy.make"

Expand Down