did some further adjustments to support multiple files:

* parsing of files -> don't add "old" UserSnps, so no duplicates
* the user_is_not_user-page now displays all genotyping-files
* the zip-files of genotypes for specific phenotypes now include all genotypes of a user
* made the genotype-index a bit nicer
This commit is contained in:
Bastian Greshake
2011-12-12 18:22:07 +01:00
parent 437db26c6c
commit b464919e81
6 changed files with 30 additions and 12 deletions

View File

@@ -15,6 +15,10 @@ class Parsing
log "Loading known Snps."
known_snps = {}
Snp.find_each do |s| known_snps[s.name] = true end
known_user_snps = {}
UserSnp.where("user_id" => @genotype.user_id).find_each do |us| known_user_snps[us.snp_name] = true end
new_snps = []
new_user_snps = []
@@ -58,8 +62,13 @@ class Parsing
snp.default_frequencies
new_snps << snp
end
new_user_snps << [ @genotype.id, @genotype.user_id, snp_array[0].downcase, snp_array[3].rstrip ]
new_user_snp = known_user_snps[snp_array[0].downcase]
if new_user_snp.nil?
new_user_snps << [ @genotype.id, @genotype.user_id, snp_array[0].downcase, snp_array[3].rstrip ]
else
log "already known user-snp"
end
else
UserMailer.parsing_error(@genotype.user_id).deliver
break

View File

@@ -9,8 +9,10 @@ class Zipgenotypingfiles
@user_phenotypes.each do |up|
@user = User.find_by_id(up.user_id)
print @user
if @user.genotypes[0] != nil
@genotyping_files << @user.genotypes[0]
if @user.genotypes[] != []
@user.genotypes.each do |g|
@genotyping_files << g
end
end
end

View File

@@ -14,17 +14,19 @@
<tr>
<th><%= sortable "id", "ID"%></th>
<th>User</th>
<th>Type</th>
<th><%= sortable "filetype", "Type"%></th>
<th><%= sortable "created_at", "Created"%>
<th>Download</th>
</tr>
</thead>
<tbody>
<% @genotypes_paginate.each do |g| %>
<tr>
<td><%= g.id %></td>
<td><%=image_tag g.user.avatar.url(:head),:style => "vertical-align:middle"%><%= g.user.name%></td>
<td><%=image_tag g.user.avatar.url(:head),:style => "vertical-align:middle"%><%= link_to(g.user.name, g.user)%></td>
<td><%= g.filetype %></td>
<td><%= g.created_at%></td>
<td><%= link_to "Right-click and 'Save as..'", '../data/' + g.fs_filename %></td>
</tr>
<% end %>
</tbody>

View File

@@ -15,8 +15,13 @@
</div>
<%if current_user%><div class="span6 columns offset2"><h5><%=link_to(image_tag("/images/sendmessage_small.png",:style => "vertical-align:middle" ), :controller => "messages", :action => "new", :user_to_send => @user.id)%> <%= link_to("Send "+ @first_name + " a message", :controller => "messages", :action => "new", :user_to_send => @user.id) %></h5></div><%end%>
</div>
<% if @user.has_sequence == true %>
<p><%= @first_name %> has uploaded genotyping rawdata.</p><p><%=link_to(image_tag("/images/filedownload_small.png",:style => "vertical-align:middle"),@user.genotypes[0].download)%> <%= link_to "Download this set", @user.genotypes[0].download%></p>
<% if @user.genotypes != [] %>
<p><%= @first_name %> has uploaded genotyping rawdata.</p>
<ul>
<%@user.genotypes.each do |g|%>
<li><%=link_to(image_tag("/images/filedownload_small.png",:style => "vertical-align:middle"),g.download)%> <%= link_to "Download this set (#{g.filetype})", g.download%></li>
<%end%>
</ul>
<% else %>
<p><%= @first_name %> has not uploaded any sequences.</p>
<% end %>

View File

@@ -4,6 +4,6 @@ class RemoveSlugColumnFromSnps < ActiveRecord::Migration
end
def self.down
puts "nothing to do"
"nothing to do"
end
end

View File

@@ -138,9 +138,9 @@ ActiveRecord::Schema.define(:version => 20111212063354) do
t.string "allele_frequency"
t.integer "ranking"
t.integer "number_of_users", :default => 0
t.datetime "mendeley_updated", :default => '2011-11-07 14:28:30'
t.datetime "plos_updated", :default => '2011-11-07 14:28:30'
t.datetime "snpedia_updated", :default => '2011-11-07 14:28:30'
t.datetime "mendeley_updated", :default => '2011-11-07 23:00:52'
t.datetime "plos_updated", :default => '2011-11-07 23:00:52'
t.datetime "snpedia_updated", :default => '2011-11-07 23:00:52'
t.datetime "created_at"
t.datetime "updated_at"
end