Skip to content
Snippets Groups Projects
Commit efceb4b8 authored by juanf's avatar juanf
Browse files

SSDM-1070 : PAPER - OPENBIS - Migrate Manage Properties YeastLab (Configurable)

SVN: 33392
parent 3126c9ec
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,10 @@ configuration["PCR"] = { ...@@ -26,6 +26,10 @@ configuration["PCR"] = {
"ENZYMES" : {"NAME" : False } "ENZYMES" : {"NAME" : False }
}; };
configuration["POMBE"] = {
"PLASMIDS" : {"RELATIONSHIP" : False, "ANNOTATION" : False }
};
#Global Variables #Global Variables
annotableType = "<REPLACE_WITH_ANNOTABLE_TYPE>" annotableType = "<REPLACE_WITH_ANNOTABLE_TYPE>"
server = CommonServiceProvider.getCommonServer() server = CommonServiceProvider.getCommonServer()
......
...@@ -55,6 +55,13 @@ definitions = { ...@@ -55,6 +55,13 @@ definitions = {
"ENZYMES" : { "ENZYMES" : {
"name" : "NAME" "name" : "NAME"
} }
},
"POMBE" :
{
"PLASMIDS" : {
"rel" : "RELATIONSHIP",
"annotation" : "ANNOTATION"
}
} }
}; };
...@@ -101,22 +108,25 @@ def translate(tr, sample, properties): ...@@ -101,22 +108,25 @@ def translate(tr, sample, properties):
if '<root>' in propertyValue: if '<root>' in propertyValue:
oldAnnotationsRoot = ET.fromstring(propertyValue) oldAnnotationsRoot = ET.fromstring(propertyValue)
except Exception: except Exception:
print "Exception on " + sample.code + " " + property print "[ERROR - PROCESSING PROPERTY_CODE] " + sample.code + " " + property
if oldAnnotationsRoot is not None: if oldAnnotationsRoot is not None:
for child in oldAnnotationsRoot: for child in oldAnnotationsRoot:
newAnnotationsNode = ET.SubElement(newAnnotationsRoot, "Sample") try:
permId = child.attrib["permId"] newAnnotationsNode = ET.SubElement(newAnnotationsRoot, "Sample")
print sample.code + " " + permId permId = child.attrib["permId"]
newAnnotationsNode.attrib["permId"] = permId print "[INFO - PROCESSING PERM_ID] " + sample.code + " " + permId
linkedSample = getSampleByPermId(tr, permId) newAnnotationsNode.attrib["permId"] = permId
newAnnotationsNode.attrib["identifier"] = linkedSample.getSampleIdentifier() linkedSample = getSampleByPermId(tr, permId)
newAnnotationsNode.attrib["identifier"] = linkedSample.getSampleIdentifier()
for oldName in propertyDefinitions:
newName = propertyDefinitions[oldName] for oldName in propertyDefinitions:
value = getValueOrNull(child.attrib, oldName) newName = propertyDefinitions[oldName]
if(value is not None): value = getValueOrNull(child.attrib, oldName)
newAnnotationsNode.attrib[newName] = value if(value is not None):
newAnnotationsNode.attrib[newName] = value
except Exception:
print "[ERROR - PROCESSING PERM_ID] " + sample.code + " " + permId
save(tr, sample, "ANNOTATIONS_STATE", ET.tostring(newAnnotationsRoot, encoding='utf-8')) save(tr, sample, "ANNOTATIONS_STATE", ET.tostring(newAnnotationsRoot, encoding='utf-8'))
def save(tr, sample, property, propertyValue): def save(tr, sample, property, propertyValue):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment