Skip to content

Commit

Permalink
fixing outstanding roundtrip issues object , documenting in notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
proccaserra committed Feb 8, 2024
1 parent 2bf8347 commit a9a75ea
Show file tree
Hide file tree
Showing 8 changed files with 2,096 additions and 284 deletions.
2,347 changes: 2,078 additions & 269 deletions isa-cookbook/content/notebooks/isa-api-programmatic-BH2023-multiomics-isa.ipynb

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions isatools/isatab/dump/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ def flatten(current_list):
protocol_types_dict
)
if oname_label is not None:
print("FROM TAB DUMPER: ",oname_label)
columns.append(oname_label)
elif node.executes_protocol.protocol_type.term.lower() \
in protocol_types_dict["nucleic acid hybridization"][SYNONYMS]:
Expand Down Expand Up @@ -375,7 +374,7 @@ def pbar(x):
)
if oname_label is not None:
df_dict[oname_label][-1] = node.name
print("N from ISA-tab dump write", node.name)

elif node.executes_protocol.protocol_type.term.lower() in \
protocol_types_dict["nucleic acid hybridization"][SYNONYMS]:
df_dict["Hybridization Assay Name"][-1] = \
Expand Down
7 changes: 3 additions & 4 deletions isatools/isatab/load/ProcessSequenceFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,13 @@ def get_node_by_label_and_key(labl, this_key):
protocol_ref = str(object_series[object_label])
process_key = process_keygen(protocol_ref, column_group, _cg, DF.columns, object_series, _, DF)

# TODO: Keep process key sequence here to reduce number of
# passes on Protocol REF columns?
# TODO: Keep process key sequence here to reduce number of passes on Protocol REF columns?

try:
process = processes[process_key]
except KeyError:
process = Process(executes_protocol=protocol_ref)
# TODO: Fix name formatting using protocol type or pattern
process = Process(executes_protocol=protocol_ref, name="TOTO-{}-".format(_) + protocol_ref)
processes.update(dict([(process_key, process)]))

output_node_index = find_gt(node_cols, object_label_index)
Expand Down Expand Up @@ -336,7 +336,6 @@ def get_node_by_label_and_key(labl, this_key):
name_column_hits = [n for n in column_group if n in _LABELS_ASSAY_NODES]
if len(name_column_hits) == 1:
process.name = str(object_series[name_column_hits[0]])
# print("process name at load:", process.name, name_column_hits[0])
for pv_column in [c for c in column_group if c.startswith('Parameter Value[')]:
category_key = next(iter(_RX_PARAMETER_VALUE.findall(pv_column)))
if category_key not in [x.category.parameter_name.term for x in process.parameter_values]:
Expand Down
11 changes: 8 additions & 3 deletions isatools/model/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def __init__(self, id_='', name=None, executes_protocol=None, date_=None,
Identifiable.__init__(self)

self.id = id_
self.name = ""
self.name = ''
if name:
self.name = name
self.__name = name

if executes_protocol is None:
self.__executes_protocol = Protocol()
Expand Down Expand Up @@ -308,7 +308,12 @@ def from_assay_dict(self, process, technology_type):
self.executes_protocol = indexes.get_protocol(process['executesProtocol']['@id'])
self.load_comments(process.get('comments', []))
allowed_protocol_type_terms = [
"nucleic acid sequencing", "nucleic acid hybridization", "data transformation", "data normalization"
"nucleic acid sequencing",
"nmr spectroscopy",
"mass spectrometry",
"nucleic acid hybridization",
"data transformation",
"data normalization"
]
if self.executes_protocol.protocol_type.term in allowed_protocol_type_terms or (
self.executes_protocol.protocol_type.term == 'data collection'
Expand Down
2 changes: 1 addition & 1 deletion isatools/net/mw2isa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ def create_nmr_assay_records(lol, study_id, analysis_id, fv_records):
"Parameter Value[binned increment]",
"Parameter Value[binned data exclusion range ]",
"NMR Assay Name",
"Free Induction Data File",
"Free Induction Decay Data File",
"Protocol REF",
"Parameter Value[software]",
"Data Transformation Name",
Expand Down
4 changes: 2 additions & 2 deletions isatools/resources/config/json/default/isotopomer_nmr.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"protocols": [
{
"inputs": "#sample",
"protocol": "extraction",
"protocol": "metabolite extraction",
"outputs": "#material"
},
{
Expand All @@ -24,5 +24,5 @@
"data transformation"
],
"description": [
"(Sample)->(extraction)->(Material)->(NMR spectroscopy)->(FreeInductionDecayFiles)->(data transformation)->(DerivedSpectralDataFiles)" ]
"(Sample)->(extraction)->(Material)->(NMR spectroscopy)->(DataFiles)->(data transformation)->(DataFiles)" ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"protocols": [
{
"inputs": "#sample",
"protocol": "extraction",
"protocol": "metabolite extraction",
"outputs": "#material"
},
{
Expand All @@ -24,5 +24,5 @@
"data transformation"
],
"description": [
"(Sample)->(extraction)->(Material)->(NMR spectroscopy)->(FreeInductionDecayFiles)->(data transformation)->(DerivedSpectralDataFiles)" ]
"(Sample)->(extraction)->(Material)->(NMR spectroscopy)->(Files)->(data transformation)->(DataFiles)" ]
}
2 changes: 1 addition & 1 deletion isatools/resources/config/yaml/assay-options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
- Derived Spectral Data File
- Metabolite Assignment File
-
measurement type: isotopomer distribution analysis
measurement type: isotopomer analysis
technology type: NMR spectroscopy
protocol type: NMR spectroscopy
parameter-like file:
Expand Down

0 comments on commit a9a75ea

Please sign in to comment.