about summary refs log tree commit diff
path: root/wqflask
diff options
context:
space:
mode:
authorLei Yan2014-02-14 14:55:27 -0600
committerLei Yan2014-02-14 14:55:27 -0600
commit663a2c70b084a6eb2e30291048546beaf9002ebf (patch)
tree291c8e605201f3d90a04482705a519736b7a935e /wqflask
parent12313b598bcc5478d365948f63f169162e41568d (diff)
downloadgenenetwork2-663a2c70b084a6eb2e30291048546beaf9002ebf.tar.gz
On branch master
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/maintenance/dataset/phenotypes.py35
1 files changed, 26 insertions, 9 deletions
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))