Skip to content
Snippets Groups Projects
config.ts 7.54 KiB
Newer Older
AndiMajore's avatar
AndiMajore committed
import { AlgorithmTarget, AlgorithmType, QuickAlgorithmType } from './interfaces';
// https://visjs.github.io/vis-network/docs/network/nodes.html
Michael Hartung's avatar
Michael Hartung committed
export interface NodeGroup {
  shape?: 'circle' | 'triangle' | 'star' | 'square' | 'image' | 'text' | 'ellipse' | 'box' | 'diamond' | 'dot';
  type?: string;
  image?: string;
Maiykol's avatar
Maiykol committed
  detailShowLabel?: boolean;
  font?: any;
  border?: any;
  highlight?: any;
  borderWidth?: number;
  borderWidthSelected?: number;
  shadow?: any;
Michael Hartung's avatar
Michael Hartung committed
}

export interface EdgeGroup {
Maiykol's avatar
Maiykol committed
  groupName: string;
Michael Hartung's avatar
Michael Hartung committed
  color: string;
  // see https://visjs.github.io/vis-network/docs/network/edges.html
  dashes?: false | Array<number>;
  shadow?: any;
Michael Hartung's avatar
Michael Hartung committed
}
export type Identifier = 'symbol' | 'uniprot' | 'ensg' | 'entrez';
AndiMajore's avatar
AndiMajore committed
export type InteractionDrugProteinDB = 'NeDRex' | 'DrugBank' | 'DrugCentral' | 'ChEMBL' | 'DGIdb';
export type InteractionProteinProteinDB = 'NeDRex' | 'BioGRID' | 'IID' | 'IntAct' | 'STRING' | 'APID';
AndiMajore's avatar
AndiMajore committed
export type IndicationDrugDisorderDB = 'NeDRex' | 'CTD' | 'DrugCentral' | 'DrugBank';
export type AssociatedProteinDisorderDB = 'NeDRex' | 'DisGeNET' | 'OMIM';
// TODO: should this be external or integrated in the backend?
export type InteractionDatabase = 'omnipath';

export interface IConfig {
  title: string;
  legendUrl: string;
  legendClass: string;
Michael Hartung's avatar
Michael Hartung committed
  legendPos: 'left' | 'right';
  taskTargetName: string;
  taskDrugName: string;
  showSidebar: false | 'left' | 'right';
Zakaria Louadi's avatar
Zakaria Louadi committed
  showOverview: boolean;
  showQuery: boolean;
Zakaria Louadi's avatar
Zakaria Louadi committed
  showItemSelector: boolean;
  showSimpleAnalysis: boolean;
  showAdvAnalysis: boolean;
  showTasks: boolean;
  showSelection: boolean;
  showNetworkMenu: false | 'left' | 'right';
AndiMajore's avatar
AndiMajore committed
  expandNetworkMenu: boolean;
  showNetworkMenuButtonExpression: boolean;
  showNetworkMenuButtonScreenshot: boolean;
  showNetworkMenuButtonExportGraphml: boolean;
  showNetworkMenuButtonAdjacentDrugs: boolean;
  showNetworkMenuButtonCenter: boolean;
  showConnectGenes: boolean;
  networkMenuButtonAdjacentDrugsLabel: string;
  showNetworkMenuButtonAdjacentDisordersProteins: boolean;
  networkMenuButtonAdjacentDisordersProteinsLabel: string;
  showNetworkMenuButtonAdjacentDisordersDrugs: boolean;
  networkMenuButtonAdjacentDisordersDrugsLabel: string;
  showNetworkMenuButtonAnimation: boolean;
  networkMenuButtonAnimationLabel: string;
Michael Hartung's avatar
Michael Hartung committed
  showLegend: boolean;
  showLegendNodes: boolean;
  showLegendEdges: boolean;
Julian Matschinske's avatar
Julian Matschinske committed
  nodeGroups: { [key: string]: NodeGroup };
  edgeGroups: { [key: string]: EdgeGroup };
Hartung, Michael's avatar
Hartung, Michael committed
  selfReferences: boolean;
  customEdges: {default: boolean, selectable: boolean};
  interactionDrugProtein: InteractionDrugProteinDB;
  interactionProteinProtein: InteractionProteinProteinDB;
  indicationDrugDisorder: IndicationDrugDisorderDB;
  associatedProteinDisorder: AssociatedProteinDisorderDB;
Michael Hartung's avatar
Michael Hartung committed
  autofillEdges: boolean;
  interactions?: InteractionDatabase;
  physicsOn?: boolean;
AndiMajore's avatar
AndiMajore committed
  licensedDatasets?: boolean;
  identifier?: Identifier;
  nodeShadow?: boolean;
  edgeShadow?: boolean;
AndiMajore's avatar
AndiMajore committed
  algorithms: { [key in AlgorithmTarget]: Array<AlgorithmType | QuickAlgorithmType> };

const defaultNodeGroup: NodeGroup = {
      // this default group is used for default node group values
      // and is fallback in case user does not provide any nodeGroup
      groupName: 'Default Node Group',
      color: {
        border: '#FFFF00',
        background: '#FFFF00',
        highlight: {
          border: '#FF0000',
          background: '#FF0000'
        },
      },
      shape: 'triangle',
      type: 'default type',
      detailShowLabel: false,
      font: {
        color: '#000000',
        size: 14,
        face: 'arial',
        background: undefined,
        strokeWidth: 0,
        strokeColor: '#ffffff',
        align: 'center',
        bold: false,
        ital: false,
        boldital: false,
        mono: false,
      },
      borderWidth: 1,
      borderWidthSelected: 2
    };
const connectorNodeGroup: NodeGroup = JSON.parse(JSON.stringify(defaultNodeGroup));
connectorNodeGroup.groupName = 'Connector Node';

// @ts-ignore
Maiykol's avatar
Maiykol committed
/**
 * Provide default values
 */
export const defaultConfig: IConfig = {
Hartung, Michael's avatar
Hartung, Michael committed
  title: 'Drugst.One',
AndiMajore's avatar
AndiMajore committed
  legendUrl: '',
  legendClass: 'legend',
Michael Hartung's avatar
Michael Hartung committed
  legendPos: 'left',
Michael Hartung's avatar
Michael Hartung committed
  taskTargetName: 'Drug Target Search',
  taskDrugName: 'Drug Search',
AndiMajore's avatar
AndiMajore committed
  showSidebar: 'left',
Michael Hartung's avatar
Michael Hartung committed
  showLegendNodes: true,
  showLegendEdges: true,
Zakaria Louadi's avatar
Zakaria Louadi committed
  showOverview: true,
  showQuery: true,
Zakaria Louadi's avatar
Zakaria Louadi committed
  showItemSelector: true,
  showSimpleAnalysis: true,
Zakaria Louadi's avatar
Zakaria Louadi committed
  showAdvAnalysis: true,
  showSelection: true,
Julian Matschinske's avatar
Julian Matschinske committed
  showTasks: true,
  showNetworkMenu: 'right',
Michael Hartung's avatar
Michael Hartung committed
  showLegend: true,
Hartung, Michael's avatar
Hartung, Michael committed
  expandNetworkMenu: true,
  showNetworkMenuButtonExpression: true,
  showNetworkMenuButtonScreenshot: true,
  showNetworkMenuButtonExportGraphml: true,
  showNetworkMenuButtonAdjacentDrugs: true,
  showNetworkMenuButtonCenter: true,
AndiMajore's avatar
AndiMajore committed
  showNetworkMenuButtonAnimation: true,

  showNetworkMenuButtonAdjacentDisordersProteins: true,
  showNetworkMenuButtonAdjacentDisordersDrugs: true,
  showConnectGenes: true,
  networkMenuButtonAdjacentDrugsLabel: 'Drugs',
  networkMenuButtonAdjacentDisordersProteinsLabel: 'Disorders (protein)',
  networkMenuButtonAdjacentDisordersDrugsLabel: 'Disorders (drug)',
  networkMenuButtonAnimationLabel: 'Animation',
AndiMajore's avatar
AndiMajore committed
  selfReferences: false,
Hartung, Michael's avatar
Hartung, Michael committed
  customEdges: {default: true, selectable: true},
  interactionDrugProtein: 'NeDRex',
  interactionProteinProtein: 'NeDRex',
  indicationDrugDisorder: 'NeDRex',
AndiMajore's avatar
AndiMajore committed
  associatedProteinDisorder: 'NeDRex',
Michael Hartung's avatar
Michael Hartung committed
  autofillEdges: true,
  physicsOn: false,
AndiMajore's avatar
AndiMajore committed
  nodeShadow: true,
  edgeShadow: true,
  licensedDatasets: false,
AndiMajore's avatar
AndiMajore committed
    drug: ['trustrank', 'closeness', 'degree', 'proximity'],
    'drug-target': ['trustrank', 'multisteiner', 'keypathwayminer', 'degree', 'closeness', 'betweenness']
Julian Matschinske's avatar
Julian Matschinske committed
  nodeGroups: {
    // all NodeGroups but the default group must be set, if not provided by the user, they will be taken from here
    // IMPORTANT: node color must be hexacode!
    default: defaultNodeGroup,
    foundNode: {
      groupName: 'Found Nodes',
        background: '#F12590',
        highlight: {
          border: '#F12590',
          background: '#F12590'
        },
      },
      shape: 'circle',
      type: 'default node type',
Julian Matschinske's avatar
Julian Matschinske committed
    },
    connectorNode: connectorNodeGroup,
    foundDrug: {
      groupName: 'Drugs',
Michael Hartung's avatar
Michael Hartung committed
        background: '#F12590',
        highlight: {
          border: '#F12590',
          background: '#F12590'
        },
      },
      shape: 'diamond',
Maiykol's avatar
Maiykol committed
      type: 'default drug type',
    defaultDisorder: {
      groupName: 'Disorders',
      color: {
        border: '#ffa62f',
        background: '#ffa62f',
        highlight: {
          border: '#ffa62f',
          background: '#ffa62f'
        },
      },
      shape: 'triangle',
      type: 'default disorder type',
    },
    seedNode: {
      groupName: 'Seed Nodes',
      shape: 'triangle',
      type: 'seed',
      borderWidth: 3,
      borderWidthSelected: 4,
      color: {
Julian Matschinske's avatar
Julian Matschinske committed
    }
  },
  edgeGroups: {
    default: {
Maiykol's avatar
Maiykol committed
      // this default group is used for default edge group values
      groupName: 'Default Edge Group',
      color: 'black',
Maiykol's avatar
Maiykol committed
      dashes: false