Skip to content

Commit bbfe11a

Browse files
Merge pull request #45 from LadnerLab/autopepsirf-ISS26
Autopepsirf iss26
2 parents 6ef105a + a41212d commit bbfe11a

File tree

15 files changed

+1263
-837
lines changed

15 files changed

+1263
-837
lines changed

q2_ps_plot/__init__.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
#!/usr/bin/env python
2-
from q2_ps_plot.actions.zenrich import zenrich
3-
from q2_ps_plot.actions.zenrich_tsv import zenrich_tsv
4-
from q2_ps_plot.actions.boxplot import readCountsBoxplot
5-
from q2_ps_plot.actions.scatter import repScatters
2+
from . import _version
3+
4+
__all__ = [
5+
"zenrich", "zenrich_tsv", "readCountsBoxplot",
6+
"repScatters", "enrichmentRCBoxplot", "proteinHeatmap"
7+
]
8+
__version__ = _version.get_versions()["version"]
9+
610
from q2_ps_plot.actions.boxplot import enrichmentRCBoxplot
11+
from q2_ps_plot.actions.boxplot import readCountsBoxplot
712
from q2_ps_plot.actions.heatmap import proteinHeatmap
13+
from q2_ps_plot.actions.scatter import repScatters
14+
from q2_ps_plot.actions.zenrich import zenrich
15+
from q2_ps_plot.actions.zenrich_tsv import zenrich_tsv
816

9-
__all__ = ['zenrich', 'zenrich_tsv', 'readCountsBoxplot', 'repScatters', 'enrichmentRCBoxplot', 'proteinHeatmap']
10-
11-
from . import _version
12-
__version__ = _version.get_versions()['version']

q2_ps_plot/_version.py

Lines changed: 92 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# This file helps to compute a version number in source trees obtained from
32
# git-archive tarball (such as those provided by githubs download-from-tag
43
# feature). Distribution tarballs (built by setup.py sdist) and build
@@ -77,10 +76,13 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
7776
try:
7877
dispcmd = str([command] + args)
7978
# remember shell=False, so use git.cmd on windows, not just git
80-
process = subprocess.Popen([command] + args, cwd=cwd, env=env,
81-
stdout=subprocess.PIPE,
82-
stderr=(subprocess.PIPE if hide_stderr
83-
else None))
79+
process = subprocess.Popen(
80+
[command] + args,
81+
cwd=cwd,
82+
env=env,
83+
stdout=subprocess.PIPE,
84+
stderr=(subprocess.PIPE if hide_stderr else None)
85+
)
8486
break
8587
except EnvironmentError:
8688
e = sys.exc_info()[1]
@@ -115,15 +117,21 @@ def versions_from_parentdir(parentdir_prefix, root, verbose):
115117
for _ in range(3):
116118
dirname = os.path.basename(root)
117119
if dirname.startswith(parentdir_prefix):
118-
return {"version": dirname[len(parentdir_prefix):],
119-
"full-revisionid": None,
120-
"dirty": False, "error": None, "date": None}
120+
return {
121+
"version": dirname[len(parentdir_prefix):],
122+
"full-revisionid": None,
123+
"dirty": False,
124+
"error": None,
125+
"date": None
126+
}
121127
rootdirs.append(root)
122128
root = os.path.dirname(root) # up a level
123129

124130
if verbose:
125-
print("Tried directories %s but none started with prefix %s" %
126-
(str(rootdirs), parentdir_prefix))
131+
print(
132+
"Tried directories %s but none started with prefix %s"
133+
% (str(rootdirs), parentdir_prefix)
134+
)
127135
raise NotThisMethod("rootdir doesn't start with parentdir_prefix")
128136

129137

@@ -162,7 +170,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
162170
raise NotThisMethod("Short version file found")
163171
date = keywords.get("date")
164172
if date is not None:
165-
# Use only the last line. Previous lines may contain GPG signature
173+
# Use only the last line. Previous lines may contain GPG signature
166174
# information.
167175
date = date.splitlines()[-1]
168176

@@ -207,16 +215,23 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
207215
continue
208216
if verbose:
209217
print("picking %s" % r)
210-
return {"version": r,
211-
"full-revisionid": keywords["full"].strip(),
212-
"dirty": False, "error": None,
213-
"date": date}
218+
return {
219+
"version": r,
220+
"full-revisionid": keywords["full"].strip(),
221+
"dirty": False,
222+
"error": None,
223+
"date": date
224+
}
214225
# no suitable tags, so version is "0+unknown", but full hex is still there
215226
if verbose:
216227
print("no suitable tags, using unknown + full revision id")
217-
return {"version": "0+unknown",
218-
"full-revisionid": keywords["full"].strip(),
219-
"dirty": False, "error": "no suitable tags", "date": None}
228+
return {
229+
"version": "0+unknown",
230+
"full-revisionid": keywords["full"].strip(),
231+
"dirty": False,
232+
"error": "no suitable tags",
233+
"date": None
234+
}
220235

221236

222237
@register_vcs_handler("git", "pieces_from_vcs")
@@ -231,19 +246,24 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command):
231246
if sys.platform == "win32":
232247
GITS = ["git.cmd", "git.exe"]
233248

234-
_, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root,
235-
hide_stderr=True)
249+
_, rc = runner(
250+
GITS, ["rev-parse", "--git-dir"], cwd=root, hide_stderr=True
251+
)
236252
if rc != 0:
237253
if verbose:
238254
print("Directory %s not under git control" % root)
239255
raise NotThisMethod("'git rev-parse --git-dir' returned error")
240256

241257
# if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
242258
# if there isn't one, this yields HEX[-dirty] (no NUM)
243-
describe_out, rc = runner(GITS, ["describe", "--tags", "--dirty",
244-
"--always", "--long",
245-
"--match", "%s*" % tag_prefix],
246-
cwd=root)
259+
describe_out, rc = runner(
260+
GITS,
261+
["describe", "--tags", "--dirty",
262+
"--always", "--long", "--match",
263+
"%s*" % tag_prefix
264+
],
265+
cwd=root
266+
)
247267
# --long was added in git-1.5.5
248268
if describe_out is None:
249269
raise NotThisMethod("'git describe' failed")
@@ -258,8 +278,9 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command):
258278
pieces["short"] = full_out[:7] # maybe improved later
259279
pieces["error"] = None
260280

261-
branch_name, rc = runner(GITS, ["rev-parse", "--abbrev-ref", "HEAD"],
262-
cwd=root)
281+
branch_name, rc = runner(
282+
GITS, ["rev-parse", "--abbrev-ref", "HEAD"], cwd=root
283+
)
263284
# --abbrev-ref was added in git-1.6.3
264285
if rc != 0 or branch_name is None:
265286
raise NotThisMethod("'git rev-parse --abbrev-ref' returned error")
@@ -308,8 +329,10 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command):
308329
mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe)
309330
if not mo:
310331
# unparseable. Maybe git-describe is misbehaving?
311-
pieces["error"] = ("unable to parse git-describe output: '%s'"
312-
% describe_out)
332+
pieces["error"] = (
333+
"unable to parse git-describe output: '%s'"
334+
% describe_out
335+
)
313336
return pieces
314337

315338
# tag
@@ -318,8 +341,10 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command):
318341
if verbose:
319342
fmt = "tag '%s' doesn't start with prefix '%s'"
320343
print(fmt % (full_tag, tag_prefix))
321-
pieces["error"] = ("tag '%s' doesn't start with prefix '%s'"
322-
% (full_tag, tag_prefix))
344+
pieces["error"] = (
345+
"tag '%s' doesn't start with prefix '%s'"
346+
% (full_tag, tag_prefix)
347+
)
323348
return pieces
324349
pieces["closest-tag"] = full_tag[len(tag_prefix):]
325350

@@ -336,7 +361,9 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command):
336361
pieces["distance"] = int(count_out) # total number of commits
337362

338363
# commit date: see ISO-8601 comment in git_versions_from_keywords()
339-
date = runner(GITS, ["show", "-s", "--format=%ci", "HEAD"], cwd=root)[0].strip()
364+
date = runner(
365+
GITS, ["show", "-s", "--format=%ci", "HEAD"], cwd=root
366+
)[0].strip()
340367
# Use only the last line. Previous lines may contain GPG signature
341368
# information.
342369
date = date.splitlines()[-1]
@@ -370,8 +397,7 @@ def render_pep440(pieces):
370397
rendered += ".dirty"
371398
else:
372399
# exception #1
373-
rendered = "0+untagged.%d.g%s" % (pieces["distance"],
374-
pieces["short"])
400+
rendered = "0+untagged.%d.g%s" % (pieces["distance"], pieces["short"])
375401
if pieces["dirty"]:
376402
rendered += ".dirty"
377403
return rendered
@@ -400,8 +426,7 @@ def render_pep440_branch(pieces):
400426
rendered = "0"
401427
if pieces["branch"] != "master":
402428
rendered += ".dev0"
403-
rendered += "+untagged.%d.g%s" % (pieces["distance"],
404-
pieces["short"])
429+
rendered += "+untagged.%d.g%s" % (pieces["distance"], pieces["short"])
405430
if pieces["dirty"]:
406431
rendered += ".dirty"
407432
return rendered
@@ -544,11 +569,13 @@ def render_git_describe_long(pieces):
544569
def render(pieces, style):
545570
"""Render the given version pieces into the requested style."""
546571
if pieces["error"]:
547-
return {"version": "unknown",
548-
"full-revisionid": pieces.get("long"),
549-
"dirty": None,
550-
"error": pieces["error"],
551-
"date": None}
572+
return {
573+
"version": "unknown",
574+
"full-revisionid": pieces.get("long"),
575+
"dirty": None,
576+
"error": pieces["error"],
577+
"date": None
578+
}
552579

553580
if not style or style == "default":
554581
style = "pep440" # the default
@@ -572,9 +599,13 @@ def render(pieces, style):
572599
else:
573600
raise ValueError("unknown style '%s'" % style)
574601

575-
return {"version": rendered, "full-revisionid": pieces["long"],
576-
"dirty": pieces["dirty"], "error": None,
577-
"date": pieces.get("date")}
602+
return {
603+
"version": rendered,
604+
"full-revisionid": pieces["long"],
605+
"dirty": pieces["dirty"],
606+
"error": None,
607+
"date": pieces.get("date")
608+
}
578609

579610

580611
def get_versions():
@@ -588,8 +619,9 @@ def get_versions():
588619
verbose = cfg.verbose
589620

590621
try:
591-
return git_versions_from_keywords(get_keywords(), cfg.tag_prefix,
592-
verbose)
622+
return git_versions_from_keywords(
623+
get_keywords(), cfg.tag_prefix, verbose
624+
)
593625
except NotThisMethod:
594626
pass
595627

@@ -601,10 +633,13 @@ def get_versions():
601633
for _ in cfg.versionfile_source.split('/'):
602634
root = os.path.dirname(root)
603635
except NameError:
604-
return {"version": "0+unknown", "full-revisionid": None,
605-
"dirty": None,
606-
"error": "unable to find root of source tree",
607-
"date": None}
636+
return {
637+
"version": "0+unknown",
638+
"full-revisionid": None,
639+
"dirty": None,
640+
"error": "unable to find root of source tree",
641+
"date": None
642+
}
608643

609644
try:
610645
pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
@@ -618,6 +653,11 @@ def get_versions():
618653
except NotThisMethod:
619654
pass
620655

621-
return {"version": "0+unknown", "full-revisionid": None,
622-
"dirty": None,
623-
"error": "unable to compute version", "date": None}
656+
return {
657+
"version": "0+unknown",
658+
"full-revisionid": None,
659+
"dirty": None,
660+
"error": "unable to compute version",
661+
"date": None
662+
}
663+

q2_ps_plot/actions/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env python
2+
3+
__all__ = ["zenrich", "zenrich_tsv"]
4+
25
from q2_ps_plot.actions.zenrich import zenrich
36
from q2_ps_plot.actions.zenrich_tsv import zenrich_tsv
47

5-
__all__ = ['zenrich', 'zenrich_tsv']

0 commit comments

Comments
 (0)