cpipilot logo cpipilot logo

Table Of Contents

Previous topic

URLs Module

Next topic

Admin Module

This Page

Views Module

cpipilot.repository.views

The views defined here form the logic behind what gets displayed through the HTML templates. These views get their arguments through Django’s URL pattern matching procedure. For a more in-depth explanation on how Django’s views work please see Writing Views.


views.geneSingle

cpipilot.repository.views.geneSingle(request, id)

Returns an HttpResponse constructed by rendering the templates/repository/gene/geneSingle.html template with the appropriate context resulting in the gene page.

Logic Description:

  • The gene is retrieved from the id parameter.
  • Distinct targets related to this gene are retrived.
  • Distinct reagents targetting these targets are retrieved.
  • Distinct phenotypes produced through the use of these reagents are retrived.
  • The QuerySets returned by these filtering steps are sent through to the geneSingle HTML template.

views.targetSingle

cpipilot.repository.views.targetSingle(request, id)

Returns an HttpResponse constructed by rendering the templates/repository/target/targetSingle.html template with the appropriate context resulting in the target page.

Logic Description:

  • The target is retrieved from the id parameter.
  • Distinct phenotypes produced by the reagents that target this target are retrived.
  • Distinct reagent/target links where the target is this target are retrived.
  • A list of reagent/target links together with the experiments that claim these links is constructed.
  • The QuerySets returned by these filtering steps and the constructed list are sent through to the targetSingle HTML template.

views.reagentSingle

cpipilot.repository.views.reagentSingle(request, id)

Returns an HttpResponse constructed by rendering the templates/repository/reagent/reagentSingle.html template with the appropriate context resulting in the reagent page.

Logic Description:

  • The reagent is retrieved from the id parameter.
  • Distinct phenotypes produced by the reagent are retrieved.
  • ImageSets from wells where this reagent has been used are retrieved.
  • Distinct reagent/target links where the reagent is this reagent are retrived.
  • A list of reagent/target links together with the experiments that claim these links is constructed.
  • The QuerySets returned by these filtering steps and the constructed list are sent through to the reagentSingle HTML template.

views.phenotypeToGene

cpipilot.repository.views.phenotypeToGene(request, id)

Returns an HttpResponse constructed by rendering the templates/repository/phenotype/phenotypeToGene.html template with the appropriate context. This HttpResponse forms the first tab in the phenotype page.

Logic Description:

  • The phenotype is retrieved from the id parameter.
  • Distinct targets targeted by the reagents that produce this phenotype are retrived.
  • Distinct genes that are related to these targets are retrieved.
  • A paginator is used to split the genes into contiguous lists of 18 genes and the right list of genes for the corresponing page is retrived. Normally paginators are used in the HTML template by invoking the correct template tag but in this special case the gene list needs to be broken up so that a duo list can be constructed and passed into the HTML template.
  • A new duo list of gene/targets pairs is built from the gene page list by including all target ids and target external ids that are both related to the gene and that are in the target list retrived above.
  • The QuerySets returned by these filtering steps and the constructed list are sent through to the phenotypeToGene HTML template.

views.phenotypeToReagent

cpipilot.repository.views.phenotypeToReagent(request, id)

Returns an HttpResponse constructed by rendering the templates/repository/phenotype/phenotypeToReagent.html template with the appropriate context. This HttpResponse forms the second tab in the phenotype page.

Logic Description:

  • The phenotype is retrieved from the id parameter.
  • Distinct reagents that produce this phenotype are retrived.
  • The QuerySets returned by these filtering steps are sent through to the phenotypeToReagent HTML template.

views.phenotypeGeneLinkage

cpipilot.repository.views.phenotypeGeneLinkage(request, phenotypeID, geneID)

Returns an HttpResponse constructed by rendering the templates/repository/phenotype/phenotypeGeneLinkage.html template with the appropriate contextresulting in the gene/phenotype linkage page.

Logic Description:

  • The phenotype is retrieved from the phenotypeID parameter.
  • The gene is retrieved from the geneID parameter.
  • Distinct reagents that produce this phenotype and that are related to this gene through their targets are retrived.
  • A dictionary is constructed in which each entry is itself a dictionary consisting of the reagents above as well as their targets and related imageSets.
  • The gene and phenotype returned by these get steps and the constructed dictionary are sent through to the phenotypeGeneLinkage HTML template.

views.imageSetSingle

cpipilot.repository.views.imageSetSingle(request, id)

Returns an HttpResponse constructed by rendering the templates/repository/phenotype/imageSetSingle.html template with the appropriate context resulting in the data page.

Logic Description:

  • The imageSet is retrieved from the id parameter.
  • The imageSet and the DATA_ROOT variable from the settings.py module are sent through to the imageSetSingle HTML template.

views.experimentsAll

cpipilot.repository.views.experimentsAll(request)

Returns an HttpResponse constructed by rendering the templates/repository/experiment/experiments.html template with the appropriate context resulting in the experiments page which lists all available experiments.

Logic Description:

  • All experiments are retrived and set through to the experiments HTML template.

views.experimentSingle

cpipilot.repository.views.experimentSingle(request, id)

Returns an HttpResponse constructed by rendering the templates/repository/experiment/experimentSingle.html template with the appropriate context resulting in the experiment page.

Logic Description:

  • The experiment is retrieved from the id parameter.
  • All related phenotypes are retrived.
  • An attempt is made to acertain the size of the initial zip file.
  • If this attempt is successful then downloadExists will be set to true and the template will show the download link button for this experiment.
  • The experiment, it’s related phenotypes and other informative variable are sent through to the experimentSingle HTML template.

views.experimentDownload

cpipilot.repository.views.experimentDownload(request, id)

Returns an HttpResponse constructed by rendering the templates/repository/experiment/experimentDownload.html template with the appropriate context resulting in a page which starts the download of the initial zip file and displays information on what the initial zip download contains together with instructions on downloading all experimental raw data.

Logic Description:

  • The experiment is retrieved from the id parameter.
  • The experiment and the download location of the initial zip file are sent through to the experimentDownload HTML template.