diff --git a/scripts/tbprofiler_generate_haplotypes.py b/scripts/tbprofiler_generate_haplotypes.py index 32b9b19..5274dfa 100644 --- a/scripts/tbprofiler_generate_haplotypes.py +++ b/scripts/tbprofiler_generate_haplotypes.py @@ -6,9 +6,27 @@ from tqdm import tqdm import sys import pathogenprofiler as pp + + +try: + sys.base_prefix +except: + sys.base_prefix = getattr(sys, 'base_prefix', getattr(sys, 'real_prefix', sys.prefix)) + + +def get_conf_dict(library_prefix): + files = {"gff":".gff","ref":".fasta","ann":".ann.txt","barcode":".barcode.bed","bed":".bed","json_db":".dr.json","version":".version.json"} + conf = {} + for key in files: + sys.stderr.write("Using %s file: %s\n" % (key,library_prefix+files[key])) + conf[key] = pp.filecheck(library_prefix+files[key]) + return conf + + + def main(args): change_field = "change" if args.variant_format=="hgvs" else "_internal_change" - conf = json.load(open(sys.prefix+"/share/tbprofiler/%s.config.json" % args.db)) + conf = conf = get_conf_dict(sys.base_prefix + "/share/tbprofiler/%s" % args.db) drug2genes = defaultdict(set) gene2drugs = defaultdict(set) for l in open(conf["bed"]): diff --git a/setup.py b/setup.py index b1e9c39..b10ae7a 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setuptools.setup( name="tbprofiler", - version="2.6.2", + version="2.7.1", packages=["tbprofiler",], license="MIT", long_description="TBProfiler command line tool", diff --git a/tb-profiler b/tb-profiler index 9da4062..0c571dc 100644 --- a/tb-profiler +++ b/tb-profiler @@ -119,6 +119,8 @@ def main_profile(args): pp.run_cmd("rm -f %(dir)s/%(prefix)s.targets*.vcf.gz %(dir)s/%(prefix)s*.del_pos.bed %(dir)s/%(prefix)s.*.csi" % vars(args)) if args.platform=="Illumina": pp.run_cmd("rm %(dir)s/%(prefix)s.targets.delly.bcf" % vars(args)) + if args.platform=="minION" or args.caller=="BCFtools": + pp.run_cmd("rm %(dir)s/%(prefix)s.targets.gbcf" % vars(args)) if args.webserver: html_output = args.webserver_root+"/output/"+args.prefix+".html" tbp.write_html(results,conf,html_output,extra_columns,["isoniazid","rifampicin","ethambutol","pyrazinamide","streptomycin","ethionamide","fluoroquinolones","amikacin","capreomycin","kanamycin"]) diff --git a/tbprofiler/__init__.py b/tbprofiler/__init__.py index a9b6146..09cc6a0 100644 --- a/tbprofiler/__init__.py +++ b/tbprofiler/__init__.py @@ -7,4 +7,4 @@ from .vcfprofile import * import os _ROOT = os.path.abspath(os.path.dirname(__file__)) -_VERSION = "2.6.1" +_VERSION = "2.7.1"