globalSettingsChanged()

in client/client/modules/render/tracks/bam/index.js [341:427]


    globalSettingsChanged(state) {
        super.globalSettingsChanged(state);
        let shouldReloadData = this._bamRenderer.globalSettingsChanged(state)
            || this.cacheService._coverageTransformer.alleleFrequencyThresholdBam !== state.alleleFrequencyThresholdBam;
        this.cacheService._coverageTransformer.alleleFrequencyThresholdBam = state.alleleFrequencyThresholdBam;

        const bamSettings = {
            chromosomeId: this.config.chromosomeId,
            file: this.config.openByUrl ? this.config.bioDataItemId : undefined,
            id: this.config.openByUrl ? undefined : this.config.id,
            index: this.config.openByUrl ? this.config.indexPath : undefined,
            projectId: this.config.project ? this.config.project.id : undefined
        };
        const maxBpCount = 10000;
        const minBpCount = 50;
        const bamRenderSettings = Object.assign({
            filterFailedVendorChecks: true,
            filterPcrOpticalDuplicates: true,
            filterSecondaryAlignments: false,
            filterSupplementaryAlignments: false,
            isSoftClipping: false,
            maxBpCount,
            minBpCount,
            sortMode: sortTypes.sortByStartLocation
        }, this.bamRenderSettings);

        bamRenderSettings.viewAsPairs = this.state.viewAsPairs;

        this.shouldDisplayAlignmentsCoverageTooltips = state.displayAlignmentsCoverageTooltips;
        if (state.isDownSampling) {
            shouldReloadData = shouldReloadData || bamSettings.count !== state.maxReadsCount ||
                bamSettings.frame !== state.maxFrameSize || !this.downsampled;
            bamSettings.count = state.maxReadsCount;
            bamSettings.frame = state.maxFrameSize;
            this.downsampled = true;
        }
        else {
            shouldReloadData = shouldReloadData || this.downsampled;
            this.downsampled = false;
        }
        shouldReloadData = shouldReloadData ||
            bamRenderSettings.isSoftClipping !== state.showSoftClippedBase ||
            bamRenderSettings.filterFailedVendorChecks !== state.filterReads.failedVendorChecks ||
            bamRenderSettings.filterPcrOpticalDuplicates !== state.filterReads.pcrOpticalDuplicates ||
            bamRenderSettings.filterSecondaryAlignments !== state.filterReads.secondaryAlignments ||
            bamRenderSettings.filterSupplementaryAlignments !== state.filterReads.supplementaryAlignments ||
            bamRenderSettings.maxBpCount !== state.maxBpCount ||
            bamRenderSettings.minBpCount !== state.minBpCount;
        bamRenderSettings.isSoftClipping = state.showSoftClippedBase;
        bamRenderSettings.filterFailedVendorChecks = state.filterReads.failedVendorChecks;
        bamRenderSettings.filterPcrOpticalDuplicates = state.filterReads.pcrOpticalDuplicates;
        bamRenderSettings.filterSecondaryAlignments = state.filterReads.secondaryAlignments;
        bamRenderSettings.filterSupplementaryAlignments = state.filterReads.supplementaryAlignments;
        bamRenderSettings.maxBpCount = state.maxBpCount;
        bamRenderSettings.minBpCount = state.minBpCount;

        this.shouldDisplayCenterLine = state.showCenterLine;

        this.state = Object.assign(
            this.state,
            {
                softClip: bamRenderSettings.isSoftClipping,
                spliceJunctionsFiltering: state.spliceJunctionsFiltering
                    ? state.spliceJunctionsCoverageThreshold
                    : 0
            }
        );
        this.bamRequestSettings = bamSettings;
        this.bamRenderSettings = bamRenderSettings;

        if (shouldReloadData) {
            this.cacheService.properties = {
                maxAlignmentsRange: this._bamRenderer.maximumAlignmentsRange,
                maxCoverageRange: this._bamRenderer.maximumCoverageRange,
                rendering: bamRenderSettings,
                request: this.bamRequestSettings
            };
        }

        Promise.resolve().then(async () => {
            if (shouldReloadData) {
                await this.updateCache();
            }
            this._flags.renderFeaturesChanged = true;
            this.requestRenderRefresh();
        });
    }