Skip to content

Commit

Permalink
add project-level piface project properties
Browse files Browse the repository at this point in the history
  • Loading branch information
stolarczyk committed Apr 19, 2020
1 parent 7dd89ee commit 27e3b6b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 16 deletions.
2 changes: 1 addition & 1 deletion looper/html_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def create_project_objects(self):
links = []
warnings = []
ifaces = self.prj.get_interfaces(protocol)

ifaces = self.prj.pipeline_interfaces
# Check the interface files for summarizers
for iface in ifaces:
pl = iface.fetch_pipelines(protocol)
Expand Down
15 changes: 1 addition & 14 deletions looper/looper.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,20 +238,7 @@ def __call__(self, args, remaining_args, **compute_kwargs):
recognized by looper, germane to samples/pipelines
"""
jobs = 0
project_pifaces = self.prj._samples_by_interface.keys()
if self.prj.piface_key in self.prj[CONFIG_KEY][LOOPER_KEY]:
# pipeline interfaces sources defined in the project config override
# ones that are matched by the Samples in this Project
cfg_pifaces = self.prj[CONFIG_KEY][LOOPER_KEY][self.prj.piface_key]
_LOGGER.debug("Overwriting sample-matched pifaces with a "
"config-specified ones: {}".format(cfg_pifaces))
# make sure it's a list, so both lists and strings can be
# specified in the config
if isinstance(cfg_pifaces, str):
cfg_pifaces = [cfg_pifaces]
project_pifaces = [expandpath(src) for src in cfg_pifaces]
_LOGGER.debug("Matched {} project pipeline interfaces".
format(len(project_pifaces)))
project_pifaces = self.prj.project_pipeline_interface_sources
if not project_pifaces:
raise MisconfigurationException(
"Looper requires at least one pointer to project-level pipeline"
Expand Down
39 changes: 38 additions & 1 deletion looper/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,43 @@ def make_project_dirs(self):
_LOGGER.warning("Could not create project folder: '{}'".
format(str(e)))

@property
def project_pipeline_interface_sources(self):
"""
Get a list of all valid project-level pipeline interface sources
associated with this project. Sources that are file paths are expanded
:return list[str]: collection of valid pipeline interface sources:
"""
project_pifaces = self._samples_by_interface.keys()
if self.piface_key in self[CONFIG_KEY][LOOPER_KEY]:
# pipeline interfaces sources defined in the project config override
# ones that are matched by the Samples in this Project
cfg_pifaces = self[CONFIG_KEY][LOOPER_KEY][self.piface_key]
_LOGGER.debug("Overwriting sample-matched pifaces with a "
"config-specified ones: {}".format(cfg_pifaces))
# make sure it's a list, so both lists and strings can be
# specified in the config
if isinstance(cfg_pifaces, str):
cfg_pifaces = [cfg_pifaces]
project_pifaces = [expandpath(src) for src in cfg_pifaces]
return project_pifaces

@property
def project_pipeline_interfaces(self):
"""
Flat list of all valid project-level interface objects associated
with this Project
Note that only valid pipeline interfaces will show up in the
result (ones that exist on disk/remotely and validate successfully
against the schema)
:return list[looper.PipelineInterface]: list of pipeline interfaces
"""
return [PipelineInterface(pi)
for pi in self.project_pipeline_interface_sources]

@property
def pipeline_interfaces(self):
"""
Expand All @@ -209,7 +246,7 @@ def pipeline_interfaces(self):
result (ones that exist on disk/remotely and validate successfully
against the schema)
:return list[looper.PipelineInterface]:
:return list[looper.PipelineInterface]: list of pipeline interfaces
"""
return [i for s in self._interfaces_by_sample.values() for i in s]

Expand Down

0 comments on commit 27e3b6b

Please sign in to comment.