Skip to content

Commit

Permalink
Merge pull request #23 from pepkit/dev
Browse files Browse the repository at this point in the history
version 0.8.1 bugfix release
  • Loading branch information
nsheff committed Apr 2, 2018
2 parents dbfb0d9 + 13028d0 commit 67e24d1
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ open_pipelines/
# pytest-related
.cache/
.coverage
.pytest_cache

# Reserved files for comparison
*RESERVE*
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Detailed instructions are in the [Read the Docs documentation](http://looper.rea


```
pip install --user looper
pip install --user https://github.com/pepkit/looper/zipball/master
export PATH=$PATH:~/.local/bin
```

Expand Down
6 changes: 5 additions & 1 deletion doc/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
Changelog
******************************

- **v0.8.1** (*2018-02-27*):
- **v0.8.1** (*2018-04-02*):

- Changed

- Minor documentation and packaging updates for first Pypi release.

- Fix a bug that incorrectly mapped protocols due to case sensitive issues

- Fix a bug with ``report_figure`` that made it output pandas code


- **v0.8.0** (*2018-01-19*):

Expand Down
33 changes: 19 additions & 14 deletions looper/looper.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ def __call__(self):

columns = []
stats = []
figs = []
figs = _pd.DataFrame()

for sample in self.prj.samples:
_LOGGER.info(self.counter.show(sample.sample_name, sample.protocol))
Expand Down Expand Up @@ -612,14 +612,8 @@ def __call__(self):

t = _pd.read_table(
figs_file, header=None, names=['key', 'value', 'pl'])

t.drop_duplicates(subset=['key', 'pl'], keep='last', inplace=True)

t.loc[:, 'plkey'] = t['pl'] + ":" + t['key']
dupes = t.duplicated(subset=['key'], keep=False)
t.loc[dupes, 'key'] = t.loc[dupes, 'plkey']

figs.append(t)
t['sample_name'] = sample.name
figs = figs.append(t, ignore_index=True)

# all samples are parsed. Produce file.

Expand All @@ -646,11 +640,22 @@ def __call__(self):
root=os.path.join(self.prj.metadata.output_dir, self.prj.name))

figs_html_file = open(figs_html_path, 'w')

img_code = "<h1>{key}</h1><a href='{path}'><img src='{path}'></a>\n"
for fig in figs:
figs_html_file.write(img_code.format(
key=str(fig['key']), path=fig['value']))
html_header = "<html><h1>Summary of sample figures for project {}</h1>\n".format(self.prj.name)
figs_html_file.write(html_header)
sample_img_header = "<h3>{sample_name}</h3>\n"
sample_img_code = "<p><a href='{path}'><img src='{path}'>{key}</a></p>\n"

figs.drop_duplicates(keep='last', inplace=True)
for sample_name in figs['sample_name'].drop_duplicates().sort_values():
f = figs[figs['sample_name'] == sample_name]
figs_html_file.write(sample_img_header.format(sample_name=sample_name))

for i, row in f.iterrows():
figs_html_file.write(sample_img_code.format(
key=str(row['key']), path=row['value']))

html_footer = "</html>"
figs_html_file.write(html_footer)

figs_html_file.close()
_LOGGER.info(
Expand Down
4 changes: 3 additions & 1 deletion looper/pipeline_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def __init__(self, config):
pipe_data["path"] = pipe_path

self.pipe_iface = self.pipe_iface_config["pipelines"]
self.protomap = self.pipe_iface_config["protocol_mapping"]
self.protomap = {utils.alpha_cased(proto): pipekey
for proto, pipekey in
self.pipe_iface_config["protocol_mapping"].items()}


def __getitem__(self, item):
Expand Down
7 changes: 6 additions & 1 deletion looper/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ def build_submission_bundles(self, protocol, priority=True):
those already mapped and those not yet mapped
"""

protocol = alpha_cased(protocol)

if not priority:
raise NotImplementedError(
"Currently, only prioritized protocol mapping is supported "
Expand All @@ -110,11 +112,12 @@ def build_submission_bundles(self, protocol, priority=True):
self.interfaces_by_protocol[protocol]
except KeyError:
# Messaging can be done by the caller.
_LOGGER.debug("No interface for protocol: %s", protocol)
return []

job_submission_bundles = []
pipeline_keys_used = set()
_LOGGER.debug("Building pipelines for {} PIs...".
_LOGGER.debug("Building pipelines for {} interface(s)...".
format(len(pipeline_interfaces)))

bundle_by_strict_pipe_key = {}
Expand All @@ -131,6 +134,8 @@ def build_submission_bundles(self, protocol, priority=True):

this_protocol_pipelines = pipe_iface.fetch_pipelines(protocol)
if not this_protocol_pipelines:
_LOGGER.debug("No pipelines; available: {}".format(
", ".join(pipe_iface.protomap.keys())))
continue

# TODO: update once dependency-encoding logic is in place.
Expand Down

0 comments on commit 67e24d1

Please sign in to comment.