def read_genotype_file(self): '''Read genotype from .geno file instead of database''' #genotype_1 is Dataset Object without parents and f1 #genotype_2 is Dataset Object with parents and f1 (not for intercross) genotype_1 = reaper.Dataset() # reaper barfs on unicode filenames, so here we ensure it's a string if self.genofile: full_filename = str(locate(self.genofile, 'genotype')) else: full_filename = str(locate(self.name + '.geno', 'genotype')) genotype_1.read(full_filename) if genotype_1.type == "group" and self.parlist: genotype_2 = genotype_1.add(Mat=self.parlist[0], Pat=self.parlist[1]) #, F1=_f1) else: genotype_2 = genotype_1 #determine default genotype object if self.incparentsf1 and genotype_1.type != "intercross": genotype = genotype_2 else: self.incparentsf1 = 0 genotype = genotype_1 self.samplelist = list(genotype.prgy) return genotype
def readGenotype(self): '''read genotype from .geno file''' if self.group == 'BXD300': self.group = 'BXD' assert self.group, "self.group needs to be set" #genotype_1 is Dataset Object without parents and f1 #genotype_2 is Dataset Object with parents and f1 (not for intercross) self.genotype_1 = reaper.Dataset() full_filename = os.path.join(webqtlConfig.GENODIR, self.group + '.geno') # reaper barfs on unicode filenames, so here we ensure it's a string full_filename = str(full_filename) self.genotype_1.read(full_filename) print("Got to after read") try: # NL, 07/27/2010. ParInfo has been moved from webqtlForm.py to webqtlUtil.py; _f1, _f12, _mat, _pat = webqtlUtil.ParInfo[self.group] except KeyError: _f1 = _f12 = _mat = _pat = None self.genotype_2 = self.genotype_1 if self.genotype_1.type == "group" and _mat and _pat: self.genotype_2 = self.genotype_1.add(Mat=_mat, Pat=_pat) #, F1=_f1) #determine default genotype object if self.incparentsf1 and self.genotype_1.type != "intercross": self.genotype = self.genotype_2 else: self.incparentsf1 = 0 self.genotype = self.genotype_1 self.samplelist = list(self.genotype.prgy) self.f1list = [] self.parlist = [] if _f1 and _f12: self.f1list = [_f1, _f12] if _mat and _pat: self.parlist = [_mat, _pat]
def read_genotype_file(self, use_reaper=False): '''Read genotype from .geno file instead of database''' #genotype_1 is Dataset Object without parents and f1 #genotype_2 is Dataset Object with parents and f1 (not for intercross) #genotype_1 = reaper.Dataset() # reaper barfs on unicode filenames, so here we ensure it's a string if self.genofile: if "RData" in self.genofile: #ZS: This is a temporary fix; I need to change the way the JSON files that point to multiple genotype files are structured to point to other file types like RData full_filename = str( locate(self.genofile.split(".")[0] + ".geno", 'genotype')) else: full_filename = str(locate(self.genofile, 'genotype')) else: full_filename = str(locate(self.name + '.geno', 'genotype')) if use_reaper: genotype_1 = reaper.Dataset() genotype_1.read(full_filename) else: genotype_1 = gen_geno_ob.genotype(full_filename) if genotype_1.type == "group" and self.parlist: genotype_2 = genotype_1.add(Mat=self.parlist[0], Pat=self.parlist[1]) #, F1=_f1) else: genotype_2 = genotype_1 #determine default genotype object if self.incparentsf1 and genotype_1.type != "intercross": genotype = genotype_2 else: self.incparentsf1 = 0 genotype = genotype_1 self.samplelist = list(genotype.prgy) return genotype
####### To run this program do: python QTL_Reaper_v2.py 235 #Where 163 is the ProbeSetFreeze Id of the database that we want to calculate #the LRS #!/usr/bin/python import sys import os import reaper import MySQLdb import time con = MySQLdb.Connect(db='db_webqtl', user='******', passwd='', host="localhost") cursor = con.cursor() genotypeDir = '/gnshare/gn/web/genotypes/' genotype_1 = reaper.Dataset() #####get all of the genotypes cursor.execute('select Id, Name from InbredSet') results = cursor.fetchall() InbredSets = {} for item in results: InbredSets[item[0]] = genotypeDir+str(item[1])+'.geno' ProbeSetFreezeIds=sys.argv[1:] if ProbeSetFreezeIds: #####convert the Ids to integer ProbeSetFreezeIds=list(map(int, ProbeSetFreezeIds)) else: #####get all of the dataset that need be updated cursor.execute('select distinct(ProbeSetFreezeId) from ProbeSetXRef where pValue is NULL order by ProbeSetFreezeId desc') results = cursor.fetchall()