log("AUTO-FIX","CASE 1 - GOOD REPEATED ANNOTATION THAT CAN BE DELETED - AT SAMPLE: "+sample.getSampleIdentifier()+" FOR ANNOTATION: "+annotatedSampleIdentifier+" FOUND ORIGINAL AT: "+foundAncestor.getSampleIdentifier())
else:
#log("MANUAL-FIX", "CASE 3 - THE ANNOTATION: " + annotatedSampleIdentifier + " IS DIFFERENT AT SAMPLE: " + sample.getSampleIdentifier() + " AND ORIGINAL ANCESTOR:" + foundAncestor.getSampleIdentifier())
logManualFix("Case 3 - The annotation is different on the sample and his ancestor.",sample.getSample().getRegistrator().getUserId(),sample.getSampleIdentifier(),annotatedSampleIdentifier,foundAncestor.getSample().getRegistrator().getUserId(),foundAncestor.getSampleIdentifier())
newAnnotationsReady=False
eliffoundAncestorisNone:
logManualFix("Case 1 - The annotated sample is not an ancestor, is missing on the hierarchy for some reason.",sample.getSample().getRegistrator().getUserId(),sample.getSampleIdentifier(),annotatedSampleIdentifier,"?","?")
#log("MANUAL-FIX", "CASE 1 - THE ANNOTATED SAMPLE IS NOT AN ANCESTOR - FOR SAMPLE: " + sample.getSampleIdentifier() + " ANNOTATION WITH MISSING ANCESTOR:" + annotatedSampleIdentifier)
newAnnotationsReady=False
eliffoundAnnotationisNone:
logManualFix("Case 2 - The annotated sample is not annotated on the appropriate ancestor.",sample.getSample().getRegistrator().getUserId(),sample.getSampleIdentifier(),annotatedSampleIdentifier,foundAncestor.getSample().getRegistrator().getUserId(),foundAncestor.getSampleIdentifier())
#log("MANUAL-FIX", "CASE 2 - THE ANNOTATED SAMPLE IS NOT ANNOTATED WHERE IT SHOULD - FOR SAMPLE: " + sample.getSampleIdentifier() + " ANNOTATION: " + annotatedSampleIdentifier +" NOT AT " + foundAncestor.getSampleIdentifier())
newAnnotationsReady=False
exceptException,err:
log("ERROR","PROCESSING ANNOTATIONS XML CHILD "+sample.getSampleIdentifier()+" ERR: "+str(err))
#2.Missing Parents Annotations
forparentIdentifierinrequiredAnnotationsFound:
ifnotrequiredAnnotationsFound[parentIdentifier]:
#log("MANUAL-FIX", "CASE 4 - MISSING ANNOTATIONS ON SAMPLE: " + sample.getSampleIdentifier() + " FOR PARENT:" + parentIdentifier)
logManualFix("Case 4 - Missing annotation on sample for parent.",sample.getSample().getRegistrator().getUserId(),sample.getSampleIdentifier(),parentIdentifier,"-","-")
log("AUTO-FIX-2","CASE 2 - MISSING LOST ANNOTATIONS ON SAMPLE: "+sample.getSampleIdentifier()+" FOR LOST ANNOTATION: "+parentAnnotationIdentifier+" PRESENT INTO ONE OF THE PARENTS")
logManualFix("Case 5 - Missing Parents present in Contained: ",sample.getSample().getRegistrator().getUserId(),sample.getSampleIdentifier(),str(lostParents),"?","?")
newAnnotationsReady=False
#5 Check repeated parents in annotations
ifareAnnotationDuplicated(sample):
logManualFix("Case 6 - Same annotation coming from different parents: ",sample.getSample().getRegistrator().getUserId(),sample.getSampleIdentifier(),"?","?","?")
newAnnotationsReady=False
ifnewAnnotationsReady:
globalnumberOfCanBeUpdated;
numberOfCanBeUpdated=numberOfCanBeUpdated+1;
#1. Create new annotations XML
#2. Add LOST parents
defareAnnotationDuplicated(sample):
annotated={};#They should be parents of the sample and not been missing