From 663a2c70b084a6eb2e30291048546beaf9002ebf Mon Sep 17 00:00:00 2001 From: Lei Yan Date: Fri, 14 Feb 2014 14:55:27 -0600 Subject: On branch master --- wqflask/maintenance/dataset/phenotypes.py | 35 +++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'wqflask/maintenance') diff --git a/wqflask/maintenance/dataset/phenotypes.py b/wqflask/maintenance/dataset/phenotypes.py index 1f58d9a8..ed30f33f 100644 --- a/wqflask/maintenance/dataset/phenotypes.py +++ b/wqflask/maintenance/dataset/phenotypes.py @@ -1,7 +1,3 @@ -# Author: Lei Yan - -# import - import utilities def fetch(): @@ -76,8 +72,29 @@ def fetch(): phenotypesfile.flush() # release phenotypesfile.close() - -# main -if __name__ == "__main__": - fetch() - print "exit successfully" + +def delete(publishxrefid, inbredsetid): + cursor = utilities.get_cursor() + sql = """ + DELETE Phenotype + FROM PublishXRef,Phenotype + WHERE PublishXRef.`Id`=%s + AND PublishXRef.`InbredSetId`=%s + AND PublishXRef.`PhenotypeId`=Phenotype.`Id` + """ + cursor.execute(sql, (publishxrefid, inbredsetid)) + sql = """ + DELETE PublishData + FROM PublishXRef,PublishData + WHERE PublishXRef.`Id`=%s + AND PublishXRef.`InbredSetId`=%s + AND PublishXRef.`DataId`=PublishData.`Id` + """ + cursor.execute(sql, (publishxrefid, inbredsetid)) + sql = """ + DELETE PublishXRef + FROM PublishXRef + WHERE PublishXRef.`Id`=%s + AND PublishXRef.`InbredSetId`=%s + """ + cursor.execute(sql, (publishxrefid, inbredsetid)) -- cgit v1.2.3