Open-Systems-Pharmacology / TLF-Library

TLF Library implementation in R
https://www.open-systems-pharmacology.org/TLF-Library/
Other
9 stars 6 forks source link

Figure for reportinge engine: PK Ratio plot #12

Closed Yuri05 closed 5 years ago

Yuri05 commented 5 years ago

Scatter plot showing {X-value; predicted/observed value} data pairs and X-fold range bounds.Example plots:

grafik grafik

Inputs:

Output plot(s):

ju-rgen commented 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 " []" could be overridden by user. In PK Ratio plot no units for y Axis seem to be used (which is exceptional) When grouping by Gender, codeDecodeList can/should be used for labels of groups

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: " - - ",

Yuri05 commented 5 years ago

plotPKRatio <- function( data, metadata, datamapping, plotconfiguration )

data

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

Metadata

("per column" attributes describing the data)

Data Mapping

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?

Remarks

With that, user could e.g. adjust just a few entries in the layout table and pass it to the plot function

Plot configuration

With that, user could e.g. adjust just a few entries in the captions table and pass it to the plot function

KatrinCoboeken commented 5 years ago

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:

msevestre commented 5 years ago

@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

when using the following configuration PKRatioDataMapping$new(colorGrouping = "Gender", shapeGrouping = c("Dose", "Compound"))

KatrinCoboeken commented 5 years ago

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.

pchelle commented 5 years ago

From what I tested you can do both: