mirror of
https://github.com/chenasraf/snpr.git
synced 2026-05-18 01:39:01 +00:00
* adds Open Humans connection (incl. at least some tests) * removes the capability to add fitbit data (was broken in any case) * display current fitbit data is still included, will be removed after grace period (needs to be announced to users)
31 lines
899 B
Ruby
31 lines
899 B
Ruby
# frozen_string_literal: true
|
|
# simple Beacon implementation according to the GA4GH v0.2 standard
|
|
# see http://dnastack.com/ga4gh/bob/subscribe.html
|
|
# chrom={chromosome}&
|
|
# pos={position}&
|
|
# allele={allele}
|
|
|
|
class BeaconController < ApplicationController
|
|
def responses
|
|
begin
|
|
@position = params[:pos].to_i
|
|
@chromosome = params[:chrom]
|
|
@allele = params[:allele].upcase
|
|
# get all snps, iterate over them:
|
|
# if found the allele: return yes & break
|
|
@snps = Snp.where(position: @position, chromosome: @chromosome)
|
|
@snps.each do |s|
|
|
if s.allele_frequency[@allele].positive?
|
|
render text: 'YES' and return
|
|
break
|
|
end
|
|
end
|
|
# not found? return no
|
|
render text: 'NO' and return
|
|
rescue
|
|
# did something break: return none (not useful, but the API standard…)
|
|
render text: 'NONE'
|
|
end
|
|
end
|
|
end
|