Skip to content

Instantly share code, notes, and snippets.

@faiyaz26
Created March 11, 2017 17:49
Show Gist options
  • Save faiyaz26/b0f1a5fe8750985f05378d76c0dfcc0d to your computer and use it in GitHub Desktop.
Save faiyaz26/b0f1a5fe8750985f05378d76c0dfcc0d to your computer and use it in GitHub Desktop.
families = ['- other', 'ABI3/VP1', 'AP2/EREBP', 'ARF', 'AT-Hook',
'bHLH', 'bZIP', 'C2C2(Zn) Dof', 'C2C2(Zn) GATA', 'C2C2(Zn)YABBY',
'C2H2(Zn)', 'CAMTA', 'CAMTA-like', 'E2F/DP', 'GARP',
'GARP/ARR-B', 'GATA', 'GRF', 'HD-HOX', 'HD-KNOTTED',
'HD-PHD', 'HD-ZIP', 'HSF', 'LFY', 'LOB/AS2',
'MADS', 'MIR', 'MYB', 'NAC', 'SBP',
'small RNAs', 'SRS', 'TCP', 'Trihelix', 'WRKY(Zn)'
]
// Shorthand for $( document ).ready()
$(function() {
var html = "<h4> Families</h4>";
html += '<table class="table table-striped">';
for (var i = 0; i < families.length ; i++){
if(i%4 == 0){
if(i){
html += '</tr>';
}
html += '<tr>';
}
html += '<td>';
html += '<div class="checkbox">'
html += '<label><input type="checkbox" class="family_checkbox" value="'+families[i]+'">'+families[i]+'</label>';
html += '</div>'
html += '</td>'
}
html += '</tr>'
html += '</table>';
$('#families').html(html)
});
$('#submit').click(function(){
let agi = $('#genes').val()
if(agi.trim() == ''){
alert("Write down at least one gene");
return;
}
let families = ''
$('.family_checkbox').each(function() {
if ( $( this ).prop( "checked" ) ){
if (families != ''){
families += ' ';
}
families += $(this).val();
}
});
$('#submit').attr('disabled', 'disabled');
$.get( "/fetch", { agi: agi, families: families } )
.done(function( data ) {
$('#submit').removeAttr('disabled');
$('#output').html(data);
}).fail(function(){
$('#submit').removeAttr('disabled');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment