Skip to content

Commit 5e02b5e

Browse files
committed
update ete run scripts + misc
1 parent 0dc5cb3 commit 5e02b5e

File tree

6 files changed

+14
-17
lines changed

6 files changed

+14
-17
lines changed

bin/plot-lb-tree.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def plot_trees(args):
381381
parser.add_argument('--label-root-node', action='store_true')
382382
parser.add_argument('--node-label-regex', help='portion of node label to keep (rest is discarded if regex is found, if no regex label is left unchanged). E.g. \'ig.\' reduces them all to the locus')
383383
parser.add_argument('--tree-style', default='rectangular', choices=['rectangular', 'circular'])
384-
parser.add_argument('--partis-dir', default=str(Path(__file__)).parent.parent), help='path to main partis install dir')
384+
parser.add_argument('--partis-dir', default=str(Path(__file__).parent.parent), help='path to main partis install dir')
385385
parser.add_argument('--log-lbr', action='store_true')
386386
parser.add_argument('--seq-len', type=int)
387387
parser.add_argument('--uid-translations', help='colon-separated list of comma-separated pairs of uid:translated-id pairs')
@@ -398,16 +398,11 @@ def plot_trees(args):
398398
if args.meta_info_key_to_color is None and not args.meta_info_to_emphasize: # it'd be nice to move this stuff, but whatevs
399399
print(' note: if neither --meta-info-key-to-color or --meta-info-to-emphasize are set, other style attributes may not be set')
400400

401-
sys.path.insert(1, args.partis_dir) # + '/python')
402-
try:
403-
import partis.utils as utils
404-
import partis.treeutils as treeutils
405-
import partis.glutils as glutils
406-
import partis.plotting as plotting
407-
import partis.lbplotting as lbplotting
408-
except ImportError as e:
409-
print(e)
410-
raise Exception('couldn\'t import from main partis dir \'%s\' (set with --partis-dir)' % args.partis_dir)
401+
import partis.utils as utils
402+
import partis.treeutils as treeutils
403+
import partis.glutils as glutils
404+
import partis.plotting as plotting
405+
import partis.lbplotting as lbplotting
411406
args.meta_info_to_emphasize = utils.get_arg_list(args.meta_info_to_emphasize, key_val_pairs=True)
412407
args.meta_emph_formats = utils.get_arg_list(args.meta_emph_formats, key_val_pairs=True)
413408
utils.meta_emph_arg_process(args)

bin/test-germline-inference.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def get_outfname(args, method, annotation_performance_plots=False, return_parent
3838
def simulate(args):
3939
if utils.output_exists(args, args.simfname):
4040
return
41-
cmd_str = args.partis_path + ' simulate --n-sim-events ' + str(args.n_sim_events) + ' --outfname ' + args.simfname + ' --n-leaves ' + str(args.n_leaves) + ' --rearrange-from-scratch --force-dont-generate-germline-set --shm-parameter-dir ' + partis_dir + '/data/recombinator/scratch-parameters'
41+
cmd_str = args.partis_path + ' simulate --n-sim-events ' + str(args.n_sim_events) + ' --outfname ' + args.simfname + ' --n-leaves ' + str(args.n_leaves) + ' --rearrange-from-scratch --force-dont-generate-germline-set --shm-parameter-dir ' + utils.get_partis_dir() + '/data/recombinator/scratch-parameters'
4242
cmd_str += ' --allow-nonfunctional-scratch-seqs'
4343
if args.n_leaf_distribution is None:
4444
cmd_str += ' --constant-number-of-leaves'
@@ -105,7 +105,7 @@ def run_other_method(args, method):
105105
cmd += ' --overwrite'
106106
if args.gls_gen:
107107
cmd += ' --gls-gen'
108-
cmd += ' --glfo-dir ' + partis_dir + '/' + args.default_germline_dir # the partis mehods have this as the default internally, but we want/have to set it explicitly here
108+
cmd += ' --glfo-dir ' + utils.get_partis_dir() + '/' + args.default_germline_dir # the partis mehods have this as the default internally, but we want/have to set it explicitly here
109109
else:
110110
cmd += ' --glfo-dir ' + args.inf_glfo_dir
111111
cmd += ' --simulation-germline-dir ' + args.outdir + '/germlines/simulation' # alleleclusterer is the only one that really uses this, but for now I want its dbg output to have the sim info

partis/partitionplotter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from __future__ import print_function
33
import csv
44
import os
5+
import shutil
56
import math
67
import numpy
78
import itertools
@@ -954,7 +955,7 @@ def vmuts(vclass_muts, mutfo, uid):
954955
skstrs = ', '.join('%d (%s)'%(n_skipped[k], skip_dbg_strs.get(k, k)) for k in [k for k in sorted(n_skipped) if n_skipped[k]>0])
955956
print(' skipped %d / %d trees (ran %d): %s' % (sum(n_skipped.values()), len(self.sclusts), len(cmdfos), skstrs))
956957

957-
clean_up = False
958+
clean_up = True
958959
if len(cmdfos) > 0:
959960
# TODO keep all i/o files, save command line
960961
# sys.exit()

partis/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5278,8 +5278,8 @@ def mamba_cmds(env, only_prep=False):
52785278
# ----------------------------------------------------------------------------------------
52795279
def run_ete_script(sub_cmd, return_for_cmdfos=False, dryrun=False, extra_str='', debug=True):
52805280
prof_cmds = '' #' -m cProfile -s tottime -o prof.out'
5281-
# xvfb_err_str = '' # '-e %s' % XXX outdir + '/xvfb-err' # tell xvfb-run to write its error to this file (rather than its default of /dev/null). This is only errors actually from xvfb-run, e.g. xauth stuff is broken
5282-
cmd = '%s/bin/xvfb-run -a python3%s %s' % (get_partis_dir(), prof_cmds, sub_cmd)
5281+
# Use QT_QPA_PLATFORM=offscreen for PyQt5 headless rendering (no need for xvfb-run)
5282+
cmd = 'QT_QPA_PLATFORM=offscreen python3%s %s' % (prof_cmds, sub_cmd)
52835283
if debug or dryrun:
52845284
print('%s%s %s' % (extra_str, color('red', 'run'), cmd))
52855285
if return_for_cmdfos:

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ def has_ext_modules(self):
139139
'plotting': [
140140
'circlify',
141141
'ete3',
142+
'PyQt5',
142143
'joypy',
143144
'levenshtein',
144145
],

test/mobille-igblast-run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def convert_file(ifnfcn, ofnfcn, airr_input=False, igbl_gldir=False, plot_perfor
107107
if airr_input:
108108
cmd += ' --airr-input'
109109
if igbl_gldir:
110-
cmd += ' --glfo-dir %s/igbl-db/fasta/partis-format-parsed --locus %s' % (args.igbdir, locus) # --template-glfo-dir %s/data/germlines/%s, partis_dir, args.species) # just ran with the template set once so i could write the parsed glfo dirs
110+
cmd += ' --glfo-dir %s/igbl-db/fasta/partis-format-parsed --locus %s' % (args.igbdir, locus) # --template-glfo-dir %s/data/germlines/%s, utils.get_partis_dir(), args.species) # just ran with the template set once so i could write the parsed glfo dirs
111111
if plot_performance:
112112
cmd += ' --simfname %s --plotdir %s --only-csv-plots --only-plot-performance' % (simfn(locus), antn_plotdir(locus))
113113
cmdfos += [{

0 commit comments

Comments
 (0)