<commit_before>function toggle_clusters() {
    var id = 2;
    var value_to_set = $('#cluster_1').prop('checked');
    if (!value_to_set) {
        value_to_set = false;
    }
    while($('#cluster_' + id).length) {
        $('#cluster_' + id).prop('checked', value_to_set);
        id++;
    }
}

function toggle_region() {
    if ($('#region').prop('checked')) {
        $('#region-input').show("fast");
    } else {
        $('#region-input').hide("fast");
    }
}

function toggle_legacy() {
    if ($('#legacy').prop('checked')) {
        $('#cluster_1').prop("checked", true);
        var id = 2;
        while($('#cluster_' + id).length) {
            $('#cluster_' + id).attr("disabled", true);
            id++;
        }
        $('#subclusterblast').prop("checked", false);
        $('#subclusterblast').attr("disabled", true);
        $('#inclusive').prop("checked", false);
        $('#inclusive').attr("disabled", true);
    } else {
        var id = 2;
        while($('#cluster_' + id).length) {
            $('#cluster_' + id).attr("disabled", false);
            id++;
        }
        $('#subclusterblast').prop("checked", true);
        $('#subclusterblast').attr("disabled", false);
        $('#inclusive').attr("disabled", false);
    }
}

function toggle_cassis_tip() {
    if ($('#eukaryotic').prop("checked")) {
        $('#cassis-link').show();
    } else {
        $('#cassis-link').hide();
    }
}

function toggle_email_confirm() {
    if ($('#email').val() != '') {
        $('#email-confirm-container').show("fast");
    } else {
        $('#email-confirm-container').hide("fast");
    }
}

function toggle_email_prot_confirm() {
    if ($('#email-prot').val() != '') {
        $('#email-prot-confirm-container').show("fast");
    } else {
        $('#email-prot-confirm-container').hide("fast");
    }
}

function clear_upload() {
    $('#seq').val('');
    show_genefinding_if_needed();
}

function clear_ncbi() {
    $('#ncbi').val('');
}

function clear_sequence() {
    $('#sequence').val('');
}

function clear_prot_ncbi() {
    $('#prot-ncbi').val('');
}

function show_genefinding_if_needed() {
    var file = $('#seq').val();
    var euc  = $('#eukaryotic').prop('checked');

    fasta = is_fasta(file);
    if ( fasta && !euc) {
        show_genefinding();
    } else {
        hide_genefinding();
    }
    show_glimmer_if_needed(fasta, euc);
}


function show_glimmer_if_needed(fasta, euc) {
    var genefinder = $('input[name=genefinder]:checked').val();

    // No need to show glimmer settings for eukaryotic fasta files
    if( fasta && genefinder == 'glimmer' && !euc ) {
        show_glimmer();
    } else {
        hide_glimmer();
    }
}


function seq_callback() {
    clear_ncbi();
    show_genefinding_if_needed();
}

function show_genefinding() {
    $('.dna_related').each(function(){
        $(this).show("fast");
    });
}
function show_glimmer() {
    $('.glimmer').each(function(){
        $(this).show("fast");
    });
}

function hide_genefinding() {
    $('.dna_related').each(function(){
        $(this).hide("fast");
    });
}

function hide_glimmer() {
    $('.glimmer').each(function(){
        $(this).hide("fast");
    });
}

function get_ext(file) {
    return file.split('.').pop();
}

function is_annotated(file) {
    var ext = get_ext(file.toLowerCase());
    var valid_exts = ['gb', 'gbk', 'genbank', 'emb', 'embl'];
    var res = false;
    for (var i in valid_exts) {
        if (ext == valid_exts[i]) {
            res = true;
            break;
        }
    }
    return res;
}

function is_fasta(file) {
    var ext = get_ext(file.toLowerCase());
    var valid_exts = ['fasta', 'fas', 'fa', 'fna'];
    var res = false;
    for (var i in valid_exts) {
        if (ext == valid_exts[i]) {
            res = true;
            break;
        }
    }
    return res;
}

function getFileSize() {
    var input, file;

    if (typeof window.FileReader !== 'function') {
        return 0;
    }

    input = $('#file');
    if (!input) {
        return 0;
    }
    else if (!input.files) {
        return 0;
    }
    else {
        file = input.files[0];
        return file.size;
    }
}

function verify_nucl_form() {
    var file = $('#seq').val();
    var ncbi = $('#ncbi').val();
    var from = $('#from').val();
    var to = $('#to').val();
    var email = $('#email').val();
    var email_confirm = $('#email-confirm').val();

    if( (file === '' || file === null) && (ncbi === '' || ncbi === null)){
        alert('No input file provided. Please enter NCBI number or upload your own file');
        return false;
    }

    if( !(is_annotated(file) || is_fasta(file)) && ncbi === '' ) {
        alert('Please provide EMBL/GenBank or nucleotide FASTA file');
        return false;
    }

    if((! $.isNumeric(from)) && (! (from === '' && to === ''))){
        alert("Please insert an integer number into the 'from' field.");
        return false;
    }

    if((! $.isNumeric(to)) && (! (to === '' && to === ''))){
        alert("Please insert an integer number into the 'to' field.");
        return false;
    }

    if(parseInt(from, 10) > parseInt(to, 10)){
        alert("Value in 'to' field should be higher than value in 'from' field.");
        return false;
    }

    if (email != email_confirm) {
        alert("Email address mismatch. Please check the spelling.");
        return false;
    }

    return true;
}
<commit_msg>antismash.js: Check NCBI ID field for email-like strings<commit_after>function toggle_clusters() {
    var id = 2;
    var value_to_set = $('#cluster_1').prop('checked');
    if (!value_to_set) {
        value_to_set = false;
    }
    while($('#cluster_' + id).length) {
        $('#cluster_' + id).prop('checked', value_to_set);
        id++;
    }
}

function toggle_region() {
    if ($('#region').prop('checked')) {
        $('#region-input').show("fast");
    } else {
        $('#region-input').hide("fast");
    }
}

function toggle_legacy() {
    if ($('#legacy').prop('checked')) {
        $('#cluster_1').prop("checked", true);
        var id = 2;
        while($('#cluster_' + id).length) {
            $('#cluster_' + id).attr("disabled", true);
            id++;
        }
        $('#subclusterblast').prop("checked", false);
        $('#subclusterblast').attr("disabled", true);
        $('#inclusive').prop("checked", false);
        $('#inclusive').attr("disabled", true);
    } else {
        var id = 2;
        while($('#cluster_' + id).length) {
            $('#cluster_' + id).attr("disabled", false);
            id++;
        }
        $('#subclusterblast').prop("checked", true);
        $('#subclusterblast').attr("disabled", false);
        $('#inclusive').attr("disabled", false);
    }
}

function toggle_cassis_tip() {
    if ($('#eukaryotic').prop("checked")) {
        $('#cassis-link').show();
    } else {
        $('#cassis-link').hide();
    }
}

function toggle_email_confirm() {
    if ($('#email').val() != '') {
        $('#email-confirm-container').show("fast");
    } else {
        $('#email-confirm-container').hide("fast");
    }
}

function toggle_email_prot_confirm() {
    if ($('#email-prot').val() != '') {
        $('#email-prot-confirm-container').show("fast");
    } else {
        $('#email-prot-confirm-container').hide("fast");
    }
}

function clear_upload() {
    $('#seq').val('');
    show_genefinding_if_needed();
}

function clear_ncbi() {
    $('#ncbi').val('');
}

function clear_sequence() {
    $('#sequence').val('');
}

function clear_prot_ncbi() {
    $('#prot-ncbi').val('');
}

function show_genefinding_if_needed() {
    var file = $('#seq').val();
    var euc  = $('#eukaryotic').prop('checked');

    fasta = is_fasta(file);
    if ( fasta && !euc) {
        show_genefinding();
    } else {
        hide_genefinding();
    }
    show_glimmer_if_needed(fasta, euc);
}


function show_glimmer_if_needed(fasta, euc) {
    var genefinder = $('input[name=genefinder]:checked').val();

    // No need to show glimmer settings for eukaryotic fasta files
    if( fasta && genefinder == 'glimmer' && !euc ) {
        show_glimmer();
    } else {
        hide_glimmer();
    }
}


function seq_callback() {
    clear_ncbi();
    show_genefinding_if_needed();
}

function show_genefinding() {
    $('.dna_related').each(function(){
        $(this).show("fast");
    });
}
function show_glimmer() {
    $('.glimmer').each(function(){
        $(this).show("fast");
    });
}

function hide_genefinding() {
    $('.dna_related').each(function(){
        $(this).hide("fast");
    });
}

function hide_glimmer() {
    $('.glimmer').each(function(){
        $(this).hide("fast");
    });
}

function get_ext(file) {
    return file.split('.').pop();
}

function is_annotated(file) {
    var ext = get_ext(file.toLowerCase());
    var valid_exts = ['gb', 'gbk', 'genbank', 'emb', 'embl'];
    var res = false;
    for (var i in valid_exts) {
        if (ext == valid_exts[i]) {
            res = true;
            break;
        }
    }
    return res;
}

function is_fasta(file) {
    var ext = get_ext(file.toLowerCase());
    var valid_exts = ['fasta', 'fas', 'fa', 'fna'];
    var res = false;
    for (var i in valid_exts) {
        if (ext == valid_exts[i]) {
            res = true;
            break;
        }
    }
    return res;
}

function getFileSize() {
    var input, file;

    if (typeof window.FileReader !== 'function') {
        return 0;
    }

    input = $('#file');
    if (!input) {
        return 0;
    }
    else if (!input.files) {
        return 0;
    }
    else {
        file = input.files[0];
        return file.size;
    }
}

function verify_nucl_form() {
    var file = $('#seq').val();
    var ncbi = $('#ncbi').val();
    var from = $('#from').val();
    var to = $('#to').val();
    var email = $('#email').val();
    var email_confirm = $('#email-confirm').val();

    if( (file === '' || file === null) && (ncbi === '' || ncbi === null)){
        alert('No input file provided. Please enter NCBI number or upload your own file');
        return false;
    }

    if (ncbi.indexOf('@') > -1) {
        alert('Invalid character @ in NCBI ID field');
        return false;
    }

    if( !(is_annotated(file) || is_fasta(file)) && ncbi === '' ) {
        alert('Please provide EMBL/GenBank or nucleotide FASTA file');
        return false;
    }

    if((! $.isNumeric(from)) && (! (from === '' && to === ''))){
        alert("Please insert an integer number into the 'from' field.");
        return false;
    }

    if((! $.isNumeric(to)) && (! (to === '' && to === ''))){
        alert("Please insert an integer number into the 'to' field.");
        return false;
    }

    if(parseInt(from, 10) > parseInt(to, 10)){
        alert("Value in 'to' field should be higher than value in 'from' field.");
        return false;
    }

    if (email != email_confirm) {
        alert("Email address mismatch. Please check the spelling.");
        return false;
    }

    return true;
}

{'fraction_non_alphanumeric': 0.2056499227904442, 'fraction_numerical': 0.002452538831864838, 'mean_word_length': 2.475378787878788, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '7035943', 'n_tokens_mistral': 3617, 'n_tokens_neox': 3567, 'n_words': 744}