Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
djcomlab committed Feb 15, 2017
2 parents 1cfb9a9 + 80310fd commit b3d3868
Show file tree
Hide file tree
Showing 8 changed files with 824 additions and 1,419 deletions.
2 changes: 1 addition & 1 deletion docs/creation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ one Study section structured as defined by the
`ISA-Tab Specification <http://isa-specs.readthedocs.io/en/latest/isatab.html>`_.

.. hint:: Remember that when you ``dump()`` ISA content, you do it on the ``Investigation`` object. This means any
``Study`` and ``Assay`` objects and content must be attached to the ``Investigation`` for it to be serialized out.
``Study`` and ``Assay`` objects and content must be attached to the ``Investigation`` for it to be serialized out.

Different classes in ``isatools.model.v1`` have class constructors and instance variables that roughly map to the
ISA Abstract Model. For full details of how to instantiate model classes, access and manipulate ISA data as objects,
Expand Down
80 changes: 45 additions & 35 deletions isatools/io/isatab_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,25 +227,20 @@ def __init__(self, base_file):
"Comment", "Label", "Material Type", "Factor Value"),
"node": ("Sample Name", "Source Name", "Image File",
"Raw Data File", "Derived Data File", "Acquisition Parameter Data File",
"Extract Name", "Labeled Extract Name"),
"Extract Name", "Labeled Extract Name", "Array Data File",
"Raw Spectral Data File", "Protein Assignment File", "Peptide Assignment File",
"Post Translational Modification Assignment File", "Derived Spectral Data File",
"Derived Array Data File"),
"node_assay": ("Assay Name", "Data Transformation Name",
"Normalization Name"),
"processing": "Protocol REF",
"parameter": ("Parameter Value", "Array Design REF")
}
self._synonyms = {"Array Data File": "Raw Data File",
"Free Induction Decay Data File": "Raw Data File",
"Derived Array Data File" : "Derived Data File",
self._synonyms = {
"Hybridization Assay Name": "Assay Name",
"Scan Name": "Assay Name",
"Array Data Matrix File": "Derived Data File",
"Derived Array Data Matrix File": "Derived Data File",
"Raw Spectral Data File": "Raw Data File",
"Derived Spectral Data File": "Derived Data File",
"MS Assay Name": "Assay Name",
"Protein Assignment File": "Derived Data File",
"Peptide Assignment File": "Derived Data File",
"Post Translational Modification Assignment File": "Derived Data File"}
"MS Assay Name": "Assay Name"
}

def parse(self, rec):
"""Retrieve row data from files associated with the ISATabRecord.
Expand Down Expand Up @@ -620,30 +615,45 @@ def _swap_synonyms(self, header):
def _build_node_index(self, type, name):
if type=="Source Name":
return "source-"+name
elif type == "Sample Name":
return "sample-"+name
elif type == "Extract Name":
return "extract-"+name
elif type == "Labeled Extract Name":
return "labeledextract-"+name
elif type == "Raw Data File":
return "rawdatafile-"+name
elif type=="Derived Data File":
return "deriveddatafile-"+name
elif type=="Acquisition Parameter Data File":
return "acquisitionparameterfile-"+name
elif type=="Image File":
return "imagefile-"+name
elif type == "Array Data File":
return "arraydatafile-" + name
elif type == "Array Data Matrix File":
return "arraydatamatrixfile-" + name
elif type == "Derived Array Data Matrix File":
return "derivedarraydatamatrixfile-" + name
elif type == "Raw Spectral Data File":
return "rawspectraldatafile-" + name
elif type == "Derived Array Data Matrix File":
return "derivedarraydatamatrixfile-" + name
elif type == "Protein Assignment File":
return "proteinassignmentfile-" + name
elif type == "Peptide Assignment File":
return "peptideassignmentfile-" + name
elif type == "Post Translational Modification Assignment File":
return "posttranslationalmodificationassignmentfile-" + name
elif type == "Free Induction Decay Data File":
return "freeinductiondecaydatafile-" + name
elif type == "Derived Array Data File":
return "derivedarraydatafile-" + name
elif type == "Derived Spectral Data File":
return "derivedspectraldatafile-" + name
else:
if type == "Sample Name":
return "sample-"+name
else:
if type == "Extract Name":
return "extract-"+name
else:
if type == "Labeled Extract Name":
return "labeledextract-"+name
else:
if type == "Raw Data File":
return "rawdatafile-"+name
else:
if type=="Derived Data File":
return "deriveddatafile-"+name
else:
if type=="Acquisition Parameter Data File":
return "acquisitionparameterfile-"+name
else:
if type=="Image File":
return "imagefile-"+name
else:
"ERROR - Type not being considered! ", type
return name
print("ERROR - Type not being considered! ", type)
return name


_record_str = \
Expand Down
20 changes: 2 additions & 18 deletions isatools/isajson.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,6 @@ def get_roles(j):
roles.append(role)
return roles

def _build_assay_graph(process_sequence=list()):
G = nx.DiGraph()
for process in process_sequence:
if process.next_process is not None or len(process.outputs) > 0: # first check if there"s some valid outputs to connect
if len(process.outputs) > 0:
for output in [n for n in process.outputs if not isinstance(n, DataFile)]:
G.add_edge(process, output)
else: # otherwise just connect the process to the next one
G.add_edge(process, process.next_process)
if process.prev_process is not None or len(process.inputs) > 0:
if len(process.inputs) > 0:
for input_ in process.inputs:
G.add_edge(input_, process)
else:
G.add_edge(process.prev_process, process)
return G

def get_jvalue(dict, key):
if key in dict.keys():
return dict[key]
Expand Down Expand Up @@ -1760,7 +1743,8 @@ def get_data_file(o):
{
"@id": id_gen(o),
"name": o.filename,
"type": o.label
"type": o.label,
"comments": get_comments(o.comments)
}
)

Expand Down
Loading

0 comments on commit b3d3868

Please sign in to comment.