Skip to content

Commit

Permalink
Merge pull request #263 from openSNP/rplots
Browse files Browse the repository at this point in the history
Rplots, closes #102
  • Loading branch information
gedankenstuecke committed Mar 2, 2016
2 parents 87698c8 + 5040f52 commit d1abc1d
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 12 deletions.
17 changes: 9 additions & 8 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
<%= javascript_include_tag "application" %>
<%= csrf_meta_tag %>
</head>
<body>
<body>
<div class="navbar-inverse navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="/">openSNP</a>
<ul class="nav">
<ul class="nav">
<li class=""><%= link_to("News", '/news') %></li>
<li class=""><%= link_to("Stats", '/statistics') %></li>
<li class="divider-vertical"></li>
<li class=""><%= link_to("Genotypes", :controller => "genotypes", :action => "index")%></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Expand All @@ -30,13 +32,12 @@
<li class=""><%= link_to("Fitbit connections", :controller => "fitbit_profiles", :action => "index")%></li>
</ul>
<li class=""><%= link_to("SNPs", :controller => "snps", :action => "index") %></li>
<li class=""><%= link_to("Users", '/user_index') %></li>
</ul>
<%= form_tag "/search", :method => "get",:class => "navbar-search pull-left", :authenticity_token => true do %>
<%= text_field_tag :search, nil, :placeholder => "Search here", :class => "search-query input-medium" %>
<%= text_field_tag :search, nil, :placeholder => "Search for Everything!", :class => "search-query input-medium" %>
<%= submit_tag 'Search', class: 'hidden' %>
<% end %>
<ul class="nav pull-right">
<ul class="nav pull-right">
<% if current_user %>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Expand Down Expand Up @@ -70,7 +71,7 @@
<%=link_to "x",{:controller => "users", :action => "remove_help_one", :id => current_user}, :remote => true, id: "remove_help_one",:class => "close" %>
<h4 class="alert-heading">Upload Your Genotyping File</h4>
<%=link_to(image_tag("fileupload.png"), "/genotypes/new")%><br/>
<%=link_to("Upload the genotyping raw-data you got","/genotypes/new")%> from <em>23andMe</em>, <em>deCODEme</em> or <em>FamilyTreeDNA</em> to the database of <em>openSNP</em> to share it with other personal genomics customers and scientists from all over the world.
<%=link_to("Upload the genotyping raw-data you got","/genotypes/new")%> from <em>23andMe</em>, <em>deCODEme</em> or <em>FamilyTreeDNA</em> to the database of <em>openSNP</em> to share it with other personal genomics customers and scientists from all over the world.
</div>
<%end%>
<%if current_user.user_phenotypes == [] and current_user.help_two == false%>
Expand Down Expand Up @@ -99,13 +100,13 @@
<div class="alert alert-success" data-dismiss="alert">
<button type="button" class="close" data-dismiss="alert">x</button>
<strong><%= flash[:notice].html_safe %></strong>
</div>
</div>
<% end %>
<% if flash[:warning] %>
<div class="alert alert-error" data-dismiss="alert">
<button type="button" class="close" data-dismiss="alert">x</button>
<strong><%= flash[:warning].html_safe %></strong>
</div>
</div>
<% end %>
<% if flash[:achievement] %>
<div class="alert alert-info" data-dismiss="alert">
Expand Down
3 changes: 3 additions & 0 deletions app/views/news/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<div class="span2"><h3>Genotypes</h3></div><br/><div class="span1"><%=link_to(image_tag("rss_small.png"),"/rss")%></div>
</div>
<br/>
<b><%= link_to("Show All Genotypes", :controller => "genotypes", :action => "index")%></b>
<table class="table table-striped">
<tr>
<th>#</th>
Expand All @@ -97,6 +98,7 @@
</div>
<div id="users">
<h3>Users</h3><br/>
<b><%= link_to("Show All Users", :controller => "users", :action => "index")%></b>
<table class="table table-striped">
<tr>
<th>#</th>
Expand All @@ -118,6 +120,7 @@
</div>
<div id="phenotypes">
<h3>Phenotypes</h3><br/>
<b><%= link_to("Show All Phenotypes", :controller => "phenotypes", :action => "index")%></b>
<table class="table table-striped">
<tr>
<th>Name</th>
Expand Down
39 changes: 39 additions & 0 deletions app/views/static/statistics.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<h3>Statistics</h3>
See how we've been growing over the last years. Graphs are updated daily, raw data is provided as well.

<div class="row">
<div class="span6">
<h4>Users</h4>
<img src="../data/plot_data/users.png"/><br/>
<i><a href="../data/plot_data/number_users.csv">Download raw data</a></i>
</div>
<div class="span6">
<h4>Genotypes</h4>
<img src="../data/plot_data/genotypes.png"/><br/>
<i><a href="../data/plot_data/number_genotypes.csv">Download raw data</a></i>
</div>
</div>

<div class="row">
<div class="span6">
<h4>Phenotypes</h4>
<img src="../data/plot_data/phenotypes.png"/><br/>
<i><a href="../data/plot_data/number_phenotypes.csv">Download raw data</a></i>
</div>
<div class="span6">
<h4>Phenotype Answers</h4>
<img src="../data/plot_data/user_phenotypes.png"/><br/>
<i><a href="../data/plot_data/number_user_phenotypes.csv">Download raw data</a></i>
</div>
</div>

<div class="row">
<div class="span6">
<h4>Users / Genotypes</h4>
<img src="../data/plot_data/geno_plus_phenotypes.png"/><br/>
</div>
<div class="span6">
<h4>Phenotypes / Answers</h4>
<img src="../data/plot_data/pheno_plus_userpheno.png"/><br/>
</div>
</div>
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
get '/signout', :to => 'user_sessions#destroy', :as => :logout
get '/faq', :to => 'static#faq'
get '/disclaimer', :to => 'static#disclaimer'
get '/statistics', :to => 'static#statistics'
get '/user_index', :to => 'users#index'
get '/rss', :to => 'genotypes#feed', :as => :feed, :defaults => {:format => 'rss' }
get '/search', :to => 'search_results#search'
Expand Down
8 changes: 4 additions & 4 deletions lib/tasks/dump_numbers.rake
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ namespace :numbers do

# now let's get the genotypes
File.open("#{Rails.root}/public/data/plot_data/number_genotypes.csv","w"){ |file|
Genotype.find_each do |u|
Genotype.find_each.with_index do |u,i|
file.write("#{i + 1}\t#{u.created_at}\n")
end
}

# what else do we need? oh yes, phenotypes
File.open("#{Rails.root}/public/data/plot_data/number_phenotypes.csv","w"){ |file|
Phenotype.find_each do |u|
Phenotype.find_each.with_index do |u,i|
file.write("#{i + 1}\t#{u.created_at}\n")
end
}

# and lastly the user phenotypes
File.open("#{Rails.root}/public/data/number_user_phenotypes.csv","w"){ |file|
UserPhenotype.find_each do |u|
File.open("#{Rails.root}/public/data/plot_data/number_user_phenotypes.csv","w"){ |file|
UserPhenotype.find_each.with_index do |u,i|
file.write("#{i + 1}\t#{u.created_at}\n")
end
}
Expand Down

0 comments on commit d1abc1d

Please sign in to comment.