New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

event-matrix

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

event-matrix

An instrument for the visual representation of multidimensional data

latest
Source
npmnpm
Version
0.1.3
Version published
Weekly downloads
3
-87.5%
Maintainers
0
Weekly downloads
 
Created
Source

Event Matrix

Event Matrix is an instrument for the visual representation of multidimensional data, inspired by the earlier project OncoGrid. Initially developed to meet the needs of bioinformaticians, it helps in demonstrating the relationships between genes, donors, and mutations in the genome. It's also well-suited for displaying any three-dimensional (and potentially four-dimensional) data matrices.

Installation & Usage

  • Install dependencies:

    npm install event-matrix
    
  • Import EventMatrix in your project:

    import EventMatrix from 'event-matrix';
    
  • Set up options:

    const eventMatrix = new EventMatrix({
      element: '#event-matrix', // HTML ID for mounting the component
      columns, // Columns of your data grid
      rows, // Rows of your data grid
      entries, // Entries/events that occur in a specific cell
      grid: {
        appearance: this.getCellAppearance,
        width: 1000,
        minCellHeight: 15,
        minCellWidth: 30,
      },
      description: {
        bottom: {
          fields: donorFields,
          appearance: this.getColumnsAppearance,
          fieldHeight: 15,
        },
        side: {
          fields: geneFields,
          appearance: this.getRowsAppearance,
          fieldHeight: 15,
        },
      },
      histogram: {
        top: {
          label: 'Mutation freq.',
        },
        side: {
          label: 'Mutation freq.',
        },
      },
    });
    eventMatrix.setGridLines(this.showGridLines);
    eventMatrix.render();
    

Options

OptionPossible / Default valueExampleDescription
element-"#event-matrix"HTML selector for mounting the component
columnsArray / [][{ "id": "12" }]Column data
rowsArray / [][{ "id": "34" }]Row data
entriesArray / [][{ "id": "56", "rowId": "12", "columnId": "34" }]"Events" or "Entries" - data defined by the intersection of a row and a column
gridObject / false / {}{ appearance: () => {}, width: 1000, minCellHeight: 15, minCellWidth: 30 }Options that describe main grid
grid.appearanceFunction(val) => { color: (val.name === "red" ? "#FF0000" : "#00FF00"), opacity: .5 }Function that determines the cell color and opacity in the main grid
grid.widthNumber / 1000555You can specify here the main grid total width...
grid.minCellWidthNumber / 3033.3...or specify minimum cell width
grid.heightNumber / 500250You can specify here the main grid total height...
grid.minCellHeightNumber / 1517...or specify minimum cell height
descriptionObject / false / {}{ bottom: false, side: { fields: [] }}Options for the bottom and side descriptions blocks
description.sideObject / false / {}{ fields: [], appearance: () => {}, fieldHeight: 15 }Options for the side description block (same options for the side block)
description.bottomObject / false / {}{ fields: [], appearance: () => {}, fieldHeight: 15 }Options for the bottom description block (same options for the bottom block)
description.bottom.fieldsArray / [][{ "group": "Clinical Data", "name": "Age", "fieldName": "age", "type": "age"}]Column or row description fields (the param "group" allows divide fields by groups)
description.bottom.appearanceFunction(trackCell) => { color: (trackCell.type === 'age' ? "#FF0000" : "#00FF00"), opacity: .5 }Function that determines the cell color and opacity in this description block
description.bottom.fieldHeightNumber / 1510Description field height
histogramObject / false / {}{ top: false, side: { label: "AAAA" }}Options that describe top and side histograms
histogram.sideObject / false / {}{ label: "Mutation freq." }Options for the side histogram block (same options for the top block)
histogram.topObject / false / {}{ label: "Mutation freq." }Options for the top histogram block (same options for the side block)
histogram.top.labelString / """Mutation freq."The histogram's label

Events

EventParamsDescription
grid:cell:hovertarget: HTMLElement,
entryId: string
Hovered over a table cell
grid:cell:clicktarget: HTMLElement,
entryId: string
Clicked on a table cell
grid:out-Moved cursor away from the table
grid:label:hovertarget: HTMLElement, rowId: stringHovered over a row label
grid:label:clicktarget: HTMLElement, rowId: stringClicked on a row label
grid:crosshair:hovertarget: HTMLElement, columnId: string, rowId: stringHovered over a table cell in zoom mode
grid:crosshair:out-Moved cursor away from the table in zoom mode
grid:selection:startedtarget: HTMLElement, x: number, y: numberStarted selecting cells in zoom mode; x, y - coordinates of the selection start
grid:selection:finishedtarget: HTMLElement, x: number, y: numberFinished selecting cells in zoom mode; x, y - coordinates of the selection end
histogram:hovertarget: HTMLElement, domainId: string, type: "rows"/"columns"Hovered over a histogram column; domainId - id of a row or column, depending on the type of histogram
histogram:clicktarget: HTMLElement, domainId: string, type: "rows"/"columns"Clicked on a histogram column; domainId - id of a row or column, depending on the type of histogram
histogram:out-Moved cursor away from the histogram
description:legend:hovertarget: HTMLElement, group: stringHovered over an icon in the description block; group - the name of the group
description:legend:out-Moved cursor away from an icon in the description block
description:cell:hovertarget: HTMLElement, domainId: string, type: "rows"/"columns", field: stringHovered over a cell in the description block; domainId - id of a row or column, field - name of field
description:cell:clicktarget: HTMLElement, domainId: string, type: "rows"/"columns", field: stringClicked on a cell in the description block; domainId - id of a row or column, field - name of field
description:cell:out-Moved cursor away from the description block

Migration from OncoGrid

If you previously used OncoGrid, you might want to switch to this newer version. Note that there have been changes in parameter, function, and event names.

  • Update options:
  • genesrows
  • donorscolumns
  • observationsentries
  • donorTrackscolumnFields
  • geneTracksrowFields
  • donorOpacityFunc + donorFillFuncdescription.bottom.appearance
  • geneOpacityFunc + geneFillFuncdescription.side.appearance
  • colorMap (Map) → grid.appearance (Function)
  • trackLegendLabelfieldLegendLabel
  • trackHeightfieldHeight
  • Update the structure of observations:
  • Before:

    {
      "geneId": "1234",
      "donorId": "5678"
    }
    
  • After:

    {
      "rowId": "1234",
      "columnId": "5678"
    }
    
  • Update events:
  • histogramMouseOverhistogram:hover
  • histogramClickhistogram:click
  • gridMouseOvergrid:cell:hover
  • gridClickgrid:cell:click
  • trackLegendMouseOverdescription:legend:hover
  • trackMouseOverdescription:cell:hover
  • trackClickdescription:cell:click
  • As the component update is still in progress, please feel free to create issues and provide feedback.

Development

  • Install Node ~18. Using NVM is recommended.

  • Install dependencies:

    npm install
    

Contribution guidelines

The project uses pre-commit.com hooks. Run brew install pre-commit && pre-commit install for automatic configuration.

Keywords

oncogrid

FAQs

Package last updated on 30 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts