Permalink
Browse files

added studies and funding to cytoscape org graph

  • Loading branch information...
1 parent 0d9ac73 commit fdc10517778d6f00895277aa018071d4fac458a2 Warren A. Kibbe committed Feb 28, 2012
@@ -36,7 +36,6 @@ def show_all
show
end
-
def show_org
params[:include_awards] ||= "0"
params[:include_studies] ||= "0"
@@ -57,6 +56,17 @@ def awards
show
end
+ def awards_org
+ params[:include_publications] ||= "0"
+ params[:include_studies] ||= "0"
+ params[:include_awards] ||= "1"
+ handle_data_params
+ @title = "Award Collaborations"
+ @org = find_unit_by_id_or_name(params[:id])
+ @dataurl = org_cytoscape_data_url(params[:id], params[:depth], params[:include_publications], params[:include_awards], params[:include_studies])
+ show
+ end
+
def studies
params[:include_awards] ||= "0"
params[:include_publications] ||= "0"
@@ -66,6 +76,24 @@ def studies
show
end
+ def studies_org
+ params[:include_awards] ||= "0"
+ params[:include_publications] ||= "0"
+ handle_data_params
+ @title = "Research Study Collaborations"
+ @org = find_unit_by_id_or_name(params[:id])
+ @dataurl = org_cytoscape_data_url(params[:id], params[:depth], params[:include_publications], params[:include_awards], params[:include_studies])
+ show
+ end
+
+ def org_all
+ handle_data_params
+ @title = "Publication/Award/Study Collaborations"
+ @org = find_unit_by_id_or_name(params[:id])
+ @dataurl = org_cytoscape_data_url(params[:id], params[:depth], params[:include_publications], params[:include_awards], params[:include_studies])
+ show
+ end
+
def jit
@javascripts = [ 'jit', 'example2', 'FusionCharts', 'ddsmoothmenu', 'jquery.min' ]
@stylesheets = [ 'publications', "latticegrid/#{lattice_grid_instance}", 'base', 'ForceDirected' ]
View
@@ -13,9 +13,9 @@
:collection => { :stats => :get, :period_stats => [:get,:post], :list => :get, :centers => :get, :departments => :get, :programs => :get, :department_collaborations => :get, :investigator_abstracts_during_period => [:get, :post], :classifications => :get },
:member => {:full_show => :get, :show_investigators => :get, :list_abstracts_during_period_rjs => :post, :classification_orgs => :get, :program_members => :get }
map.resources :investigators, :only => [:index, :show], :member => {:full_show => :get, :show_all_tags => :get, :publications => :get, :abstract_count => :get, :preview => :get, :search => :get, :investigators_search => :get, :research_summary => :get, :tag_cloud_list => :get, :title => :get, :home_department => :get, :bio=>:get, :email=>:get, :affiliations=>:get}, :collection => { :list_all => :get, :listing => :get, :list_by_ids => [:post, :get] }
- map.resources :cytoscape, :only => [:index, :show], :member => {:investigators => :get, :protovis => :get, :jit => :get, :awards => :get, :studies => :get, :d3_data => :get, :chord=>:get, :show_org=>:get, :show_all=>:get}, :collection => {:d3_data => :get, :chord=>:get, :chord_by_date => :get}
- map.resources :awards, :only => [:index, :show], :collection => {:disallowed => :get, :listing => :get}, :member => {:investigator => :get, :org => [:get, :post]}, :collection => {:org => [:get, :post]}
- map.resources :studies, :only => [:index, :show], :collection => {:disallowed => :get, :listing => :get}, :member => {:investigator => :get, :org => :get}
+ map.resources :cytoscape, :only => [:index, :show], :member => {:investigators => :get, :protovis => :get, :jit => :get, :awards => :get, :studies => :get, :d3_data => :get, :chord=>:get, :show_org=>:get, :awards_org=>:get, :studies_org=>:get, :show_all=>:get, :org_all=>:get}, :collection => {:d3_data => :get, :chord=>:get, :chord_by_date => :get}
+ map.resources :awards, :only => [:index, :show], :collection => {:disallowed => [:get, :post], :listing => :get}, :member => {:investigator => :get, :org => [:get, :post]}, :collection => {:org => [:get, :post]}
+ map.resources :studies, :only => [:index, :show], :collection => {:disallowed => [:get, :post], :listing => :get}, :member => {:investigator => :get, :org => :get}
map.resources :profiles, :except=>[:destroy,:new], :member => {:edit_pubs => :get, :investigator_listing => [:get, :post]}, :collection => { :splash => :get, :ccsg => :get, :admin => :get, :list_summaries => :get, :list_summaries_by_program => [:get, :post], :list_investigators => :get, :edit_investigators => :get}
map.resources :audits, :only => [:index, :show], :collection => { :view_logins => :get, :view_all_logins=> :get, :view_approved_profiles => :get, :view_approved_publications => :get, :faculty_data=>:get, :login_data=>:get, :approved_profile_data=>:get, :approved_publication_data=>:get, :view_publication_approvers=>:get, :view_profile_approvers=>:get, :view_logins_without_approvals=>:get}
@@ -70,7 +70,8 @@
map.cytoscape_show_all "cytoscape/:id/show_all/:depth", :controller => 'cytoscape', :action => 'show_all'
map.cytoscape_awards "cytoscape/:id/awards/:depth", :controller => 'cytoscape', :action => 'awards'
map.cytoscape_studies "cytoscape/:id/studies/:depth", :controller => 'cytoscape', :action => 'studies'
- map.cytoscape_show_org "cytoscape/:id/show_org/:depth", :controller => 'cytoscape', :action => 'show_org'
+ map.cytoscape_show_org "cytoscape/:id/show_org/:depth", :controller => 'cytoscape', :action => 'show_org'
+ map.cytoscape_awards_org "cytoscape/:id/awards_org/:depth", :controller => 'cytoscape', :action => 'awards_org'
map.send_graphviz_image 'send_graphviz_image/:id/:analysis/:distance/:stringency/:include_orphans/:start_date/:end_date/:program.:format', :controller => 'graphviz', :action => 'send_graphviz_image'
map.send_graphviz_image_orig 'send_graphviz_image/:id/:analysis/:distance/:stringency/:include_orphans/:program.:format', :controller => 'graphviz', :action => 'send_graphviz_image'
map.restless_graphviz 'get_graphviz/', :controller => 'graphviz', :action => 'get_graphviz'
View
@@ -5,3 +5,5 @@ rake reports:netids_to_orgs file=db/imports/IRB/all_users_2012-01-27.txt > irb_n
rake reports:netids_to_orgs file=db/imports/IRB/mss_netids_20120207.txt > mss_netid_report.txt
rake reports:netids_to_orgs file=db/imports/IRB/fsm_policy_no_acks_20120220.txt > fsm_no_acks_report.txt
+
+rake reports:netids_to_orgs file=db/imports/IRB/core_survey_netids_20120227.txt > core_survey_20120227_report.txt
@@ -48,14 +48,14 @@ def generate_cytoscape_award_nodes(investigator, max_depth, node_array=[], depth
node_array
end
-
def generate_cytoscape_award_edges(investigator, depth, node_array, edge_array=[], include_intra_node_connections=false)
# edges: [ { id: "e1", label: "Edge 1", weight: 1.1, source: "n1", target: "n3" },
# { id: "e2", label: "Edge 2", weight: 3.3, source:"n2", target:"n1"} ]
investigator_index = investigator.id.to_s
investigator.investigator_proposals.each { |i_award|
award_index = "A_#{i_award.proposal_id}"
- if award_index and ! cytoscape_edge_array_has_key?(edge_array, award_index, investigator_index)
+ next if i_award.proposal.blank?
+ if award_index and ! cytoscape_edge_array_has_key?(edge_array, award_index, investigator_index) and cytoscape_array_has_key?(node_array, award_index)
tooltiptext=investigator_award_edge_tooltip(i_award,investigator,depth)
edge_array << cytoscape_edge_hash(edge_array.length, investigator_index, award_index, i_award.role, i_award.proposal.investigator_proposals.length, tooltiptext, "Award")
# now add all the investigator - award connections
@@ -19,7 +19,6 @@ def generate_cytoscape_data(investigator, max_depth, include_publications, inclu
def handle_investigator_nodes(investigator, max_depth, include_publications, include_awards, include_studies, depth, node_array)
intermediate_node = ((include_awards+include_studies) > 0)
-
node_array = generate_cytoscape_publication_nodes(investigator, max_depth, node_array,depth,intermediate_node) unless include_publications == 0
node_array = generate_cytoscape_award_nodes(investigator, max_depth, node_array) unless include_awards == 0
node_array = generate_cytoscape_study_nodes(investigator, max_depth, node_array) unless include_studies == 0
@@ -44,18 +43,17 @@ def generate_cytoscape_org_data(org, max_depth, include_publications, include_aw
}
end
-
def generate_cytoscape_org_nodes(org, max_depth, node_array, depth, include_publications, include_awards, include_studies)
# nodes: [ { id: "n1", label: "Node 1", score: 1.0 },
# { id: "n2", label: "Node 2", score: 2.2 },
# { id: "n3", label: "Node 3", score: 3.5 } ]
return node_array if org.blank?
max_weight=max_org_pubs(org)
node_array << cytoscape_org_node_hash(org, max_weight, depth )
- depth +=1
+ depth +=1 unless include_awards > 0 or include_studies > 0
# first iteration - just insert the direct nodes - max depth set to depth
org.all_primary_or_member_faculty.each do |investigator|
- node_array = handle_investigator_nodes(investigator, max_depth, include_publications, include_awards, include_studies, depth, node_array) unless cytoscape_array_has_key?(node_array, investigator.id)
+ node_array = handle_investigator_nodes(investigator, max_depth, include_publications, include_awards, include_studies, depth, node_array)
end
node_array
end
@@ -74,11 +74,11 @@ def generate_cytoscape_publication_edges(investigator, depth, node_array, edge_a
investigator.co_authors.each { |connection|
next if connection.colleague.blank?
colleague_index = connection.colleague_id.to_s
- publication_index = "IC_#{connection.id}"
next unless cytoscape_array_has_key?(node_array, colleague_index)
- next if add_intermediate_nodes and not cytoscape_array_has_key?(node_array, publication_index)
tooltiptext=investigator_colleague_edge_tooltip(connection,investigator,connection.colleague)
if add_intermediate_nodes
+ publication_index = "IC_#{connection.id}"
+ next unless cytoscape_array_has_key?(node_array, publication_index)
unless cytoscape_edge_array_has_key?(edge_array, investigator_index, publication_index)
edge_array << cytoscape_edge_hash(edge_array.length, investigator_index, publication_index, connection.publication_cnt.to_s, connection.publication_cnt, tooltiptext, "Publication")
edge_array << cytoscape_edge_hash(edge_array.length, publication_index, colleague_index, connection.publication_cnt.to_s, connection.publication_cnt, tooltiptext, "Publication")
@@ -53,7 +53,7 @@ def generate_cytoscape_study_edges(investigator, depth, node_array, edge_array=[
investigator_index = investigator.id.to_s
investigator.investigator_studies.each { |i_study|
study_index = "S_#{i_study.study_id}"
- if study_index and ! cytoscape_edge_array_has_key?(edge_array, study_index, investigator_index)
+ if study_index and ! cytoscape_edge_array_has_key?(edge_array, study_index, investigator_index) and cytoscape_array_has_key?(node_array, study_index)
tooltiptext=investigator_study_edge_tooltip(i_study,investigator,depth)
edge_array << cytoscape_edge_hash(edge_array.length, investigator_index, study_index, i_study.role, i_study.study.investigator_studies.length, tooltiptext, "Study")
# now add all the investigator - study connections

0 comments on commit fdc1051

Please sign in to comment.