Skip to content
Snippets Groups Projects
Commit 7730d7f5 authored by Maiykol's avatar Maiykol
Browse files

pass input network to backend when starting analysis

parent 33512b49
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@ import {
import html2canvas from 'html2canvas';
import {toast} from 'bulma-toast';
import {NetworkSettings} from '../../network-settings';
import { NetexControllerService } from 'src/app/services/netex-controller/netex-controller.service';
declare var vis: any;
......@@ -88,7 +89,7 @@ export class AnalysisPanelComponent implements OnInit, OnChanges {
public tableDrugScoreTooltip = '';
public tableProteinScoreTooltip = '';
constructor(private http: HttpClient, public analysis: AnalysisService) {
constructor(private http: HttpClient, public analysis: AnalysisService, public netex: NetexControllerService) {
}
async ngOnInit() {
......@@ -134,7 +135,8 @@ export class AnalysisPanelComponent implements OnInit, OnChanges {
}
if (this.task && this.task.info.done) {
const result = await this.http.get<any>(`${environment.backend}task_result/?token=${this.token}`).toPromise();
const result = await this.netex.getTaskResult(this.token)
console.log(result)
const nodeAttributes = result.nodeAttributes || {};
const isSeed: { [key: string]: boolean } = nodeAttributes.isSeed || {};
......
......@@ -23,6 +23,8 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges {
public show = false;
@Input()
public target: 'drug' | 'drug-target';
@Input()
public inputNetwork: {nodes: any, edges: any};
@Output()
public showChange = new EventEmitter<boolean>();
......@@ -99,12 +101,17 @@ export class LaunchAnalysisComponent implements OnInit, OnChanges {
}
public async startTask() {
console.log(this.analysis.getSelection());
const parameters: any = {
seeds: this.analysis.getSelection().map((item) => item.data.netexId),
};
parameters.target_or_drugs = this.target === 'drug' ? 'PPDr' : 'PPI';
parameters.target_or_drugs = this.target === 'drug' ? 'drug' : 'protein';
// pass network data to reconstruct network in analysis result to connect non-proteins to results
// drop interactions in nodes beforehand to no cause cyclic error, information is contained in edges
this.inputNetwork.nodes.forEach(node => {
delete node.interactions
});
parameters.input_network = this.inputNetwork;
if (this.algorithm === 'trustrank') {
parameters.damping_factor = this.trustrankDampingFactor;
......
......@@ -2,7 +2,8 @@
<app-launch-analysis [(show)]="showAnalysisDialog"
[target]="analysisDialogTarget">
[target]="analysisDialogTarget"
[inputNetwork]="{nodes:proteins, edges:edges}">
</app-launch-analysis>
<app-custom-proteins [(show)]="showCustomProteinsDialog" [visibleNodes]="currentViewNodes">
......
......@@ -216,15 +216,9 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
const network = JSON.parse(this.networkJSON);
// map data to nodes in backend
console.log('before')
console.log( this.myConfig.identifier)
console.log(network.nodes)
if (network.nodes.length) {
network.nodes = await this.netex.mapNodes(network.nodes, this.myConfig.identifier);
}
console.log('after')
console.log(network.nodes)
this.proteins = network.nodes;
this.edges = network.edges;
}
......@@ -277,7 +271,6 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
this.nodeData.nodes = new vis.DataSet(nodes);
this.nodeData.edges = new vis.DataSet(edges);
console.log(this.nodeData);
const container = this.networkEl.nativeElement;
const options = NetworkSettings.getOptions('main');
this.networkInternal = new vis.Network(container, this.nodeData, options);
......
......@@ -288,7 +288,6 @@ export class AnalysisService {
});
return;
}
const resp = await this.http.post<any>(`${environment.backend}task/`, {
algorithm,
target,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment