示例#1
0
    def importMarkerFinderHits(fn):
        genes = {}
        ICGS_State_ranked = {}
        skip = True
        for line in open(fn, 'rU').xreadlines():
            data = clustering.cleanUpLine(line)
            if skip: skip = False
            else:
                try:
                    gene, symbol, rho, ICGS_State = string.split(data, '\t')
                except Exception:
                    gene, symbol, rho, rho_p, ICGS_State = string.split(
                        data, '\t')
                #if ICGS_State!=state and float(rho)>0.0:
                if float(rho) > 0.15:
                    try:
                        ICGS_State_ranked[ICGS_State].append(
                            [float(rho), gene, symbol])
                    except Exception:
                        ICGS_State_ranked[ICGS_State] = [[
                            float(rho), gene, symbol
                        ]]

        for ICGS_State in ICGS_State_ranked:
            ICGS_State_ranked[ICGS_State].sort()
            ICGS_State_ranked[ICGS_State].reverse()
            #print ICGS_State, ICGS_State_ranked[ICGS_State][:50]
            for (rho, gene, symbol) in ICGS_State_ranked[ICGS_State][:50]:
                genes[
                    gene] = rho, ICGS_State  ### Retain all population specific genes (lax)
                genes[symbol] = rho, ICGS_State
        return genes
示例#2
0
 def importGeneLists(fn):
     genes = {}
     for line in open(fn, 'rU').xreadlines():
         data = clustering.cleanUpLine(line)
         gene, cluster = string.split(data, '\t')[0:2]
         genes[gene] = cluster
     return genes