<commit_before>import * as React from 'react';
import * as _ from 'lodash';
import { If, Then, Else } from 'react-if';
import IFrameLoader from "../../../shared/components/iframeLoader/IFrameLoader";
import {observer } from "mobx-react";
import {observable, computed} from "mobx";
import AppConfig from "appConfig";
import {Gene, MolecularProfile} from "../../../shared/api/generated/CBioPortalAPI";
import {trimTrailingSlash} from "../../../shared/api/urls";

interface NetworkParams {
    genes:Gene
}

interface INetworkTabParams {
    genes:Gene[];
    profileIds:string[];
    cancerStudyId:string;
    zScoreThreshold:number;
    caseIdsKey:string;
    caseSetId:string;
    sampleIds:string[];
}

@observer
export default class Network extends React.Component<INetworkTabParams, {}> {

    @observable baseUrl = AppConfig.frontendUrl;

    @computed get url(){

        var networkParams = {
            "gene_list": this.props.genes.map((gene)=>gene.hugoGeneSymbol).join(" "),
            "genetic_profile_ids": this.props.profileIds.join(" "),
            "cancer_study_id": this.props.cancerStudyId,
            "Z_SCORE_THRESHOLD": this.props.zScoreThreshold,
            "xdebug": "0",
            "netsrc": "cgds",
            "linkers": "50",
            "netsize": "large",
            "diffusion": "0",
            "case_ids": this.props.sampleIds.join(" ")

        };




        let path = (/\/\/localhost|127\.0\.0\.1/.test(AppConfig.frontendUrl!)) ?
            AppConfig.frontendUrl! :
            `//${AppConfig.baseUrl!}`;


        // cloodge to get around broken network tab on public portal due to strange MSK IT filtering
        if ((AppConfig.apiRoot!.includes("www.cbioportal.org") || 
             AppConfig.apiRoot!.includes("k8s.cbioportal.org") // TODO: remove, hack for aws testing
             ) && (window as any).location.hostname.includes("www.cbioportal.org")) {
            path = "//cbioportal-network-tab.herokuapp.com";
        }

        const strParams = encodeURIComponent(JSON.stringify(networkParams));
        return `${trimTrailingSlash(path)}/reactapp/network/network.htm?${AppConfig.serverConfig.app_version}&apiHost=${encodeURIComponent(AppConfig.apiRoot!.replace(/^http[s]?:\/\//,''))}#${strParams}`;
    }

    render(){

        return <IFrameLoader iframeId={"networkFrame"} url={this.url} height={800} />;

    }

};<commit_msg>On www.cbioportal.org use network html from war<commit_after>import * as React from 'react';
import * as _ from 'lodash';
import { If, Then, Else } from 'react-if';
import IFrameLoader from "../../../shared/components/iframeLoader/IFrameLoader";
import {observer } from "mobx-react";
import {observable, computed} from "mobx";
import AppConfig from "appConfig";
import {Gene, MolecularProfile} from "../../../shared/api/generated/CBioPortalAPI";
import {trimTrailingSlash} from "../../../shared/api/urls";

interface NetworkParams {
    genes:Gene
}

interface INetworkTabParams {
    genes:Gene[];
    profileIds:string[];
    cancerStudyId:string;
    zScoreThreshold:number;
    caseIdsKey:string;
    caseSetId:string;
    sampleIds:string[];
}

@observer
export default class Network extends React.Component<INetworkTabParams, {}> {

    @observable baseUrl = AppConfig.frontendUrl;

    @computed get url(){

        var networkParams = {
            "gene_list": this.props.genes.map((gene)=>gene.hugoGeneSymbol).join(" "),
            "genetic_profile_ids": this.props.profileIds.join(" "),
            "cancer_study_id": this.props.cancerStudyId,
            "Z_SCORE_THRESHOLD": this.props.zScoreThreshold,
            "xdebug": "0",
            "netsrc": "cgds",
            "linkers": "50",
            "netsize": "large",
            "diffusion": "0",
            "case_ids": this.props.sampleIds.join(" ")

        };

        let path = (/\/\/localhost|127\.0\.0\.1/.test(AppConfig.frontendUrl!)) ?
            AppConfig.frontendUrl! :
            `//${AppConfig.baseUrl!}`;

        const strParams = encodeURIComponent(JSON.stringify(networkParams));
        return `${trimTrailingSlash(path)}/reactapp/network/network.htm?${AppConfig.serverConfig.app_version}&apiHost=${encodeURIComponent(AppConfig.apiRoot!.replace(/^http[s]?:\/\//,''))}#${strParams}`;
    }

    render(){

        return <IFrameLoader iframeId={"networkFrame"} url={this.url} height={800} />;

    }

};
{'fraction_non_alphanumeric': 0.1605389358300982, 'fraction_numerical': 0.006165791276547157, 'mean_word_length': 3.018348623853211, 'pattern_counts': {'":': 20, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6190020', 'n_tokens_mistral': 1418, 'n_tokens_neox': 1354, 'n_words': 244}