Exemplo n.º 1
0
    params = parser.parse_args()

    M = MatLoader()
    M.load_left()
    M.load_lrmap()

    for deg in DEG:
        print('Degre: %d' % deg)
        C = M.load_consensus_graphs(deg)
        if params.mode == 'pre':
            S = M.load_consensus_chemical_synapse(deg)
        elif params.mode == 'post':
            S = M.load_consensus_chemical_post_synapse(deg)
        else:
            S = M.load_consensus_gap_junctions(deg)

        e = Matrix(cam, params.matrix)
        e.load_genes()
        e.load_cells(sorted(C.A.nodes()))
        e.assign_expression()
        e.binarize()
        D = nx.DiGraph()
        for cell in tqdm(M.left, desc='Cells'):
            if not C.C.has_node(cell): continue
            syn, neigh = predict.get_synapse_data(S[cell],
                                                  e,
                                                  cpartners=set(
                                                      C.C.neighbors(cell)))
            if not syn: continue
            gene_sig = set(predict.gene_differential(e.E, syn, neigh))
    parser.add_argument('--ie_iter',
                        dest='ie_iter',
                        action='store',
                        required=False,
                        default=1000,
                        type=int,
                        help="Number IE iterations")

    params = parser.parse_args()

    M = MatLoader()
    M.load_left()
    D = M.load_consensus_graphs(params.deg)
    S = M.load_consensus_chemical_synapse(params.deg)
    G = M.load_consensus_gap_junctions(params.deg)

    nodes = sorted(D.A.nodes())

    e = Matrix(cam, params.matrix)
    e.load_genes()
    e.load_cells(sorted(D.A.nodes()))
    e.assign_expression()
    e.binarize()
    e.difference_matrix()

    wbe = cam_lus.wbe(e, D, cells=M.left)
    wbe_data = wbe.get_data()
    tmp = params.fout.replace('.', '_wbe.')
    aux.write.from_list(tmp, wbe_data)