<commit_before>// import * as _ from 'underscore';
import Backbone from "backbone";
// import * as $ from "jquery";

export const PepInputView = Backbone.View.extend({

    events: {
        "input": "contentChanged",
        //"keyup": "contentChanged",
    },

    initialize: function () {
        this.listenTo(this.model, 'changed:data', this.render);
    },

    contentChanged: function (e) {
        let pepStrs = this.el.value.split(";");

        let peptides = [];
        let linkSites = [];

        for (let i=0; i < pepStrs.length; i++) {

            if (pepStrs[i] !== '') {
                let firstChar = pepStrs[i][0];
                if (firstChar === firstChar.toLowerCase()) {
                    alert('peptide sequence must start with an amino acid.');
                    return;
                }
            }

            let pep_noMods = pepStrs[i].replace(/([^#0-9])([^A-Z#]+)/g, '$1');

            // linkSite
            let cl_re = /#([0-9]+)?/g;
            while ((match = cl_re.exec(pep_noMods)) != null) {
                let clIndex = match[1] === undefined ? 0 : match[1];
                let linkSite = {'id': clIndex, 'peptideId': i, 'linkSite': match.index - 1};<commit_msg>undeclared variable fix<commit_after>// import * as _ from 'underscore';
import Backbone from "backbone";
// import * as $ from "jquery";

export const PepInputView = Backbone.View.extend({

    events: {
        "input": "contentChanged",
        //"keyup": "contentChanged",
    },

    initialize: function () {
        this.listenTo(this.model, 'changed:data', this.render);
    },

    contentChanged: function (e) {
        let pepStrs = this.el.value.split(";");

        let peptides = [];
        let linkSites = [];

        for (let i=0; i < pepStrs.length; i++) {

            if (pepStrs[i] !== '') {
                let firstChar = pepStrs[i][0];
                if (firstChar === firstChar.toLowerCase()) {
                    alert('peptide sequence must start with an amino acid.');
                    return;
                }
            }

            let pep_noMods = pepStrs[i].replace(/([^#0-9])([^A-Z#]+)/g, '$1');

            // linkSite
            let cl_re = /#([0-9]+)?/g;
            let match;
            while ((match = cl_re.exec(pep_noMods)) != null) {
                let clIndex = match[1] === undefined ? 0 : match[1];
                let linkSite = {'id': clIndex, 'peptideId': i, 'linkSite': match.index - 1};
{'fraction_non_alphanumeric': 0.16727420008100446, 'fraction_numerical': 0.008910490076954233, 'mean_word_length': 1.8036322360953463, 'pattern_counts': {'":': 4, '<': 5, '<?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': '1636096', 'n_tokens_mistral': 802, 'n_tokens_neox': 755, 'n_words': 177}