Skip to content

Commit

Permalink
Scottx611x/derived node attributes bugfix (#2076)
Browse files Browse the repository at this point in the history
* Update Galaxy mock data

* Fix `help`

* Add constants

* Dynamically create analysis group numbers based on the structure of our workflow

* Fix docstring

* Use temp var for easier readability

* Add mechanism to derive which Refinery file a workflow output was derived from, and in turn gain information about which analysis group said output belongs to.

* Fix tests

* Fix typo

* Add docstrings

* Don't overuse `@property`. Make method private

* Remove statements from debugging

* Change to default value

* Fix styling

* Remove comment stating the obvious

* Flip if/else logic to be more clear

* Add constant

* Add test coverage for `Workflowtool._has_dataset_collection_input()`

* Fix typo

* Add logic to determine analysis group numbering, and test coverage

* Fix spelling

* Add tests coverage for an edge case in the recursive calls to `WorkflowTool._get_refinery_input_file_id()`

* Fix bug where incorrect AnnotatedNode information was being indexed in solr. Add test coverage.

* Add test coverage for `_get_analysis_group_number`

* Simplify logic

* Tidy mock glaxy data

* DRY: condense repeated calls in tests

* Fix tests

* Address issue while creating expanded workflow graph where Dataset Collections were never considered

* Update AnalysisNodeConnection input creation and update tests

* Assert that we assign the correct name to input AnalysisNodeConnections
  • Loading branch information
scottx611x committed Sep 5, 2017
1 parent e769fb1 commit 624a691
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
11 changes: 9 additions & 2 deletions refinery/galaxy_connector/galaxy_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import networkx as nx

from core.utils import get_aware_local_time
import tool_manager

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -529,6 +530,11 @@ def configure_workflow(workflow_dict, ret_list):
def create_expanded_workflow_graph(dictionary):
graph = nx.MultiDiGraph()
steps = dictionary["steps"]
galaxy_input_types = [
'data_input',
tool_manager.models.WorkflowTool.DATA_COLLECTION_INPUT
]

# iterate over steps to create nodes
for current_node_id, step in steps.iteritems():
# ensure node id is an integer
Expand All @@ -553,9 +559,10 @@ def create_expanded_workflow_graph(dictionary):
parent_node_id = input_connection["id"]
# test if parent node is a tool node or an input node to pick the
# right name for the outgoing edge
if graph.node[parent_node_id]['type'] == 'data_input':
parent_node_output_name = \
if graph.node[parent_node_id]['type'] in galaxy_input_types:
parent_node_output_name = (
steps[str(parent_node_id)]['inputs'][0]['name']
)
else:
parent_node_output_name = input_connection['output_name']

Expand Down
5 changes: 3 additions & 2 deletions refinery/tool_manager/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ class WorkflowTool(Tool):
GALAXY_WORKFLOW_INVOCATION_DATA = "galaxy_workflow_invocation_data"
GALAXY_TO_REFINERY_MAPPING_LIST = "galaxy_to_refinery_mapping_list"
HISTORY_DATASET_COLLECTION_ASSOCIATION = "hdca"
INPUT_DATASET_COLLECTION = "Input Dataset Collection"
LIST = "list"
PAIRED = "paired"
REVERSE = "reverse"
Expand Down Expand Up @@ -581,9 +582,9 @@ def create_analysis_input_node_connections(self):
analysis=self.analysis,
node=node,
direction=INPUT_CONNECTION,
name=node.name,
name=file_store_item.datafile.name,
step=0,
filename=file_store_item.datafile.name,
filename=self.INPUT_DATASET_COLLECTION,
is_refinery_file=file_store_item.is_local()
)

Expand Down
12 changes: 12 additions & 0 deletions refinery/tool_manager/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1429,10 +1429,22 @@ def test_analysis_node_connections_are_created_for_all_input_nodes(self):
]
self.assertEqual(len(analysis_node_connections), len(tool_nodes))
for analysis_node_connection in analysis_node_connections:
file_store_item = (
analysis_node_connection.node.get_file_store_item()
)
self.assertEqual(
analysis_node_connection.direction,
INPUT_CONNECTION
)
self.assertEqual(
analysis_node_connection.filename,
WorkflowTool.INPUT_DATASET_COLLECTION
)
self.assertEqual(analysis_node_connection.step, 0)
self.assertEqual(
analysis_node_connection.name,
file_store_item.datafile.name
)

def test_galaxy_parameter_dict_creation(self):
self.create_valid_tool(
Expand Down

0 comments on commit 624a691

Please sign in to comment.