-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #359 from broadinstitute/dp-build-optim
build optimizations
- Loading branch information
Showing
21 changed files
with
114 additions
and
349 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
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
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env python | ||
''' This script installs every Tool needed by viral-ngs | ||
''' | ||
|
||
from __future__ import print_function | ||
import os.path | ||
import sys | ||
import timeit | ||
import tools | ||
from tools import * | ||
import util.file | ||
|
||
__author__ = "[email protected]" | ||
|
||
def install_all_tools(): | ||
sumtime = 0.0 | ||
n_tools = 0 | ||
n_success = 0 | ||
for tool_class in tools.all_tool_classes(): | ||
t = tool_class() | ||
print("installing %s .. " % tool_class.__name__, end="") | ||
sys.stdout.flush() | ||
runtime = timeit.timeit(t.install) | ||
sumtime += runtime | ||
success = t.is_installed() | ||
print("SUCCESS" if success else "FAILED", end="") | ||
print(" (%0.1f seconds)" % runtime) | ||
sys.stdout.flush() | ||
if success: | ||
n_success += 1 | ||
n_tools += 1 | ||
print("Total %d tools attempted, %d succeeded, %d failed, cumulative install time %0.1f seconds" % ( | ||
n_tools, n_success, n_tools - n_success, sumtime)) | ||
return (n_tools == n_success) | ||
|
||
|
||
if __name__ == '__main__': | ||
print("this install script is %s" % ( | ||
os.path.abspath(os.path.expanduser(__file__)))) | ||
print("installing tools into: %s (build, conda-tools, conda-cache)" % ( | ||
os.path.join(util.file.get_project_path(), 'tools'))) | ||
sys.exit(0 if install_all_tools() else 1) |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
blast=2.2.31 | ||
bmtagger=3.101 | ||
diamond=0.7.10=boost1.60_1 | ||
kraken-all=0.10.6_eaf8fb68 | ||
last=719 | ||
mafft=7.221 | ||
mummer=3.23 | ||
muscle=3.8.1551 | ||
mvicuna=1.0 | ||
novoalign=3.03.02 | ||
picard=1.126 | ||
prinseq=0.20.4 | ||
samtools=1.2 | ||
snpeff=4.1l | ||
trimmomatic=0.35 | ||
trinity=date.2011_11_26 | ||
vphaser2=2.0 |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
coveralls==1.1 | ||
flake8<=3 | ||
pycodestyle | ||
mock==2.0.0 | ||
six<2 | ||
|
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 |
---|---|---|
@@ -1,50 +1,17 @@ | ||
# Unit tests for tools/__init__.py | ||
|
||
__author__ = "dpark@broadinstitute.org" | ||
__author__ = "yesimon@broadinstitute.org" | ||
|
||
import tools | ||
from tools import * | ||
import unittest | ||
import tempfile | ||
import shutil | ||
import os | ||
import logging | ||
import util.cmd | ||
import util.file | ||
from test import TestCaseWithTmp | ||
import operator | ||
import pytest | ||
|
||
log = logging.getLogger(__name__) | ||
util.cmd.setup_logger('INFO') | ||
|
||
|
||
def iter_leaf_subclasses(aClass): | ||
"Iterate over subclasses at all levels that don't themselves have a subclass" | ||
isLeaf = True | ||
for subclass in sorted(aClass.__subclasses__(), key=operator.attrgetter("__name__")): | ||
isLeaf = False | ||
for leafClass in iter_leaf_subclasses(subclass): | ||
if not getattr(leafClass, '_skiptest', False): | ||
yield leafClass | ||
if isLeaf: | ||
yield aClass | ||
|
||
|
||
def all_tool_tests(): | ||
for tool_class in iter_leaf_subclasses(tools.Tool): | ||
yield tool_class | ||
|
||
|
||
@pytest.fixture(params=all_tool_tests()) | ||
@pytest.fixture(params=tools.all_tool_classes()) | ||
def tool_class(request): | ||
print(request.param) | ||
return request.param | ||
|
||
|
||
def test_tool_install(tool_class): | ||
t = tool_class() | ||
t.install() | ||
assert t.is_installed(), "installation of tool %s failed" % tool_class.__name__ | ||
log.info(".. installation of %s succeeded with installer %s" % | ||
(tool_class.__name__, t.installed_method.__class__.__name__)) | ||
assert t.is_installed() |
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 |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
__author__ = "[email protected],[email protected]" | ||
|
||
import collections | ||
import json | ||
import operator | ||
import os | ||
import re | ||
import logging | ||
|
@@ -11,7 +13,6 @@ | |
import subprocess | ||
import util.file | ||
import util.misc | ||
import json | ||
|
||
try: | ||
# Python 3.x | ||
|
@@ -39,6 +40,21 @@ | |
_log = logging.getLogger(__name__) | ||
|
||
|
||
def iter_leaf_subclasses(aClass): | ||
"Iterate over subclasses at all levels that don't themselves have a subclass" | ||
isLeaf = True | ||
for subclass in sorted(aClass.__subclasses__(), key=operator.attrgetter("__name__")): | ||
isLeaf = False | ||
for leafClass in iter_leaf_subclasses(subclass): | ||
if not getattr(leafClass, '_skiptest', False): | ||
yield leafClass | ||
if isLeaf: | ||
yield aClass | ||
|
||
def all_tool_classes(): | ||
return iter_leaf_subclasses(Tool) | ||
|
||
|
||
def get_tool_by_name(name): | ||
if name not in installed_tools: | ||
raise NotImplementedError | ||
|
@@ -271,14 +287,14 @@ def __init__( | |
|
||
# if the env is being overridden, or if we could not find an active conda env | ||
if env_root_path or env or not self.env_path: | ||
env_root_path = env_root_path or os.path.join(util.file.get_build_path(), 'conda-tools') | ||
env_root_path = env_root_path or os.path.join(util.file.get_project_path(), 'tools', 'conda-tools') | ||
env = env or 'default' | ||
self.env_path = os.path.realpath(os.path.expanduser( | ||
os.path.join(env_root_path, env))) | ||
|
||
# set an env variable to the conda cache path. this env gets passed to the | ||
# the subprocess, and the variable instructs conda where to place its cache files | ||
conda_cache_path = conda_cache_path or os.path.join(util.file.get_build_path(), 'conda-cache') | ||
conda_cache_path = conda_cache_path or os.path.join(util.file.get_project_path(), 'tools', 'conda-cache') | ||
self.conda_cache_path = os.path.realpath(os.path.expanduser(conda_cache_path)) | ||
self.conda_env = os.environ | ||
old_envs_path = os.environ.get('CONDA_DEFAULT_ENV') | ||
|
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
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
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
Oops, something went wrong.