Ejemplo n.º 1
0
def detail_study(request, pk=None):
    """
    Detailed view of a single study
    """
    study = Study.objects.published().get(id=pk)
    # Check if RNASeq or Phenotypes:
    if len(Phenotype.objects.published().filter(study__id=pk)) > 0:
        phenotype_table = ReducedPhenotypeTable(
            Phenotype.objects.published().filter(study__id=pk),
            order_by="-name")
    else:
        phenotype_table = RNASeqTable(RNASeq.objects.filter(study__id=pk),
                                      order_by="-name")
    RequestConfig(request, paginate={
        "per_page": 20
    }).configure(phenotype_table)
    variable_dict = {}
    variable_dict["phenotype_table"] = phenotype_table
    variable_dict["study"] = study
    variable_dict['to_data'] = study.phenotype_set.values(
        'to_term__name').annotate(count=Count('to_term__name'))
    variable_dict['eo_data'] = study.phenotype_set.values(
        'eo_term__name').annotate(count=Count('eo_term__name'))
    variable_dict['uo_data'] = study.phenotype_set.values(
        'uo_term__name').annotate(count=Count('uo_term__name'))
    return render(request, 'phenotypedb/study_detail.html', variable_dict)
Ejemplo n.º 2
0
def list_rnaseqs(request):
    """
    Displays table of all published RNASeq
    """
    table = RNASeqTable(RNASeq.objects.all(), order_by="-name")
    RequestConfig(request, paginate={"per_page": 50}).configure(table)
    return render(request, 'phenotypedb/rnaseq_data_list.html',
                  {"rnaseq_table": table})
Ejemplo n.º 3
0
def list_rnaseqs(request):
    """
    Displays table of all published RNASeq
    """
    table = RNASeqTable(RNASeq.objects.all(), order_by="name")
    RequestConfig(request, paginate={"per_page":50}).configure(table)
    context = { 'rnaseq_table': table, 'is_rnaseq': True }
    context.update(base_context(request))
    return render(request, 'phenotypedb/rnaseq_data_list.html', context)
Ejemplo n.º 4
0
def SearchResultsRNASeq(request, query=None):
    studies = Study.objects.published().annotate(
        pheno_count=Count('phenotype')).annotate(rna_count=Count('rnaseq'))
    studies = studies.filter(pheno_count=0).filter(rna_count__gt=0)
    if query == None:
        rnaseqs = RNASeq.objects.all()
        studies = studies.all()
        accessions = Accession.objects.all()
        download_url = "/rest/rnaseq_search"
    else:
        rnaseqs = RNASeq.objects.filter(
            Q(name__icontains=query) | Q(growth_conditions__icontains=query))
        studies = studies.filter(name__icontains=query)
        accessions = Accession.objects.filter(name__icontains=query)
        download_url = "/rest/rnaseq_search/" + str(query)

    rnaseq_table = RNASeqTable(rnaseqs, order_by="-name")
    RequestConfig(request, paginate={"per_page": 10}).configure(rnaseq_table)

    study_table = RNASeqStudyTable(studies, order_by="-name")
    RequestConfig(request, paginate={"per_page": 10}).configure(study_table)

    accession_table = AccessionTable(accessions, order_by="-name")
    RequestConfig(request, paginate={
        "per_page": 10
    }).configure(accession_table)

    variable_dict = {}
    variable_dict['query'] = query
    variable_dict['nrnaseqs'] = rnaseqs.count()
    variable_dict['rnaseq_table'] = rnaseq_table
    variable_dict['accession_table'] = accession_table
    variable_dict['study_table'] = study_table

    variable_dict['nstudies'] = studies.count()
    variable_dict['naccessions'] = accessions.count()
    variable_dict['download_url'] = download_url

    print(variable_dict)

    return render(request, 'home/rnaseq_search_results.html', variable_dict)