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"] = {
"ENZYMES" : {"NAME" : False }
};
configuration["POMBE"] = {
"PLASMIDS" : {"RELATIONSHIP" : False, "ANNOTATION" : False }
};
#Global Variables
annotableType = "<REPLACE_WITH_ANNOTABLE_TYPE>"
server = CommonServiceProvider.getCommonServer()
......
......@@ -55,6 +55,13 @@ definitions = {
"ENZYMES" : {
"name" : "NAME"
}
},
"POMBE" :
{
"PLASMIDS" : {
"rel" : "RELATIONSHIP",
"annotation" : "ANNOTATION"
}
}
};
......@@ -101,22 +108,25 @@ def translate(tr, sample, properties):
if '<root>' in propertyValue:
oldAnnotationsRoot = ET.fromstring(propertyValue)
except Exception:
print "Exception on " + sample.code + " " + property
print "[ERROR - PROCESSING PROPERTY_CODE] " + sample.code + " " + property
if oldAnnotationsRoot is not None:
for child in oldAnnotationsRoot:
newAnnotationsNode = ET.SubElement(newAnnotationsRoot, "Sample")
permId = child.attrib["permId"]
print sample.code + " " + permId
newAnnotationsNode.attrib["permId"] = permId
linkedSample = getSampleByPermId(tr, permId)
newAnnotationsNode.attrib["identifier"] = linkedSample.getSampleIdentifier()
for oldName in propertyDefinitions:
newName = propertyDefinitions[oldName]
value = getValueOrNull(child.attrib, oldName)
if(value is not None):
newAnnotationsNode.attrib[newName] = value
try:
newAnnotationsNode = ET.SubElement(newAnnotationsRoot, "Sample")
permId = child.attrib["permId"]
print "[INFO - PROCESSING PERM_ID] " + sample.code + " " + permId
newAnnotationsNode.attrib["permId"] = permId
linkedSample = getSampleByPermId(tr, permId)
newAnnotationsNode.attrib["identifier"] = linkedSample.getSampleIdentifier()
for oldName in propertyDefinitions:
newName = propertyDefinitions[oldName]
value = getValueOrNull(child.attrib, oldName)
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'))
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