<commit_before><dom-module id="jso-variant-effect-grid">
    <style is="custom-style" include="iron-flex iron-flex-reverse iron-flex-alignment iron-flex-factors iron-positioning">
        :host {
            display: block;
            position: relative;
            width: 100%;
        }

        jso-table {
            box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.2);
            overflow-y: hidden;
        }

        jso-table::shadow {
            font-size: 11px;
        }

        jso-table::shadow .table-row {
            height: 25px;
        }

        jso-table::shadow .table-header-field > .name.jso-table {
            padding: 4px 0;
        }

    </style>
    <template>
        <jso-table id="table" hidden$="{{isEmpty}}"
                   on-rowclick="handleRowClick"></jso-table>
        <div hidden$="{{!isEmpty}}" style="padding:20px 50px;">
            No effect found.
        </div>
    </template>
</dom-module>

<script>
    Polymer({
        is: 'jso-variant-effect-grid',
        properties: {
            row: {
                type: Object,
                observer: 'rowChanged'
            },
            isEmpty: {
                value: false,
                type: Boolean
            }
        },
        ready: function () {
            this.$.table.columns = this._columns;
        },
        _columns: [
            {
                name: "geneName",
                title: "Gene Name"
            },
            {
                name: "ensemblGeneId",
                title: "Ensembl Gene Id",
                cellTemplate: "ensemblGeneIdTemplate",
                width: 150
            },
            {
                name: "ensemblTranscriptId",
                title: "Ensembl Transcript Id",
                cellTemplate: 'ensemblTranscriptIdTemplate',
                width: 150
            },
            {
                name: "so",
                title: "Conseq. type",
                formula: function (row) {
                    var aux = {};
                    if (row.soName && row.soAccession) {

                        aux.soName = row.soName;
                        aux.soAccession = row.soAccession;
                    }
                    return aux.soName;
                },
                width: 300
            },
            {
                name: "relativePosition",
                title: "Relative Position"
            },
            {
                name: "codon",
                title: "Codon",
                width: 60
            },
            {
                name: "strand",
                title: "Strand"
            },
            {
                name: "biotype",
                title: "Biotype"
            },
            {
                name: "cDnaPosition",
                title: "cDna Position",
                width: 80
            },
            {
                name: "cdsPosition",
                title: "cds Position",
                width: 80
            },
            {
                name: "aaPosition",
                title: "AA Position",
                width: 80
            },
            {
                name: "aaChange",
                title: "AA Change",
                width: 80

            },
            {
                name: "sift",
                title: "Sift",
                formula: function (row) {
                    var pss = row.proteinSubstitutionScores;

                    if (pss != null && pss.length > 0) {
                        for (var i = 0; i < pss.length; i++) {
                            var elem = pss[i];
                            if (elem.source.toLowerCase() == "sift") {
                                return elem.score;
                            }
                        }
                    }
                    return "";
                },
                width: 80
            },
            {
                name: "polyphen", title: "Polyphen",
                formula: function (row) {
                    var pss = row.proteinSubstitutionScores;

                    if (pss != null && pss.length > 0) {
                        for (var i = 0; i < pss.length; i++) {
                            var elem = pss[i];
                            if (elem.source.toLowerCase() == "polyphen") {
                                return elem.score;
                            }
                        }
                    }
                    return "";
                },
                width: 100
            }
        ],

        rowChanged: function (neo, old) {
            var me = this;
            this.$.table.currentPage = 1;
            if (neo) {
                var variant = neo.chromosome + ":" + neo.start + ":" + neo.reference + ":" + neo.alternate;
                CellBaseManager.get({
//                    host: 'http://wwwdev.ebi.ac.uk/cellbase/webservices/rest',
                    // version: 'v4',
                    species: 'hsapiens',
                    category: 'genomic',
                    subCategory: 'variant',
                    resource: 'annotation',
                    query: variant,
                    async: false,
                    success: function (response) {
                        try {
                            me.$.table.data = me.parseFunction(response.response[0].result[0].consequenceTypes);
                            me.isEmpty = (me.$.table.data.length > 0) ? false : true;
                        } catch (e) {
                            me.$.table.data = [];
                            me.isEmpty = true;
                        }
                    }
                });
            }
        },
        parseFunction: function (data) {
            var res = [];

            for (var i = 0; i < data.length; i++) {
                var elem = data[i];

                for (var j = 0; j < elem.sequenceOntologyTerms.length; j++) {
                    var soTerm = elem.sequenceOntologyTerms[j];
                    var aux = Utils.clone(elem);
                    aux.soName = soTerm.name;
                    aux.soAccession = soTerm.accession;

                    res.push(aux);
                }
            }
            return res;
        }
    });
</script>
<commit_msg>Repaired names<commit_after><dom-module id="jso-variant-effect-grid">
    <style is="custom-style" include="iron-flex iron-flex-reverse iron-flex-alignment iron-flex-factors iron-positioning">
        :host {
            display: block;
            position: relative;
            width: 100%;
        }

        jso-table {
            box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.2);
            overflow-y: hidden;
        }

        jso-table::shadow {
            font-size: 11px;
        }

        jso-table::shadow .table-row {
            height: 25px;
        }

        jso-table::shadow .table-header-field > .name.jso-table {
            padding: 4px 0;
        }
    </style>
    <template>
        <jso-table id="table" hidden$="{{isEmpty}}" on-rowclick="handleRowClick"></jso-table>
        <div hidden$="{{!isEmpty}}" style="padding:20px 50px;">
            No effect found.
        </div>
    </template>
</dom-module>

<script>
    Polymer({
        is: 'jso-variant-effect-grid',
        properties: {
            row: {
                type: Object,
                observer: 'rowChanged'
            },
            isEmpty: {
                value: false,
                type: Boolean
            }
        },
        ready: function() {
            this.$.table.columns = this._columns;
        },
        _columns: [{
                name: "geneName",
                title: "Gene Name",
                defaultValue: '.'
            }, {
                name: "ensemblGeneId",
                title: "Ensembl Gene Id",
                cellTemplate: "ensemblGeneIdTemplate",
                width: 150,
                defaultValue: '.'
            }, {
                name: "ensemblTranscriptId",
                title: "Ensembl Transcript Id",
                cellTemplate: 'ensemblTranscriptIdTemplate',
                width: 150,
                defaultValue: '.'
            }, {
                name: "so",
                title: "Conseq. type",
                formula: function(row) {
                    var aux = {};
                    if (row.soName && row.soAccession) {

                        aux.soName = row.soName;
                        aux.soAccession = row.soAccession;
                    }
                    return aux.soName;
                },
                width: 300
            },
            // {
            //     name: "relativePosition",
            //     title: "Relative Position"
            // },
            {
                name: "codon",
                title: "Codon",
                width: 60,
                defaultValue: '.'
            }, {
                name: "strand",
                title: "Strand",
                defaultValue: '.'
            }, {
                name: "biotype",
                title: "Biotype",
                defaultValue: '.'
            }, {
                name: "cdnaPosition",
                title: "cDna Position",
                width: 80,
                defaultValue: '.'
            }, {
                name: "cdsPosition",
                title: "cds Position",
                width: 80,
                defaultValue: '.'
            }, {
                name: "aaPosition",
                title: "AA Position",
                width: 80,
                formula: function(row) {
                    try {
                        var pva = row.proteinVariantAnnotation;
                        var res = (pva.position) ? pva.position : ".";
                        return res;
                    } catch (e) {
                        return ".";
                    }
                }
            }, {
                name: "aaChange",
                title: "AA Change",
                width: 80,
                formula: function(row) {
                    try {
                        var pva = row.proteinVariantAnnotation;
                        var res = pva.reference + " > " + pva.alternate;
                        return res;
                    } catch (e) {
                        return ".";
                    }
                }

            }, {
                name: "sift",
                title: "Sift",
                formula: function(row) {
                    var pva = row.proteinVariantAnnotation;
                    if (pva != null && Object.keys(pva).length > 0) {
                        var pss = pva.substitutionScores;
                        if (pss != null && pss.length > 0) {
                            for (var i = 0; i < pss.length; i++) {
                                var elem = pss[i];
                                if (elem.source.toLowerCase() == "sift") {
                                    return elem.score;
                                }
                            }
                        }
                    }
                    return ".";
                },
                width: 80
            }, {
                name: "polyphen",
                title: "Polyphen",
                formula: function(row) {
                    var pva = row.proteinVariantAnnotation;
                    if (pva != null && Object.keys(pva).length> 0) {
                        var pss = pva.substitutionScores;
                        if (pss != null && pss.length > 0) {
                            for (var i = 0; i < pss.length; i++) {
                                var elem = pss[i];
                                if (elem.source.toLowerCase() == "polyphen") {
                                    return elem.score;
                                }
                            }
                        }
                    }

                    return ".";
                },
                width: 100
            }
        ],

        rowChanged: function(neo, old) {
            var me = this;
            this.$.table.currentPage = 1;
            if (neo) {
                var variant = neo.chromosome + ":" + neo.start + ":" + neo.reference + ":" + neo.alternate;
                CellBaseManager.get({
                    //                    host: 'http://wwwdev.ebi.ac.uk/cellbase/webservices/rest',
                    // version: 'v4',
                    species: 'hsapiens',
                    category: 'genomic',
                    subCategory: 'variant',
                    resource: 'annotation',
                    query: variant,
                    async: false,
                    success: function(response) {
                        try {
                            me.$.table.data = me.parseFunction(response.response[0].result[0].consequenceTypes);
                            me.isEmpty = (me.$.table.data.length > 0) ? false : true;
                        } catch (e) {
                            me.$.table.data = [];
                            me.isEmpty = true;
                        }
                    }
                });
            }
        },
        parseFunction: function(data) {
            var res = [];

            for (var i = 0; i < data.length; i++) {
                var elem = data[i];

                for (var j = 0; j < elem.sequenceOntologyTerms.length; j++) {
                    var soTerm = elem.sequenceOntologyTerms[j];
                    var aux = Utils.clone(elem);
                    aux.soName = soTerm.name;
                    aux.soAccession = soTerm.accession;

                    res.push(aux);
                }
            }
            return res;
        }
    });
</script>

{'fraction_non_alphanumeric': 0.11060042314146057, 'fraction_numerical': 0.008462829211351865, 'mean_word_length': 0.8245707440436577, 'pattern_counts': {'":': 6, '<': 35, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4551612', 'n_tokens_mistral': 3689, 'n_tokens_neox': 3293, 'n_words': 693}