Closed Yuri05 closed 5 years ago
Dataframe Probably one dataframe with observed and simulated values (needs alignment with QP) Standardization of the most often used columnnames is welcome (e.g. to define Time as default for X axis), but in principal free choice of column names.
Jürgens opinion: aggregation of values from different rows for e.g. box whisker plots is ok, but calculation of values from different parameters should be done before plot. Each parameter to be displayed should be contained in one column, then metadata can be attached to that column or each data column corresponds to one row in a metadata dataframe. Juri: perhaps computation of e.g. ratio should be possible.
Datatable could e.g. have columns: (Time), IndividualID, Gender, Age, Compound, Dose, PKParameterType, Observed, Predicted, (Ratio)
For Concentration profile e.g. columns (Time), IndividualID, Gender, Age, Compound, Dose, Compartment, Concentration Observed, Concentration Simulated,
There are other options for a table: Not one column per parameter, but a column ParameterValue (or two columns SimulatedValue, ObservedValue) and a column ParameterName. But at least two challenges with this format exist:
Data mapping
Metadata Metadata is necessary to describe data, to make information out of the data; Configuration just how(!) the information is displayed. ? Metadata in dateframe or at some column properties/attributes ?
Default template for X axis caption should be "
Example: dataframe for metadata with columns columnName, dimension, unit, LLOQ, codeDecodeList, aggregationMethod Age time years NA NA NA Gender NA NA NA 1,MALE;2,FEMALE NA AUC observed, ?AUC?
Question to both(!) groups QP and SPM: Could we save the codeDecodeList by requesting Decode values in the data table. Jürgen assume: QP will insist on code values as this is the principle in Nonmem Files.
Plot configuration
Configuration CoordinateSystem Values-Layout-Mappings (e.g. (Compound, Dose) - Color, Gender - Symbol/Size) ....
CoordinateSystem XAxis : Axis YAxis : Axis
Axis Scaling Range ...
Range Mode (to allow automatic computation from values or computation from values with minimal/maximal bounds or .... ) Min Max ...
Legend Font Position N_Columns ? (for multicolumn display) Autosize ? ...
Watermark Font Transparency ...
Font Family (Arial, ...) Size Face (Bold, Italic, ...) Color ...
By default there should be used fixed lists, e.g. for color, symbol, etc. But it should be possible to specify e.g. colors for the possible group values Idea: TLF-Library has a function to return values-mapping for (composed) group values after defining dataframe and datamapping User then should be able to modify this values-mapping and pass it to the configuration object.
For Legend build one list of all value combination (here for all ((Compound,Dose),Gender) combinations will a colored and sized symbol computed and displayed)
The user can define a string template with tags to override the default: "
plotPKRatio <- function( data, metadata, datamapping, plotconfiguration )
1 to N tables (data frames) with arbitrary columns.
example for PK Ratio plot: 2 tables; the first one for AUC Ratio, the second for CMAX Ratio
IndividualID | Population | Gender | Age | Compound | Dose | Organ | Compartment | Simulated | Observed | Ratio |
---|---|---|---|---|---|---|---|---|---|---|
1 | Asian | M | 1 | Aspirin | 2 | VenousBlood | Plasma | 2 | 4 | 0.5 |
2 | Asian | F | 2 | Aspirin | 3 | VenousBlood | Plasma | 3 | 4 | 0.75 |
IndividualID | Population | Gender | Age | Compound | Dose | Organ | Compartment | Simulated | Observed | Ratio |
---|---|---|---|---|---|---|---|---|---|---|
1 | Asian | M | 1 | Aspirin | 2 | VenousBlood | Plasma | 12 | 10 | 1.2 |
2 | Asian | F | 2 | Aspirin | 3 | VenousBlood | Plasma | 9 | 8 | 1.125 |
3 | Asian | F | 3 | Aspirin | 4 | VenousBlood | Plasma | 5 | 5 | 1 |
("per column" attributes describing the data)
Units and Dimensions (always assuming the same unit per column!; dimensions are used for display only! Thus not necessarily the internal names should be used )
LLOQ
Value Mappings (or do it BEFORE calling the plot function?)
Unit for the x-axis-column must be the same in all tables. Question: how many axes would we like to allow for Y? 2? 3? arbitrary?
Groupings and Value<=>Layout Mapping (defines combination of columns which identify graphical properties such as color, symbol, line width, symbol size, ...) e.g.
Compound | Dose | Colour |
---|---|---|
Aspirin | 2 | Blue |
Aspirin | 3 | Red |
Gender | Symbol |
---|---|
M | Circle |
F | Asterisk |
TLF library should provide functions, which would retrieve the default mapping for a data table, property and grouping. E.g. for the data table above getDefaultLayoutMapping(data, "Colour", {"Compound", "Dose"})
would return something like
Compound | Dose | Colour |
---|---|---|
Aspirin | 2 | Green |
Aspirin | 3 | Blue |
With that, user could e.g. adjust just a few entries in the layout table and pass it to the plot function
Legend
Captions
Option 1: select general caption based on placeholders using all (or some) of the Grouping columns
{Compound}-{Dose}-{Gender}-{Age}
or {Compound}-{Dose}-{Gender}
Option 2: provide captions table for all combinations, e.g.
Compound | Dose | Gender | Age | Caption |
---|---|---|---|---|
Aspirin | 2 | M | 1 | Aspirin-2mg-Male |
Aspirin | 3 | F | 2 | Aspirin-3mg-Female |
Position (inside/Outside/None, left/right, top/bottom)
Font
Autosize?
Remarks
Similar to Value<=>Layout Mapping, user can define only PARTS of legend captions (or no captions at all).
All missing entries will be automatically filled by the TLF Library
TLF library should provide functions, which would retrieve the default captions for a data table and all grouping columns. E.g. for the data table above getDefaultCaptions(data, {"Compound", "Dose", "Gender", "Age"})
would return something like
Compound | Dose | Gender | Age | Caption |
---|---|---|---|---|
Aspirin | 2 | M | 1 | {Compound}-{Dose}-{Gender}-{Age} |
Aspirin | 3 | F | 2 | {Compound}-{Dose}-{Gender}-{Age} |
With that, user could e.g. adjust just a few entries in the captions table and pass it to the plot function
{Column} [{Unit}]
(to be discussed){Column} [{Unit}]
or {Dimension} [{Unit}]
)Data_And_Bounds
(TODO find a good name)Bounds_Only
(TODO find a good name)
E.g. in PK-Ratio it could be [min(0; min(data))..max(3; max(data))]
{Column}
Placeholder is not possible?)I really would suggest to use as often as possible the philosophy used by the R function ggplot. If I understand it correctly, this is not done for the legend. E:g. If you have in a plot 10 age Groups and 2 genders and Age is specified by Color and gender by shape ggplot would generate a combined legend with 10 entries for Color and 2 for shape with short descriptions, where as in the current implementation a legend with 20 entries with Long combined description. The ggplot implementation has following pros:
@KatrinCoboeken I do not understand what you mean. Can you show us an example of what you think is happening and what should happen?
This is what the current implementation creates at the moment
when using the following configuration
PKRatioDataMapping$new(colorGrouping = "Gender", shapeGrouping = c("Dose", "Compound"))
Great, That’s exactly what I want to have. I had a discussion with Juri where I got another impression. But this is perfect.
Best, Katrin
Von: Michael Sevestre [mailto:notifications@github.com] Gesendet: Dienstag, 17. September 2019 15:23 An: Open-Systems-Pharmacology/TLF-Library Cc: Katrin Coboeken; Mention Betreff: Re: [Open-Systems-Pharmacology/TLF-Library] Figure for reportinge engine: PK Ratio plot (#12)
@KatrinCoboekenhttps://github.com/KatrinCoboeken I do not understand what you mean. Can you show us an example of what you think is happening and what should happen?
This is what the current implementation creates at the moment [image]https://user-images.githubusercontent.com/1041237/65045412-ba5dab00-d92c-11e9-9bfc-9835cf63dd3d.png
when using the following configuration PKRatioDataMapping$new(colorGrouping = "Gender", shapeGrouping = c("Dose", "Compound"))
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Open-Systems-Pharmacology/TLF-Library/issues/12?email_source=notifications&email_token=AGZ5W2MDCTCMBKTVVHOCSBDQKDK4JA5CNFSM4H55PJAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD64QFCQ#issuecomment-532218506, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGZ5W2PORZT7OSHFPVE7ID3QKDK4JANCNFSM4H55PJAA.
From what I tested you can do both:
Scatter plot showing
{X-value; predicted/observed value}
data pairs and X-fold range bounds.Example plots:Inputs:
Output plot(s):