def posh(x): h=collections.defaultdict(lambda:collections.defaultdict(lambda:0.0)) for l in open(x,"r"): if l.rstrip()=="": continue p=PopIO.parse_cmhline(l) h[p.chr][p.pos]=p.pvalue return h
def posh(x): h = collections.defaultdict(lambda: collections.defaultdict(lambda: 0.0)) for l in open(x, "r"): if l.rstrip() == "": continue p = PopIO.parse_cmhline(l) h[p.chr][p.pos] = p.pvalue return h
def read_candidatehash(cls,filename,maxrange): chrh=collections.defaultdict(lambda:collections.defaultdict(lambda:[])) candl=[] for line in open(filename,"r"): p=PopIO.parse_cmhline(line) chr=p.chr pos=p.pos rangestart=pos-maxrange rangend=pos+maxrange-1 cand=CandidateSNP(p.chr,p.pos,rangestart,rangend,p.pvalue) candl.append(cand) for i in range(rangestart,rangend+1): chrh[chr][i].append(cand) return chrh,candl
def read_candidatehash(cls, filename, maxrange): chrh = collections.defaultdict(lambda: collections.defaultdict(lambda: [])) candl = [] for line in open(filename, "r"): p = PopIO.parse_cmhline(line) chr = p.chr pos = p.pos rangestart = pos - maxrange rangend = pos + maxrange - 1 cand = CandidateSNP(p.chr, p.pos, rangestart, rangend, p.pvalue) candl.append(cand) for i in range(rangestart, rangend + 1): chrh[chr][i].append(cand) return chrh, candl