Skip to content

Commit

Permalink
Move graph tools into global
Browse files Browse the repository at this point in the history
Closes #111
  • Loading branch information
johnlees committed Oct 14, 2020
1 parent eea8d9f commit 97d215f
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 24 deletions.
1 change: 0 additions & 1 deletion PopPUNK/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import sys
# additional
import numpy as np
import graph_tool.all as gt
import subprocess
from collections import defaultdict

Expand Down
1 change: 0 additions & 1 deletion PopPUNK/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion PopPUNK/reference_pick.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import sys
# additional
from shutil import copyfile
import graph_tool.all as gt

# import poppunk package
from .__init__ import __version__
Expand Down
21 changes: 2 additions & 19 deletions PopPUNK/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion PopPUNK/visualise.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/poppunk_extract_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 97d215f

Please sign in to comment.