aboutsummaryrefslogtreecommitdiff
path: root/web/webqtl/maintainance/addRif.py
diff options
context:
space:
mode:
authorzsloan2015-03-27 20:28:51 +0000
committerzsloan2015-03-27 20:28:51 +0000
commitd0911a04958a04042da02a334ccc528dae79cc17 (patch)
tree3c48e2e937c1dbeaf00a5697c87ed251afa5c8f1 /web/webqtl/maintainance/addRif.py
parenta840ad18e1fe3db98a359a159e9b9b72367a2839 (diff)
downloadgenenetwork2-d0911a04958a04042da02a334ccc528dae79cc17.tar.gz
Removed everything from 'web' directory except genofiles and renamed the directory to 'genotype_files'
Diffstat (limited to 'web/webqtl/maintainance/addRif.py')
-rwxr-xr-xweb/webqtl/maintainance/addRif.py107
1 files changed, 0 insertions, 107 deletions
diff --git a/web/webqtl/maintainance/addRif.py b/web/webqtl/maintainance/addRif.py
deleted file mode 100755
index c7cdde7a..00000000
--- a/web/webqtl/maintainance/addRif.py
+++ /dev/null
@@ -1,107 +0,0 @@
-# Copyright (C) University of Tennessee Health Science Center, Memphis, TN.
-#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Affero General Public License
-# as published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU Affero General Public License for more details.
-#
-# This program is available from Source Forge: at GeneNetwork Project
-# (sourceforge.net/projects/genenetwork/).
-#
-# Contact Drs. Robert W. Williams and Xiaodong Zhou (2010)
-# at rwilliams@uthsc.edu and xzhou15@uthsc.edu
-#
-#
-#
-# This module is used by GeneNetwork project (www.genenetwork.org)
-#
-# Created by GeneNetwork Core Team 2010/08/10
-#
-# Last updated by Lei Yan 2011/02/08
-
-# created by Lei Yan 02/08/2011
-
-import string
-import MySQLdb
-import time
-import os
-import sys
-
-path1 = os.path.abspath(os.path.dirname(__file__))
-path2 = path1 + "/.."
-path3 = path1 + "/../../tmp"
-sys.path.insert(0, path2)
-from base import webqtlConfig
-
-try:
- con = MySQLdb.Connect(db=webqtlConfig.DB_NAME,host=webqtlConfig.MYSQL_SERVER, user=webqtlConfig.DB_USER,passwd=webqtlConfig.DB_PASSWD)
- cursor = con.cursor()
- print "You have successfully connected to mysql.\n"
-except:
- print "You entered incorrect password.\n"
- sys.exit(0)
-
-taxIds = {'10090':1, '9606':4, '10116':2, '3702':3}
-taxIdKeys = taxIds.keys()
-
-os.chdir(path3)
-cdict = {}
-
-os.system("rm -f gene_info")
-os.system("wget ftp://ftp.ncbi.nlm.nih.gov/gene/DATA/gene_info.gz")
-os.system("gunzip gene_info.gz")
-try:
- fp = open("gene_info")
-except:
- print "gene_info doesn't exit"
- sys.exit(1)
-
-i=0
-line = fp.readline()
-while line:
- line2 = map(string.strip, string.split(line.strip(), "\t"))
- if line2[0] in taxIdKeys:
- cdict[line2[1]] = line2[2]
- line = fp.readline()
- i += 1
- if i%1000 == 0:
- print "finished ", i
-fp.close()
-
-os.system("rm -f generifs_basic")
-os.system("wget ftp://ftp.ncbi.nlm.nih.gov/gene/GeneRIF/generifs_basic.gz")
-os.system("gunzip generifs_basic.gz")
-try:
- fp = open("generifs_basic")
-except:
- print "generifs_basic doesn't exist"
- sys.exit(1)
-
-cursor.execute("delete from GeneRIF_BASIC")
-count = 0
-line = fp.readline()
-while line:
- line2 = map(string.strip, string.split(line.strip(), "\t"))
- if line2[0] in taxIdKeys:
- count += 1
- line2[0] = taxIds[line2[0]]
- if len(line2) !=5:
- print line
- else:
- try:
- symbol=cdict[line2[1]]
- except:
- symbol= ""
-
- line2 = line2[:2] + [symbol] + line2[2:]
- cursor.execute("insert into GeneRIF_BASIC(SpeciesId, GeneId, Symbol, PubMed_ID, createtime, comment) values(%s, %s, %s, %s, %s, %s)", tuple(line2))
- line = fp.readline()
-
-fp.close()
-print count, "\n"
-cursor.close()