- map = card.map - map_id = card.map_id .entity_map_card.very.basic.ui.segment(id="#{ map_id.gsub(/\s/,'_') }_card" data-map=map_id data-type=page_entity_base_type data-column=page_entity_map_column) .title.ui.header .name = map.key_field Map .long_name = Misc.humanize map_id .content .info.ui.compact.segment .meta .map_management.ui.buttons = reveal "Rename", nil, :class => 'ui small button rename_map' do %form.rename_map %label New name %input(name='rename' value=map_id) %input(type='submit') - if (%w(pvalue p.value p-value pvalues p.values p-values qvalue q.value q-value qvalues q.values q-values) & map.fields.first.downcase.split(/\s+/)).any? and map.fields.first.downcase !~ /score$/ - url = add_GET_param(@fullpath, '_format', 'pvalue_score') %a.ui.small.button(href=url) Pvalue score = reveal "QQ-plot", nil, :class => 'ui small button plot' do - pvalue = map.values.flatten.collect{|v| v.nil? or (String === v and v.empty?) ? nil : v.to_f}.compact.flatten -# pvalue = pvalue[0..100].collect{|p| p == 0 ? 0.000000000000000000001 : p } - pvalue = pvalue.collect{|p| p == 0 ? 0.000000000000000000001 : p } = resource map_id + '.qqplot.png', nil, :image do |file| = fragment do - FileUtils.mkdir_p File.dirname(file) unless File.exists? File.dirname(file) :ruby script =<<-EOF library(ggplot2) p = #{R.ruby2R pvalue} ggd.qqplot = function(pvector, main=NULL, ...) { Observed = -log10(sort(pvector,decreasing=F)) Expected = -log10( 1:length(Observed)/length(Observed) ) plot(Expected,Observed,pch=19,cex=1, ..., xlim=c(0,max(Expected)), ylim=c(0,max(Observed))) lines(Expected,Expected,col="red") } png(filename=#{R.ruby2R file}) ggd.qqplot(p) #ggsave(file=#{R.ruby2R file}, plot, width=width, height=height); EOF - R.run script - if Gene == Entity.formats[map.key_field] - if map.key_field != "Ensembl Gene ID" - url = add_GET_param(@fullpath, '_format', 'ensembl') %a.ensembl.ui.small.button(href=url) Ensembl - if map.key_field != "Associated Gene Name" - url = add_GET_param(@fullpath, '_format', 'name') %a.name.ui.small.button(href=url) Name - if "Rank" == map.fields.first - url = add_GET_param(@fullpath, '_format', 'invert_ranks') %a.invert_ranks.ui.small.button(href=url) Invert ranks - else - url = add_GET_param(@fullpath, '_format', 'ranks') %a.ranks.ui.small.button(href=url) Ranks - if NumericValue == Entity.formats[map.fields.first] or (map.entity_templates[map.fields.first] and map.entity_templates[map.fields.first].annotation_types.include? NumericValue) - $page_entity_base_type = page_entity_base_type - $page_entity_map_column = page_entity_map_column = reveal "Rank products", nil, :class => 'ui small button rank_product' do = action_parameters nil, :class => 'rank_products' do - input :map, :select, "Select map to use", nil, :html_options => {:class => 'favourite_maps', :type => $page_entity_base_type, :column => $page_entity_map_column} = reveal "Compare plot", nil, :class => 'ui small button plot' do = action_parameters nil, :class => 'plot' do - input :map, :select, "Select map to use", nil, :html_options => {:class => 'favourite_maps', :type => $page_entity_base_type, :column => $page_entity_map_column} .content .description = table :class => 'ui collapsing table', :table_id => map_id do - map - if card.action_controller .actions = action_controller_render(card.action_controller)