diff --git a/PopPUNK/__main__.py b/PopPUNK/__main__.py index 877c88ac..9a3fdfcf 100644 --- a/PopPUNK/__main__.py +++ b/PopPUNK/__main__.py @@ -7,7 +7,6 @@ import sys # additional import numpy as np -import graph_tool.all as gt import subprocess from collections import defaultdict diff --git a/PopPUNK/network.py b/PopPUNK/network.py index 1647c0d2..5c9951b1 100644 --- a/PopPUNK/network.py +++ b/PopPUNK/network.py @@ -12,7 +12,6 @@ import operator import shutil import subprocess -import graph_tool.all as gt import numpy as np import pandas as pd from scipy.stats import rankdata diff --git a/PopPUNK/reference_pick.py b/PopPUNK/reference_pick.py index 082d943c..60aadb6b 100755 --- a/PopPUNK/reference_pick.py +++ b/PopPUNK/reference_pick.py @@ -7,7 +7,6 @@ import sys # additional from shutil import copyfile -import graph_tool.all as gt # import poppunk package from .__init__ import __version__ diff --git a/PopPUNK/utils.py b/PopPUNK/utils.py index 062d6c6b..59f24799 100644 --- a/PopPUNK/utils.py +++ b/PopPUNK/utils.py @@ -12,7 +12,6 @@ from collections import defaultdict from tempfile import mkstemp from functools import partial -import graph_tool.all as gt import numpy as np import pandas as pd @@ -21,6 +20,8 @@ import pp_sketchlib def setGtThreads(threads): + global gt + import graph_tool.all as gt # Check on parallelisation of graph-tools if gt.openmp_enabled(): gt.openmp_set_num_threads(threads) @@ -193,24 +194,6 @@ def listDistInts(refSeqs, querySeqs, self=True): return comparisons -def writeTmpFile(fileList): - """Writes a list to a temporary file. Used for turning variable into mash - input. - - Args: - fileList (list) - List of files to write to file - Returns: - tmpName (str) - Name of temp file list written to - """ - tmpName = mkstemp(suffix=".tmp", dir=".")[1] - with open(tmpName, 'w') as tmpFile: - for fileName in fileList: - tmpFile.write(fileName + '\t' + fileName + "\n") - - return tmpName - def qcDistMat(distMat, refList, queryList, a_max): """Checks distance matrix for outliers. At the moment diff --git a/PopPUNK/visualise.py b/PopPUNK/visualise.py index 9bb06333..536fb626 100644 --- a/PopPUNK/visualise.py +++ b/PopPUNK/visualise.py @@ -7,7 +7,6 @@ import sys # additional import numpy as np -import graph_tool.all as gt # required from v2.1.1 onwards (no mash support) import pp_sketchlib diff --git a/scripts/poppunk_extract_components.py b/scripts/poppunk_extract_components.py index 51f93faf..4f13ea9a 100755 --- a/scripts/poppunk_extract_components.py +++ b/scripts/poppunk_extract_components.py @@ -3,7 +3,6 @@ # Copyright 2018 John Lees and Nick Croucher import sys -import graph_tool.all as gt from scipy.stats import rankdata import argparse @@ -27,6 +26,7 @@ def get_options(): args = get_options() # open stored graph + import graph_tool.all as gt G = gt.load_graph(args.graph) # extract individual components