Apart from merging data and performing calculations on it, the DoOR.functions package provides several ways to visualize the data served by the DoOR.data package. Please see the DoOR.function vignette for instructions on how to install and load both functions and data. The plotting functions can be identified by their common prefix dplot_, most of them make use of the ggplot2 package which allows to override most, if not all of the theming options.


Loading data

First we need to load packages and data:

#load data

Visualizing odorants vs responding units with dplot_responseMatrix()

dplot_responseMatrix() visualizes the DoOR consensus response matrix either as a point matrix with the size of the points relating to the response strength, or as a heatmap, relating color to response strength. The default plot that is used depends on the data we enter: positive values only (like from response.matrix or response.matrix_non.normalized) which are scaled [0,1] will by default be plotted as a point-matrix. If we provide data that contains negative values (e.g. data with the spontaneous firing rate set to 0 via resetSFR(response.matrix, "SFR")) it will be shown as color-coded heatmap.

dplot_responseMatrix(response.matrix[2:50,], tag = "Name", base_size = 8)
## Only positive values, returning b&w point plot.

If the data contains negative values, a colored response matrix will be plotted:

dplot_responseMatrix(resetSFR(response.matrix, "SFR")[2:50,], tag = "Name", base_size = 8)
## Warning: Non Lab interpolation is deprecated

## Visualizing ensemble responses with dplot_ALmap() With dplot_ALmap() we can visualize the ensemble response a given odorant elicits across DoOR responding units (receptors, sensory neurons, glomeruli, … ) as a hypothetical antennal lobe activation pattern.

dplot_ALmap("QSJXEFYPDANLFS-UHFFFAOYSA-N", base_size = 8)
## Warning: Non Lab interpolation is deprecated

If we do not know the InChIKey of the substance we are interested in, we can use the transID() function for conversion. If we are interested in the expressed receptor rather than the glomerulus names:

dplot_ALmap(transID("benzaldehyde", from = "Name"), tag = "receptor", main = "SMILES", base_size = 8)

If we prefer the plain activation pattern without annotations at all:

dplot_ALmap(transID("628-63-7", from = "CAS"), tag = "", main = "", legend = F, scalebar = F)
## Warning: Non Lab interpolation is deprecated

## Visualizing tuning curves with dplot_tuningCurve() ### Responding units

The set of odorants a given responding unit is responsive to can be described as its tuning curve. With dplot_tuningCurve() we can easily display such a tuning curve together with its kurtosis. Kurtosis is a measure of the shape of the tuning curve, i.e. whether a responding unit is narrowly tuned to a few odorants (high kurtosis), or whether it responds to many odorants (low kurtosis). The gaussian distribution has a kurtosis of 0.

If we only specify the receptor/response unit name, the data is taken from response.matrix and dplot_tuningCurve() uses resetSFR() to reset spontaneous firing rate (or any other specified odorant) to zero before plotting.

dplot_tuningCurve(receptor = "Or22a", base_size = 8)

To prevent resetting by SFR:

dplot_tuningCurve(receptor = "Or22a", zero = "", base_size = 8)

We can also plot any other vector of responses, once response.vector is specified, the value of receptor is only used for the plot title and not for data lookup anymore:

dplot_tuningCurve(receptor = "receptor X", response.vector = c(1:100), base_size = 8)

### Odorants dplot_tuningCurve() can as well be used to visualize the ensemble of responding units that is activated by a given odorant. Therefore, we specify an odorant name instead of a response unit name:

dplot_tuningCurve(odorant = "PGMYKACGEOXYJE-UHFFFAOYSA-N", base_size = 8)

We can specify the chemical identifier to plot via odor.main:

dplot_tuningCurve(odorant = "PGMYKACGEOXYJE-UHFFFAOYSA-N", odor.main = "SMILES", base_size = 8)

dplot_tuningCurve(odorant = "CURLTUGMZLYLDI-UHFFFAOYSA-N", odor.main = "InChI", base_size = 8)

And finally we can control the color of the bars:

dplot_tuningCurve(odorant = transID("carbon dioxide", from = "Name"), fill.odorant = "#FF0000", base_size = 8)

As mentioned, all of these plots are generated with the ggplot2 package which allows to override theming:

dplot_tuningCurve(odorant = transID("carbon dioxide", from = "Name"), base_size = 8) +
  theme(panel.background = element_rect(fill = "grey", color = "magenta"))

## Visualizing response profiles dplot_responseProfile() dplot_responseProfile creates a horizontal bar plot of the response profile of a given receptor. It displays the same data as dplot_tuningCurve but focusses on the odorant identity.

Per default the response strength is displayed as bar height as well as color code:

dplot_responseProfile("Gr21a.Gr63a", tag = "Name", base_size = 8)
## Warning: Non Lab interpolation is deprecated

We can again omit to reset to SFR:

dplot_responseProfile("Gr21a.Gr63a", tag = "Name", base_size = 8, zero ="")
## Warning: Non Lab interpolation is deprecated

And if we prefer monochrome data:

dplot_responseProfile("Gr21a.Gr63a", tag = "CAS", base_size = 8, colored = F)

## Comparing response profiles dplot_compareProfiles() As the name indicates, with dplot_compareProfiles() we can plot two response profiles side by side for comparison. The syntax here differs from the previous plots as we can use it also to compare the original data sets in DoOR.

Comparing original data sets

This time, with x and y we have to specify a whole data.frame, by.x and by.y take the corresponding column names that will be plotted. If x is not specified, both by.x and by.y will be taken from x.

dplot_compareProfiles(x = Or22a, y = Or22a, by.x = "Pelz.2006.AntEC50",
                         by.y = "Hallem.2004.EN", tag = "Name", base_size = 8)

We see that the measured Or22a sensory neuron responses in these two data sets are in good accordance.

Comparing DoOR response profiles

Next we compare two DoOR consensus response profiles, measurements of the misexpressed receptor Or35a and recordings from the ac3B sensory neuron that naturally expresses Or35a:

dplot_compareProfiles(x = response.matrix, by.x = "Or35a", by.y = "ac3B",
                         tag = "Name", base_size = 8)

or with “SFR” set to 0:

dplot_compareProfiles(x = resetSFR(response.matrix, "SFR"), by.x = "Or35a", by.y = "ac3B",
                         tag = "Name", base_size = 8)

We see that the response profiles are very similar but not identical, which is expected as the ac3B neuron expresses other receptors in addition to Or35a.

Visualizing odorant responses across responding units with dplot_acrossReceptors()

With dplot_acrossReceptors() we can visualize the responses that one or several odorants elicit across receptors / responding units.

odors <-
  transID(c("pentyl acetate", "carbon dioxide", "2,3-butanedione"), from = "Name")
dplot_acrossReceptors(odors, tag = "Name", base_size = 8)

Visualizing odorant responses across OSNs with dplot_acrossOSNs()

dplot_acrossOSNs() is similar to dplot_acrossReceptors() but the responding units are sorted according to the sensory neuron they belong to. This sorting is controlled via DoOR_mappings from the DoOR.data package. There are two types of plot that dplot_acrossOSNs() can return. Type 2 directly resembles dplot_acrossReceptors():

dplot_acrossOSNs(odors, base_size = 8, plot.type = 2)

In type 1 the data is split according to odorant X sensillum, the color is assigned to the corresponding neuron A-D or X-Z if the neuron’s identity is unknown:

dplot_acrossOSNs(odors, base_size = 8, plot.type = 1)

As this plot gets pretty messy, we have the option to restrict plotting to certain subsets of sensilla. We can for example only plot the responses of antennal basiconic (ab) sensilla:

dplot_acrossOSNs(odors, base_size = 8, plot.type = 1, sub = "ab")

Or we plot coeloconic and trichoid sensilla:

dplot_acrossOSNs(odors, base_size = 8, plot.type = 1, sub = c("ac", "at"))