pearcetm / jscomut

An interactive co-mutation plot generator, in-browser but fully client-side. Load a data file, play with the geometry of the chart, explore your data, and save an svg file.
https://pearcetm.github.io/jscomut
Apache License 2.0
7 stars 2 forks source link

How to hide the samples name #2

Open lh12565 opened 2 weeks ago

lh12565 commented 2 weeks ago

Hi, I want to hide the samples name. I try to set the 'show of sampleLegend' to no, but it didn't work. Are there any other parameters to hide it? Thanks! image

pearcetm commented 2 weeks ago

Can you show what your config looks like when you create the widget?

It's been a while since I've worked with this project, but you should be able to hide the sample legend interactively. In the demo page, you can click Edit and then expand the layout options, then uncheck the button for "Show sample labels?" and then click the button "Update comut plot settings". As you can see, when doing this, the sample legend is hidden correctly:

image
lh12565 commented 1 week ago

Can you show what your config looks like when you create the widget?

It's been a while since I've worked with this project, but you should be able to hide the sample legend interactively. In the demo page, you can click Edit and then expand the layout options, then uncheck the button for "Show sample labels?" and then click the button "Update comut plot settings". As you can see, when doing this, the sample legend is hidden correctly:

image

I just set the sampleLegend like below in the jscomut.js file:

sampleLegend:{
            height: 100,
            show:'no',
        },

In the demo, it worked when I uncheck the button for "Show sample labels", but I want to change the options in the jscomut.js to hide the name. Thanks!

pearcetm commented 1 week ago

Try the following instead:

sampleLegend:{
    height: 100,
    show: false,
},

I updated the documentation to reflect this as well.

lh12565 commented 3 days ago

Try the following instead:

sampleLegend:{
    height: 100,
    show: false,
},

I updated the documentation to reflect this as well.

Hi, I have another question. I try to use jscomut.js to my website. I want to be able to display the heatmap as soon as I enter the page or select the entry in the drop-down box without clicking on "Add this data to the Comut plot". I try to change the code as below, but it didn't work: In the jscomutdemo.js file, I change the code like below:

var comut = new Comut();
      comut.init({
          target: '#widget',
      });
      var mut="Sample\tGene\tAlteration\tType\n4526\tTP53\tc.329G>C ;p.R110P\tMissense_Mutation\n4526\tIDH1\tc.395G>A ;p.R132H\tmissense\n4587\tIDH1\tc.394C>A ;p.R132S\tmissense\n4587\tTP53\tc.817C>T ;p.R273C\tmissense\n4587\tRB1\tc.1072C>T ;p.R358*\tstop\n4588\tTERT\tc.1-124C>T ;p.?\tpromoter\n"
      var clin="Sample\tDiagnosis\tWHO grade\n4590\tA\tII\n4591\tA\tII\n4736\tA\tII\n4753\tA\tII\n4754\tA\tII\n"
      $('<button>', { class: 'btn btn-default' }).text('Randomize').on('click', function () { comut.randomize(); }).appendTo('#comutbuttons');
      $('<button>', { class: 'btn btn-default' }).text('Sort Samples').on('click', function () { comut.sort({ x: true }); }).appendTo('#comutbuttons');
      $('<button>', { class: 'btn btn-default' }).text('Sort Genes').on('click', function () { comut.sort({ y: true }); }).appendTo('#comutbuttons');
      $('<button>', { class: 'btn btn-default' }).text('Sort Both').on('click', function () { comut.sort(); }).appendTo('#comutbuttons');
      $('button').css({ margin: '5px' });
      comut.setData(mut,clin,'Example variant data');

In the jscomut.js, I commented out some code.

//$('<button>', { class: 'add-data-button' }).text('Add this data to the Comut plot').on('click', function () {
         //$('.oncoplot_sel').on('changer', function () {
                //$(this).hide();
            //filepanelHeader.click();
            updateOptions();
            configureWidget();
            createDataSVG();
        //}).appendTo(fileInfo).hide();

The console log displays this error: "Cannot read properties of undefined (reading 'gridCellWidth')"

Can you tell me how to change the code to display the heatmap as soon as I enter the page. Thanks!