Example #1
0
def _build_single_study_info(study, info, study_proc, proc_samples):
    """Clean up and add to the study info for HTML purposes

    Parameters
    ----------
    study : Study object
        The study to build information for
    info : dict
        Information from Study.get_info
    study_proc : dict of dict of lists
        Dictionary keyed on study_id that lists all processed data associated
        with that study. This list of processed data ids is keyed by data type
    proc_samples : dict of lists
        Dictionary keyed on proc_data_id that lists all samples associated with
        that processed data.

    Returns
    -------
    dict
        info-information + extra information for the study,
        slightly HTML formatted
    """
    PI = StudyPerson(info['principal_investigator_id'])
    status = study.status
    if info['publication_doi'] is not None:
        pmids = get_pubmed_ids_from_dois(info['publication_doi']).values()
        info['pmid'] = ", ".join([pubmed_linkifier([p]) for p in pmids])
        info['publication_doi'] = ", ".join([doi_linkifier([p])
                                             for p in info['publication_doi']])

    else:
        info['publication_doi'] = ""
        info['pmid'] = ""
    if info["number_samples_collected"] is None:
        info["number_samples_collected"] = 0
    info["shared"] = get_shared_links(study)
    # raw data is any artifact that is not Demultiplexed or BIOM

    info["num_raw_data"] = len([a for a in study.artifacts()
                                if a.artifact_type not in ['Demultiplexed',
                                                           'BIOM']])
    info["status"] = status
    info["study_id"] = study.id
    info["pi"] = study_person_linkifier((PI.email, PI.name))
    del info["principal_investigator_id"]
    del info["email"]
    # Build the proc data info list for the child row in datatable
    info["proc_data_info"] = []
    for data_type, proc_datas in viewitems(study_proc[study.id]):
        info["proc_data_info"].extend([
            _build_single_proc_data_info(pd_id, data_type, proc_samples[pd_id])
            for pd_id in proc_datas])
    return info
Example #2
0
 def _get_shared_for_study(self, study, callback):
     shared_links = get_shared_links(study)
     users = [u.email for u in study.shared_with]
     callback((users, shared_links))
Example #3
0
 def _get_shared_for_study(self, analysis, callback):
     shared_links = get_shared_links(analysis)
     users = [u.email for u in analysis.shared_with]
     callback((users, shared_links))
Example #4
0
 def _get_shared_for_study(self, study, callback):
     shared_links = get_shared_links(study)
     users = [u.email for u in study.shared_with]
     callback((users, shared_links))
Example #5
0
 def _get_shared_for_study(self, analysis, callback):
     shared_links = get_shared_links(analysis)
     users = [u.email for u in analysis.shared_with]
     callback((users, shared_links))