Ejemplo n.º 1
0
def expt_data_set(specimen_id):
    sql = """
        select wkf.storage_directory || wkf.filename from well_known_files wkf
        join specimens sp on sp.ephys_roi_result_id = wkf.attachable_id
        where sp.id = %s
        and wkf.well_known_file_type_id = %s
    """

    results = lims_utils.query(sql, (specimen_id, NWB_DOWNLOAD_TYPE_ID))
    nwb_path = results[0][0]
    return NwbDataSet(nwb_path)
Ejemplo n.º 2
0
def collect_exp_var(ids):
    sql = """
        select sp.id, nmr.explained_variance_ratio from specimens sp
        join neuronal_models nm on nm.specimen_id = sp.id
        join neuronal_model_runs nmr on nmr.neuronal_model_id = nm.id
        where sp.id = any(%s)
        and nm.neuronal_model_template_id = %s
    """

    exp_var_data = {}
    for model_type, nmt_id in NEURONAL_MODEL_TEMPLATES.iteritems():
        results = lims_utils.query(sql, (list(ids), nmt_id))
        exp_var_data[model_type] = dict(results)

    return exp_var_data
Ejemplo n.º 3
0
def query_cells():
    q = """
    SELECT n.specimen_id, donors.full_genotype FROM neuron_reconstructions n 
    JOIN well_known_files f ON n.id = f.attachable_id
    JOIN specimens on specimens.id=n.specimen_id
    left join donors on specimens.donor_id=donors.id
    where 
        donors.full_genotype is not null
        and n.manual 
        and not n.superseded 
        and f.well_known_file_type_id = 303941301
    
    """
    cells = lims_utils.query(q, ())
    return cells
Ejemplo n.º 4
0
def collect_virtual_experiments(ids):
    sql = """
        select sp.id, wkf.storage_directory || wkf.filename from specimens sp
        join neuronal_models nm on nm.specimen_id = sp.id
        join neuronal_model_runs nmr on nmr.neuronal_model_id = nm.id
        join well_known_files wkf on wkf.attachable_id = nmr.id
        where sp.id = any(%s)
        and nm.neuronal_model_template_id = %s
    """

    ve_paths = {}
    for model_type, nmt_id in NEURONAL_MODEL_TEMPLATES.iteritems():
        results = lims_utils.query(sql, (list(ids), nmt_id))
        ve_paths[model_type] = dict(results)

    return ve_paths