Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR on dev #504

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The *ISA API* aims to provide you, the developer, with a set of tools to help y
----
### Read the Publication...

Read our **open access [publication](https://doi.org/10.1093/gigascience/giab060) "SA API: An open platform for interoperable life science experimental metadata", published in GigaScience** as a `technical note`
Read our **open access [publication](https://doi.org/10.1093/gigascience/giab060) "ISA API: An open platform for interoperable life science experimental metadata", published in GigaScience** as a `technical note`

*David Johnson, Dominique Batista, Keeva Cochrane, Robert P. Davey, Anthony Etuk, Alejandra Gonzalez-Beltran, Kenneth Haug, Massimiliano Izzo, Martin Larralde, Thomas N. Lawson, Alice Minotto, Pablo Moreno, Venkata Chandrasekhar Nainala, Claire O'Donovan, Luca Pireddu, Pierrick Roger, Felix Shaw, Christoph Steinbeck, Ralf J. M. Weber, Susanna-Assunta Sansone, Philippe Rocca-Serra.
ISA API: An open platform for interoperable life science experimental metadata. 2020.11.13.382119; doi:
Expand Down
24 changes: 15 additions & 9 deletions isatools/isatab/dump/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ def flatten(current_list):
log.warning(s_graph.nodes())

sample_in_path_count = 0
protocol_in_path_count = 0
longest_path = _longest_path_and_attrs(paths, s_graph.indexes)

for node_index in longest_path:
node = s_graph.indexes[node_index]
if isinstance(node, Source):
Expand All @@ -76,8 +77,9 @@ def flatten(current_list):
map(lambda x: get_comment_column(
olabel, x), node.comments))
elif isinstance(node, Process):
olabel = "Protocol REF.{}".format(node.executes_protocol.name)
olabel = "Protocol REF.{}".format(protocol_in_path_count)
columns.append(olabel)
protocol_in_path_count += 1
if node.executes_protocol.name not in protnames.keys():
protnames[node.executes_protocol.name] = protrefcount
protrefcount += 1
Expand All @@ -104,6 +106,7 @@ def flatten(current_list):
columns += flatten(map(lambda x: get_fv_columns(olabel, x),
node.factor_values))


omap = get_object_column_map(columns, columns)
# load into dictionary
df_dict = dict(map(lambda k: (k, []), flatten(omap)))
Expand All @@ -113,6 +116,7 @@ def flatten(current_list):
df_dict[k].extend([""])

sample_in_path_count = 0
protocol_in_path_count = 0
for node_index in path_:
node = s_graph.indexes[node_index]
if isinstance(node, Source):
Expand All @@ -129,8 +133,8 @@ def flatten(current_list):
df_dict[colabel][-1] = co.value

elif isinstance(node, Process):
olabel = "Protocol REF.{}".format(
node.executes_protocol.name)
olabel = "Protocol REF.{}".format(protocol_in_path_count)
protocol_in_path_count += 1
df_dict[olabel][-1] = node.executes_protocol.name
for pv in node.parameter_values:
pvlabel = "{0}.Parameter Value[{1}]".format(
Expand Down Expand Up @@ -263,6 +267,8 @@ def flatten(current_list):
if _longest_path_and_attrs(paths, a_graph.indexes) is None:
raise IOError(
"Could not find any valid end-to-end paths in assay graph")

protocol_in_path_count = 0
for node_index in _longest_path_and_attrs(paths, a_graph.indexes):
node = a_graph.indexes[node_index]
if isinstance(node, Sample):
Expand All @@ -279,9 +285,9 @@ def flatten(current_list):
node.factor_values))

elif isinstance(node, Process):
olabel = "Protocol REF.{}".format(
node.executes_protocol.name)
olabel = "Protocol REF.{}".format(protocol_in_path_count)
columns.append(olabel)
protocol_in_path_count += 1
if node.executes_protocol.name not in protnames.keys():
protnames[node.executes_protocol.name] = protrefcount
protrefcount += 1
Expand Down Expand Up @@ -338,12 +344,12 @@ def pbar(x):
for k in df_dict.keys(): # add a row per path
df_dict[k].extend([""])

protocol_in_path_count = 0
for node_index in path_:
node = a_graph.indexes[node_index]
if isinstance(node, Process):
olabel = "Protocol REF.{}".format(
node.executes_protocol.name
)
olabel = "Protocol REF.{}".format(protocol_in_path_count)
protocol_in_path_count += 1
df_dict[olabel][-1] = node.executes_protocol.name
if node.executes_protocol.protocol_type:
oname_label = get_column_header(
Expand Down
Loading