<commit_before>/*jslint node: true */
/*jshint laxbreak: true */
/*jshint laxcomma: true */
"use strict";

var d3 = require("d3");
var _ = require("underscore");
var $ = require('jquery');
var Evidence = require('./Evidence');
var Constants = require("./Constants");
var LegendDialog = require("./VariantLegendDialog");

var populated = false;
var defaultFilterCaseDisease = {
    label: 'Disease (reviewed)',
    on: true,
    properties: {
        'association': function(variant){
            return _.some(variant.association, function(association){
                return association.disease === true;
            });
        }
    },
    color: '#990000'
};
var defaultFilterCasePrediction = {
    label: ['Predicted deleterious', 'Predicted benign'],
    on: true,
    properties: {
        'alternativeSequence': /[^*]/,
        'sourceType': [Evidence.variantSourceType.lss, null],
        'externalData': function(variant){
            if (!variant.sourceType) {
                return _.some(variant.externalData, function (data) {
                    return (data.polyphenPrediction && (data.polyphenPrediction !== '-')) ||
                        (data.siftPrediction && (data.siftPrediction !== '-'));
                });
            } else {
                return true;
            }
        }
    },
    colorRange: ['#ff3300','#009900']
};
var defaultFilterCaseNonDisease = {
    label: 'Non-disease (reviewed)',
    on: true,
    properties: {
        'association': function(variant){
            return _.every(variant.association, function(association){
                    return association.disease !== true;
                }) || (!variant.association);
        },
        'sourceType': [
            Evidence.variantSourceType.uniprot,
            Evidence.variantSourceType.mixed
        ]
    },
    color: '#99cc00'
};
var defaultFilterCaseOthers = {
    label: 'Init, stop loss or gain',
    on: true,
    properties: {
        'alternativeSequence': '*'
    },
    color: '#0033cc'
};
var defaultFilterConsequence = {
    label: 'Filter consequence',
    cases: []
};

var defaultFilterCaseUP = {
    label: 'UniProt reviewed',
    on: true,
    properties: {
        'sourceType': [
            Evidence.variantSourceType.uniprot,
            Evidence.variantSourceType.mixed
        ]
    },
    color: 'grey'
};
var defaultFilterCaseLSS = {
    label: 'Large scale studies',
    on: true,
    properties: {
        'sourceType': [
            Evidence.variantSourceType.lss,
            Evidence.variantSourceType.mixed
        ]
    },
    color: 'grey'
};
var defaultFilterSource = {
    label: 'Filter data source',<commit_msg>Use defined constants for colors rather than hexa.<commit_after>/*jslint node: true */
/*jshint laxbreak: true */
/*jshint laxcomma: true */
"use strict";

var d3 = require("d3");
var _ = require("underscore");
var $ = require('jquery');
var Evidence = require('./Evidence');
var Constants = require("./Constants");
var LegendDialog = require("./VariantLegendDialog");

var populated = false;
var defaultFilterCaseDisease = {
    label: 'Disease (reviewed)',
    on: true,
    properties: {
        'association': function(variant){
            return _.some(variant.association, function(association){
                return association.disease === true;
            });
        }
    },
    color: LegendDialog.UPDiseaseColor
};
var defaultFilterCasePrediction = {
    label: ['Predicted deleterious', 'Predicted benign'],
    on: true,
    properties: {
        'alternativeSequence': /[^*]/,
        'sourceType': [Evidence.variantSourceType.lss, null],
        'externalData': function(variant){
            if (!variant.sourceType) {
                return _.some(variant.externalData, function (data) {
                    return (data.polyphenPrediction && (data.polyphenPrediction !== '-')) ||
                        (data.siftPrediction && (data.siftPrediction !== '-'));
                });
            } else {
                return true;
            }
        }
    },
    colorRange: [LegendDialog.deleteriousColor,LegendDialog.benignColor]
};
var defaultFilterCaseNonDisease = {
    label: 'Non-disease (reviewed)',
    on: true,
    properties: {
        'association': function(variant){
            return _.every(variant.association, function(association){
                    return association.disease !== true;
                }) || (!variant.association);
        },
        'sourceType': [
            Evidence.variantSourceType.uniprot,
            Evidence.variantSourceType.mixed
        ]
    },
    color: LegendDialog.UPNonDiseaseColor
};
var defaultFilterCaseOthers = {
    label: 'Init, stop loss or gain',
    on: true,
    properties: {
        'alternativeSequence': '*'
    },
    color: LegendDialog.othersColor
};
var defaultFilterConsequence = {
    label: 'Filter consequence',
    cases: []
};

var defaultFilterCaseUP = {
    label: 'UniProt reviewed',
    on: true,
    properties: {
        'sourceType': [
            Evidence.variantSourceType.uniprot,
            Evidence.variantSourceType.mixed
        ]
    },
    color: 'grey'
};
var defaultFilterCaseLSS = {
    label: 'Large scale studies',
    on: true,
    properties: {
        'sourceType': [
            Evidence.variantSourceType.lss,
            Evidence.variantSourceType.mixed
        ]
    },
    color: 'grey'
};
var defaultFilterSource = {
    label: 'Filter data source',
{'fraction_non_alphanumeric': 0.13366336633663367, 'fraction_numerical': 0.005133846718005134, 'mean_word_length': 2.3020581113801453, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '328901', 'n_tokens_mistral': 1602, 'n_tokens_neox': 1503, 'n_words': 316}