Skip to content

Commit

Permalink
Merge pull request #58 from elixir-europe/dev
Browse files Browse the repository at this point in the history
MIAPPE compliance improvements
  • Loading branch information
bedroesb authored Oct 15, 2019
2 parents 2ffb326 + 9c6e4ea commit 1108e60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion brapi_to_isa.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def create_study_sample_and_assay(client, brapi_study_id, isa_study, growth_pro

phenotyping_process = Process(executes_protocol=phenotyping_protocol)
phenotyping_process.inputs.append(this_isa_sample)
phenotyping_process.name = obs_unit["observationUnitDbId"]
phenotyping_process.name = att_test(obs_unit, 'observationLevel', PAR_defaultObsLvl).lower()

# Adding Parameter Value[Collection Date] column
# col_date_pp = ProtocolParameter(parameter_name=OntologyAnnotation(term="Collection Date"))
Expand Down
21 changes: 6 additions & 15 deletions brapi_to_isa_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def create_isa_study(self, brapi_study_id, investigation, obs_levels_in_study):
affiliation=att_test(brapicontact, 'institutionName', PAR_NAinData), email=att_test(brapicontact, 'email'), address=PAR_NAinBrAPI, roles=[role])
this_study.contacts.append(contact)

# Adding dataLinks inforamtion
# Adding dataLinks information
if att_test(brapi_study,'dataLinks'):
for brapidata in brapi_study['dataLinks']:
this_study.comments.append(Comment(name="Study Data File Link",value=brapidata['url']))
Expand All @@ -205,14 +205,10 @@ def create_isa_study(self, brapi_study_id, investigation, obs_levels_in_study):
self.logger.info("The observation level " + level + " is not supported by MIAPPE at this moment and will not be validated.")
self.logger.info("Following observation levels are supported: " + str(PAR_suppObsLvl) + ".")

oref_mt = OntologySource(
name="OBI", description=self.ontologies["obi"][0], file=self.ontologies["obi"][1])
oa_mt = OntologyAnnotation(
term="phenotyping", term_accession="", term_source=oref_mt)
oref_tt = OntologySource(
name="OBI", description=self.ontologies["obi"][0], file=self.ontologies["obi"][1])
term="phenotyping", term_accession="", term_source="")
oa_tt = OntologyAnnotation(
term=level + " level analysis", term_accession="", term_source=oref_tt)
term=level + " level analysis", term_accession="", term_source="")

isa_assay_file = "a_" + str(brapi_study_id) + "_" + level + ".txt"
new_assay = Assay(measurement_type=oa_mt,
Expand All @@ -221,11 +217,6 @@ def create_isa_study(self, brapi_study_id, investigation, obs_levels_in_study):

this_study.assays.append(new_assay)

if oref_mt not in investigation.ontology_source_references:
investigation.ontology_source_references.append(oref_mt)
if oref_tt not in investigation.ontology_source_references:
investigation.ontology_source_references.append(oref_tt)

self.logger.info("Number of ISA assays: " + str(len(this_study.assays)))

return this_study, investigation
Expand Down Expand Up @@ -270,9 +261,9 @@ def create_isa_tdf_from_obsvars(self, obsvars):

else:
if att_test(obs_var, 'synonyms'):
elements['Variable Name'].append('; '.join(obs_var['synonyms']) + ' (BrAPI variableDbId: ' + att_test(obs_var, 'observationVariableDbId', 'NA') + ')')
elements['Variable Name'].append('; '.join(obs_var['synonyms']) + ' (BrAPI variableDbId: ' + att_test(obs_var, 'observationVariableDbId', PAR_NAinData) + ')')
else:
elements['Variable Name'].append('(BrAPI variableDbId: ' + att_test(obs_var, 'observationVariableDbId', 'NA') + ')')
elements['Variable Name'].append('(BrAPI variableDbId: ' + att_test(obs_var, 'observationVariableDbId', PAR_NAinData) + ')')

elements['Trait'].append(att_test(obs_var['trait'], 'name'))

Expand Down Expand Up @@ -314,7 +305,7 @@ def create_isa_obs_data_from_obsvars(self, obs_units, obs_variables, level, germ
for obslvl in obs_levels[level]:
obs_levels_header.append("observationLevels[{}]".format(obslvl))
# headers belonging observation unit
obs_unit_header = ["observationUnitDbId", "observationUnitXref",
obs_unit_header = ["observationUnitName", "observationUnitXref",
"X", "Y", "germplasmDbId", "germplasmName"]
# headers belonging germplasm
germpl_header = ["accessionNumber"]
Expand Down

0 comments on commit 1108e60

Please sign in to comment.