aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorroot2014-02-19 16:17:38 -0600
committerroot2014-02-19 16:17:38 -0600
commit685cb9e8ffd23ec9c0943299fa9a2caa98a3852e (patch)
treea5db32691b000472b31223405773926bf735d307 /wqflask
parente1165a5d29bc435afd31f6a78061ea80203e9552 (diff)
downloadgenenetwork2-685cb9e8ffd23ec9c0943299fa9a2caa98a3852e.tar.gz
Committer: root <root@alexandria.uthsc.edu>
On branch master
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/maintenance/dataset/load_phenotypes.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/wqflask/maintenance/dataset/load_phenotypes.py b/wqflask/maintenance/dataset/load_phenotypes.py
index c47453b7..98c22229 100644
--- a/wqflask/maintenance/dataset/load_phenotypes.py
+++ b/wqflask/maintenance/dataset/load_phenotypes.py
@@ -59,6 +59,48 @@ def main(argv):
rowcount = cursor.rowcount
phenotypeid = con.insert_id()
print "INSERT INTO Phenotype: %d record: %d" % (rowcount, phenotypeid)
+ # Publication
+ publicationid = None # reset
+ pubmed_id = utilities.to_db_string_null(metarow[0])
+ if pubmed_id:
+ sql = """
+ SELECT Publication.`Id`
+ FROM Publication
+ WHERE Publication.`PubMed_ID`=%s
+ """
+ cursor.execute(sql, (pubmed_id))
+ re = cursor.fetchone()
+ if re:
+ publicationid = re[0]
+ print "get Publication record: %d" % publicationid
+ if not publicationid:
+ sql = """
+ INSERT INTO Publication
+ SET
+ Publication.`PubMed_ID`=%s,
+ Publication.`Abstract`=%s,
+ Publication.`Authors`=%s,
+ Publication.`Title`=%s,
+ Publication.`Journal`=%s,
+ Publication.`Volume`=%s,
+ Publication.`Pages`=%s,
+ Publication.`Month`=%s,
+ Publication.`Year`=%s
+ """
+ cursor.execute(sql, (
+ utilities.to_db_string_null(metarow[0]),
+ utilities.to_db_string_null(metarow[12]),
+ utilities.to_db_string_null(metarow[10]),
+ utilities.to_db_string_null(metarow[11]),
+ utilities.to_db_string_null(metarow[13]),
+ utilities.to_db_string_null(metarow[14]),
+ utilities.to_db_string_null(metarow[15]),
+ utilities.to_db_string_null(metarow[16]),
+ utilities.to_db_string_null(metarow[17]),
+ ))
+ rowcount = cursor.rowcount
+ publicationid = con.insert_id()
+ print "INSERT INTO Publication: %d record: %d" % (rowcount, publicationid)
if __name__ == "__main__":
print "command line arguments:\n\t%s" % sys.argv