Newer
Older

Hartung, Michael
committed
ctxRenderer?: any;
label: string;
drugstoneId?: Array<string> | string;
drugstoneType: NodeType;
drugId?: string;
Maiykol
committed
ensg?: Array<string>;
entrez?: Array<string>;
proteinName?: Array<string>;
color?: string | any; // mostly any, but vis js allows detail settings
image?: string;
state?: {hover: boolean, selected: boolean};
borderWidth: number;
borderWidthSelected: number;
Michael Hartung
committed
opacity?: number;
font: {
color: string;
size: number;
}
export interface NodeData {
nodes: any;
edges: any;
}
export interface NetworkData {
nodes: any[],
edges: NetworkEdge[]
}
export type NodeType = 'protein' | 'drug' | 'disorder' | 'other'
export type NetworkType = 'explorer' | 'analysis'
export type LegendContext = 'explorer' | 'adjacentDrugs' | 'drug' | 'drugTarget' | 'seeds' | 'adjacentDisorders';
export type NodeAttributeMap = { string: number } | {};
export interface NetexInteraction {
dataset: string;
proteinA: string;
proteinB: string;
}
label?: string;
// custom attributes by user
// [key: string]: string | number | boolean;
export interface NetworkEdge {
from: string;
to: string;
label: string;
export type AlgorithmTarget = 'drug' | 'drug-target'
export interface Task {
token: string;
info: {
algorithm: AlgorithmType | QuickAlgorithmType;
parameters?: { [key: string]: any };
workerId?: string;
jobId?: string;
progress: number;
status: string;
createdAt: string;
startedAt: string;
finishedAt: string;
done: boolean;
failed: boolean;
};
stats: {
queuePosition: number;
queueLength: number;
};
}
export function getProteinNodeId(protein: Node) {
export function getProteinBackendId(protein: Node) {
return protein.id;
export function getNodeIdsFromI(pvi: NodeInteraction) {
from: `p_${pvi.from}`,
to: `p_${pvi.to}`,
export function getNodeIdsFromPPI(edge: NetworkEdge, wrappers: { [key: string]: Wrapper }) {
from: wrappers[edge.from].id,
to: wrappers[edge.to].id,
};
}
export function getNodeIdsFromPDI(edge: NetworkEdge) {
return {
from: `${edge.from}`,
to: `${edge.to}`,
};
}
export function getDrugNodeId(drug: Drug) {
/**
* Returns backend_id of Drug object
*/
// export function getDisorderNodeId(disorder: Disorder) {
// /**
// * Returns backend_id of Drug object
// */
export function getNodeId(node: Node) {
/**
* Returns backend_id of Gene object
*/
// if ('drugstoneId' in node) {
// return node['drugstoneId']
Michael Hartung
committed
// } else {
// return node.id
// }
return node.id
}
export function getNetworkId(node: Node) {
/**
* Returns ID of a network node
*/
export function getId(gene: Node) {
/**
* Returns the network node id based on a given gene
*/
return `${gene.id}`;
}
export function getWrapperFromNode(node: Node): Wrapper {
/**
* Constructs wrapper interface for gene
*/
// if node does not have property group, it was custom node from user
node.group = node.group ? node.group : 'default';
node.label = node.label ? node.label : node.id
id: node.id,
data: node,
export type EdgeType = 'protein-protein' | 'protein-drug';
id: string;
data: {
id: string;
label: string;
symbol?: Array<string>;
drugstoneId?: Array<string> | string;
drugstoneType: NodeType,
Maiykol
committed
ensg?: Array<string>;
entrez?: Array<string>;
shape?: string;
color?: string;
interactions?: any;
group?: string;
AndiMajore
committed
_group?: string;
proteinName?: Array<string>;
x?: number;
y?: number;
drugId?: string;
disorderId?: string;
icd10?: string[];
status?: 'approved' | 'investigational';
inTrial?: boolean;
inLiterature?: boolean;
trialLinks?: string[];
label: string;
export interface Dataset {
label: string;
strains: string;
hostTarget: string;
method: string;
source: Array<string> | null;
year: number;
export type AlgorithmType =
'trustrank'
| 'keypathwayminer'
| 'multisteiner'
| 'closeness'
| 'degree'
| 'proximity'
| 'betweenness';
export type QuickAlgorithmType = 'quick' | 'super' | 'connect' | 'connectSelected';
export interface Algorithm {
slug: AlgorithmType | QuickAlgorithmType;
name: string;
}