<commit_before># Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

update_data_model_form = (dataModelClass)->
  data_model = ($(dataModelClass).find('.data_model select').prop('value') || '').toUpperCase()
  if data_model == 'PCM'
    $(dataModelClass + '.data_model_specifiers .effective_count').hide()
    $(dataModelClass + '.data_model_specifiers .pseudocount').show()
    $(dataModelClass).find('.matrix textarea')[0].value  = $(dataModelClass).find('.data_model_examples .pcm').text()
  else if data_model == 'PPM'
    $(dataModelClass + '.data_model_specifiers .effective_count').show()
    $(dataModelClass + '.data_model_specifiers .pseudocount').show()
    $(dataModelClass).find('.matrix textarea')[0].value = $(dataModelClass).find('.data_model_examples .ppm').text()
  else if data_model == 'PWM'
    $(dataModelClass + '.data_model_specifiers .effective_count').hide()
    $(dataModelClass + '.data_model_specifiers .pseudocount').hide()
    $(dataModelClass).find('.matrix textarea')[0].value = $(dataModelClass).find('.data_model_examples .pwm').text()

window.register_data_model_form = (dataModelClass)->
  update_data_model_form(dataModelClass)
  $(dataModelClass).find('.data_model select').change ->
    update_data_model_form(dataModelClass)

$(document).ready ->
  update_background_model_form = (background_form)->
    background_form = $(background_form)
    mode = (background_form.find('.mode select').prop('value') || '').toLowerCase()
    if mode == 'wordwise'
      background_form.find('.frequencies').hide()
      background_form.find('.gc_content').hide()<commit_msg>don't set matrix to default value if field is not empty on page load(e.g. on error during creation when #create renders action 'new')<commit_after># Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

update_data_model_form = (dataModelSelector)->
  $model = $(dataModelSelector)
  data_model_type = ($model.find('.data_model select').prop('value') || '').toUpperCase()
  $data_model_specifiers = $model.filter('.data_model_specifiers')
  if data_model_type == 'PCM'
    $data_model_specifiers.find('.effective_count').hide()
    $data_model_specifiers.find('.pseudocount').show()
    $model.find('.matrix textarea').val( $model.find('.data_model_examples .pcm').text() )
  else if data_model_type == 'PPM'
    $data_model_specifiers.find('.effective_count').show()
    $data_model_specifiers.find('.pseudocount').show()
    $model.find('.matrix textarea').val( $model.find('.data_model_examples .ppm').text() )
  else if data_model_type == 'PWM'
    $data_model_specifiers.find('.effective_count').hide()
    $data_model_specifiers.find('.pseudocount').hide()
    $model.find('.matrix textarea').val( $model.find('.data_model_examples .pwm').text() )

window.register_data_model_form = (dataModelSelector)->
  $model = $(dataModelSelector)
  if $model.find('.matrix textarea').length != 0 && $model.find('.matrix textarea').val().length == 0
    update_data_model_form($model)
  $model.find('.data_model select').change ->
    update_data_model_form($model)

$(document).ready ->
  update_background_model_form = (background_form)->
    background_form = $(background_form)
    mode = (background_form.find('.mode select').prop('value') || '').toLowerCase()
    if mode == 'wordwise'
      background_form.find('.frequencies').hide()
      background_form.find('.gc_content').hide()
{'fraction_non_alphanumeric': 0.15910318746623447, 'fraction_numerical': 0.001350621285791464, 'mean_word_length': 5.276271186440678, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '5309611', 'n_tokens_mistral': 1128, 'n_tokens_neox': 1112, 'n_words': 216}