mirror of
https://github.com/chenasraf/snpr.git
synced 2026-05-17 17:38:07 +00:00
Rename local_genotype to snp_variation SnpediaPaper
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
module SnpediaPapersHelper
|
||||
def bold_if_matching_local_genotype(snpedia_paper, user_snp, &block)
|
||||
def bold_if_matching_variation(snpedia_paper, user_snp, &block)
|
||||
if snpedia_paper && user_snp &&
|
||||
snpedia_paper.local_genotype == user_snp.local_genotype.split('').sort.join
|
||||
snpedia_paper.snp_variation == user_snp.local_genotype.split('').sort.join
|
||||
|
||||
content_tag('b', &block)
|
||||
else
|
||||
|
||||
@@ -10,7 +10,7 @@ class SnpediaPaper < ActiveRecord::Base
|
||||
read_attribute(:summary).presence || "No summary provided."
|
||||
end
|
||||
|
||||
def local_genotype
|
||||
def snp_variation
|
||||
url =~ /\((.*);(.*)\)$/
|
||||
"#{$1}#{$2}"
|
||||
end
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
<% snp.snpedia_papers.each do |p| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= bold_if_matching_local_genotype(p, user_snp) do %>
|
||||
<%= link_to "#{snp.name} #{p.local_genotype.split('').join('/')}", p.url %>
|
||||
<%= bold_if_matching_variation(p, user_snp) do %>
|
||||
<%= link_to "#{snp.name} #{p.snp_variation.split('').join('/')}", p.url %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><b><%= p.summary.capitalize %></b></td>
|
||||
|
||||
@@ -3,9 +3,9 @@ RSpec.describe SnpediaPaper do
|
||||
build(:snpedia_paper, url: 'http://www.snpedia.com/index.php/Rs1234(A;C)')
|
||||
end
|
||||
|
||||
describe '#local_genotype' do
|
||||
it 'extracts the local genotype from the url' do
|
||||
expect(subject.local_genotype).to eq('AC')
|
||||
describe '#snp_variation' do
|
||||
it 'extracts the SNP variation from the url' do
|
||||
expect(subject.snp_variation).to eq('AC')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@ RSpec.describe 'snps/_snpedia_papers.html.erb' do
|
||||
let(:snpedia_paper) do
|
||||
double(:snpedia_paper, url: 'http://www.snpedia.com/index.php/Rs1234(A;C)',
|
||||
summary: 'Green hair',
|
||||
local_genotype: 'AC')
|
||||
snp_variation: 'AC')
|
||||
end
|
||||
let(:snp) { double('snp', name: 'rs1234', snpedia_papers: [snpedia_paper]) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user