ucscXena / ucsc-xena-client

Functional genomics browser
Apache License 2.0
57 stars 42 forks source link

KM page "download" capability #278

Closed jingchunzhu closed 2 years ago

jingchunzhu commented 6 years ago

Users want to be able to download the data used to generate the current KM plot.

maryjgoldman commented 5 years ago

For a 'help wanted', first create the file with the data. This should be a tsv with 4 columns: sampleID, OS (or whichever survival indicator is being used), OS.time (or again, whichever survival indicator is being used), and which group the sample is in (i.e. which of the lines that sample is in).

More info on KM plots: https://ucsc-xena.gitbook.io/project/overview-of-features/kaplan-meier-plots

After the file is generated for download, add a download icon to the KM plot pop-up for the user to click.

Gauravsahadev commented 5 years ago

@maryjgoldman I have some questions regarding this issue.

  1. The OS.time have the values of the x-axis and the OS have y-axis?
  2. In the file KmPlot.js the censors contain the array of objects which are d: 0 e: false n: 67 rate: null s: 1 t: 28 Is 'n' denoting in which group the sample is in?
maryjgoldman commented 5 years ago

I think n is the total number of samples that are in the plot. Not sure though. Flagging @acthp for confirmation

acthp commented 5 years ago

The "n" here is the number of patients "at risk" at a particular time step "t", i.e. the number still surviving that have not been "censored" (left the study). There are some notes in js/km.js on this data structure.

However, I don't think this is relevant to the issue. I believe the desired output is the raw input data. This data structure is the computed survival curve.

At the moment, I don't believe the raw data is even passed to the view layer (KmPlot.js). So, the first step would be getting the data to the view layer. That's probably best done in js/models/km.js:makeGroups(). That's the function that converts the column data into categories, and uses the survival data (OS.time, etc.), to compute the survival stats.

The return value of this function is merged into the km state in js/appSelector:kmGroups(). The km state is then passed to the view layer.

Gauravsahadev commented 5 years ago

@acthp @maryjgoldman Thanks for the help, Now I am able to get the survival data to the view layer and after generating the file(contains SampleID, OS, OS.time) in tsv, I can able to download it. I need help for the last column(which group the sample is in), from where I can get this data? please check this and tell me if the generated data are correct or not of GDC Pan-Cancer. Thank you km8

km7

km6 ?

Gauravsahadev commented 5 years ago

@jingchunzhu I have created a PR on this issue please review it. If any changes required please let me know. I will correct it. I hope that the data is what was expected.

maryjgoldman commented 5 years ago

just a FYI, this is what the GDC provides survival-plot.xlsx