bisearch_enzim_hu 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +68 -0
- data/Rakefile +2 -0
- data/bisearch_enzim_hu.gemspec +28 -0
- data/lib/bisearch_enzim_hu/fpcr_submitter.rb +49 -0
- data/lib/bisearch_enzim_hu/l1_result_page.rb +75 -0
- data/lib/bisearch_enzim_hu/l2_result_page.rb +93 -0
- data/lib/bisearch_enzim_hu/primer_design.rb +103 -0
- data/lib/bisearch_enzim_hu/version.rb +3 -0
- data/lib/bisearch_enzim_hu.rb +11 -0
- metadata +127 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 138530fe7550e7d59d57f843a18d0de52c6c6f69
|
|
4
|
+
data.tar.gz: 76e14a2a76d10107b5d9911acea5d42e7f17edaa
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 80922494b332ba43728a0bb9f8fbf42f53dabf676b061d8dc926ca0878536c5b8f351313374a565effcd43006398a5bc1f07ee206d549e3add9c557615398d6d
|
|
7
|
+
data.tar.gz: c0323118b9ba35988b3d77071dab0db8f3187b0b3b8cc614a75b219f1f788eef7bf556b00eadaf79665315b25cf612a2f0060f05062ca5d6f82632581cf89bbf
|
data/.gitignore
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
.bundle
|
|
4
|
+
.config
|
|
5
|
+
.yardoc
|
|
6
|
+
Gemfile.lock
|
|
7
|
+
InstalledFiles
|
|
8
|
+
_yardoc
|
|
9
|
+
coverage
|
|
10
|
+
doc/
|
|
11
|
+
lib/bundler/man
|
|
12
|
+
pkg
|
|
13
|
+
rdoc
|
|
14
|
+
spec/reports
|
|
15
|
+
test/tmp
|
|
16
|
+
test/version_tmp
|
|
17
|
+
tmp
|
|
18
|
+
*.bundle
|
|
19
|
+
*.so
|
|
20
|
+
*.o
|
|
21
|
+
*.a
|
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2014 Iwan Buetti
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# BisearchEnzimHu
|
|
2
|
+
|
|
3
|
+
A colleague of mine comes to me and expose his work problem, she would like to automatize the following steps:
|
|
4
|
+
|
|
5
|
+
1. open the browser and connect to the [Primer design](http://bisearch.enzim.hu/?m=search) page of [Bisearch.enzim.hu](http://bisearch.enzim.hu/) site of Institute of Enzymology
|
|
6
|
+
2. filling the form:
|
|
7
|
+
* paste a sequence like "ATTATCACA...tagtttctgcaa"
|
|
8
|
+
* check 'Bisulfite'
|
|
9
|
+
* set 'Opt' of 'Primer length' ('Primer scoring values' section) to 30
|
|
10
|
+
* set 'Minimum of CpGs' ('Primer design' section) to 0
|
|
11
|
+
* set 'Database' to 'Homo sapiens' ('Database search and fast PCR' section)
|
|
12
|
+
3. Push the "Search primers" button to submit the search
|
|
13
|
+
4. Wait about 30 seconds to get the 10 results
|
|
14
|
+
5. For each result push the 'FPCR' (FastPCR or PCR in silico), wait about 5 seconds to get the _level2_ result
|
|
15
|
+
6. Analyse the 'FPCR' result, and drop the one they have more than 1 product
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
So I build this gem that automatize all the tasks in a single request (a _Wrapper_):
|
|
19
|
+
|
|
20
|
+
```ruby
|
|
21
|
+
require 'bisearch_enzim_hu'
|
|
22
|
+
|
|
23
|
+
pd = BisearchEnzimHu::PrimerDesign.new
|
|
24
|
+
pd.sequence(seq, chr, start_pos).search
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
TODO: Write a gem description
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Add this line to your application's Gemfile:
|
|
34
|
+
|
|
35
|
+
gem 'bisearch_enzim_hu'
|
|
36
|
+
|
|
37
|
+
And then execute:
|
|
38
|
+
|
|
39
|
+
$ bundle
|
|
40
|
+
|
|
41
|
+
Or install it yourself as:
|
|
42
|
+
|
|
43
|
+
$ gem install bisearch_enzim_hu
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
```ruby
|
|
48
|
+
require 'bisearch_enzim_hu'
|
|
49
|
+
|
|
50
|
+
chr = "chr17"
|
|
51
|
+
start_pos = 32305219
|
|
52
|
+
seq = "ATTATCACACTCAGGCCCTAGCTGCTAGAAGCCTCATTTGCCTAAGTTTTTGTCCCAATGTTTCCGTGAAGGCAGAGAGAGGAGCTATTTGCATGCCAGCCCAGGGCTACGTAGAAAATATGGCAGGGATCCTCTCACACTGCAGTCGAGTCAAGGCAGTCCAGGGTGGCTGctggggccagactgccccgtcaagatccagcctgcctttcactgactgtgtgattagaatgtcttgccctatccctggactttagtttctgcaa"
|
|
53
|
+
|
|
54
|
+
pd = BisearchEnzimHu::PrimerDesign.new
|
|
55
|
+
pd.sequence(seq, chr, start_pos).search # chr and start_pos are optional
|
|
56
|
+
File.open('result.yml', 'w') {|f| f.write pd.primers.to_yaml } # save the result (an hash) to a YAML file
|
|
57
|
+
|
|
58
|
+
pd.prune # remove from result the _multi products_ FPCR results
|
|
59
|
+
File.open('result_pruned.yml', 'w') {|f| f.write pd.primers.to_yaml }
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Contributing
|
|
63
|
+
|
|
64
|
+
1. Fork it ( https://github.com/iwan/bisearch_enzim_hu/fork )
|
|
65
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
66
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
67
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
68
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'bisearch_enzim_hu/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "bisearch_enzim_hu"
|
|
8
|
+
spec.version = BisearchEnzimHu::VERSION
|
|
9
|
+
spec.authors = ["Iwan Buetti"]
|
|
10
|
+
spec.email = ["iwan.buetti@gmail.com"]
|
|
11
|
+
spec.summary = "Wrapper for Bisearch Primer Design"
|
|
12
|
+
# spec.description = %q{TODO: Write a longer description. Optional.}
|
|
13
|
+
spec.homepage = "https://github.com/iwan/bisearch_enzim_hu"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
|
22
|
+
spec.add_development_dependency "rake"
|
|
23
|
+
spec.add_development_dependency "rspec", "~> 2.6"
|
|
24
|
+
|
|
25
|
+
spec.add_dependency "mechanize" # http://mechanize.rubyforge.org/Mechanize.html
|
|
26
|
+
spec.add_dependency "nokogiri" # http://mechanize.rubyforge.org/Mechanize.html
|
|
27
|
+
|
|
28
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
require 'net/http'
|
|
2
|
+
require_relative 'l2_result_page'
|
|
3
|
+
|
|
4
|
+
module BisearchEnzimHu
|
|
5
|
+
|
|
6
|
+
URL = "http://bisearch.enzim.hu/?run"
|
|
7
|
+
class FpcrSubmitter
|
|
8
|
+
def initialize(url=URL)
|
|
9
|
+
@url = url
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def run(hash, index)
|
|
14
|
+
fp = hash[:fp] || hash[:line_a][:seq] # forward primer
|
|
15
|
+
rp = hash[:rp] || hash[:line_b][:seq] # reverse primer
|
|
16
|
+
fpcr = "#{fp}!#{rp}"
|
|
17
|
+
db = "Homo sapiens"
|
|
18
|
+
|
|
19
|
+
params = {
|
|
20
|
+
"bis" => "on", # bisulfite
|
|
21
|
+
"db" => db, # database
|
|
22
|
+
"fp" => fp, # forward primer
|
|
23
|
+
"fpcr" => fpcr, #
|
|
24
|
+
"fpcr_but.x" => "35",
|
|
25
|
+
"fpcr_but.y" => "6",
|
|
26
|
+
"mm" => "0000000011111111", # mismatches
|
|
27
|
+
"npcrres" => "100", # PCR product to show
|
|
28
|
+
"nprimerres" => "100", # Primer matches to show
|
|
29
|
+
"prg" => "cgi/fpcr.cgi",
|
|
30
|
+
"rp" => rp # reverse primer
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
uri = URI(@url)
|
|
34
|
+
puts "---> starting FPCR"
|
|
35
|
+
t = Time.now
|
|
36
|
+
page = Net::HTTP.post_form(uri, params)
|
|
37
|
+
puts "---> FPCR completed (time: #{Time.now-t}s)"
|
|
38
|
+
|
|
39
|
+
puts "--- save result to file: fpcr_result_#{index}.html"
|
|
40
|
+
File.open("fpcr_result_#{index}.html", 'w') {|f| f.write page.body }
|
|
41
|
+
|
|
42
|
+
result_page = BisearchEnzimHu::L2ResultPage.new(page.body)
|
|
43
|
+
result_page.parse # return an hash
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
require 'nokogiri'
|
|
2
|
+
require_relative 'fpcr_submitter'
|
|
3
|
+
|
|
4
|
+
module BisearchEnzimHu
|
|
5
|
+
|
|
6
|
+
class L1ResultPage
|
|
7
|
+
def initialize(f)
|
|
8
|
+
@doc = Nokogiri::HTML(f)
|
|
9
|
+
@table_hash = nil
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def parse(deep=false)
|
|
13
|
+
# select the table after the sequence: h2,h3,input
|
|
14
|
+
table = @doc.css("h2+h3+input+table").first
|
|
15
|
+
rows = table.css("tr")
|
|
16
|
+
header = rows.shift
|
|
17
|
+
|
|
18
|
+
@table_hash = {}
|
|
19
|
+
while !rows.empty?
|
|
20
|
+
# line_a, line_b = rows.shift(2)
|
|
21
|
+
line_a = rows.shift.css("td")
|
|
22
|
+
line_bb = rows.shift
|
|
23
|
+
line_b = line_bb.css("td")
|
|
24
|
+
hh = { :line_a => line_a, :line_b => line_b }
|
|
25
|
+
h = {}
|
|
26
|
+
#
|
|
27
|
+
index = line_a[0].content.to_i
|
|
28
|
+
# h[:index] = index
|
|
29
|
+
h[:score] = line_a[1].content.to_f
|
|
30
|
+
h[:pa] = line_a[11].content.to_i
|
|
31
|
+
h[:pea] = line_a[12].content.to_i
|
|
32
|
+
h[:len] = line_a[13].content.to_i
|
|
33
|
+
|
|
34
|
+
h[:fp] = line_bb.css("input").select{|el| el["name"]=="fp"}.first
|
|
35
|
+
h[:fp] = h[:fp]["value"] if !h[:fp].nil?
|
|
36
|
+
|
|
37
|
+
h[:rp] = line_bb.css("input").select{|el| el["name"]=="rp"}.first
|
|
38
|
+
h[:rp] = h[:rp]["value"] if !h[:rp].nil?
|
|
39
|
+
|
|
40
|
+
hh.each_pair do |i, line|
|
|
41
|
+
h[i] = {}
|
|
42
|
+
h[i][:seq] = line[2].content
|
|
43
|
+
h[i][:pos] = line[3].content.to_i
|
|
44
|
+
h[i][:plen] = line[4].content.to_i
|
|
45
|
+
h[i][:gc] = line[5].content.to_f
|
|
46
|
+
h[i][:tm] = line[6].content.to_f
|
|
47
|
+
h[i][:otm] = line[7].content.to_f
|
|
48
|
+
h[i][:cpg] = line[8].content
|
|
49
|
+
h[i][:sa] = line[9].content.to_i
|
|
50
|
+
h[i][:sea] = line[10].content.to_i
|
|
51
|
+
end
|
|
52
|
+
@table_hash[index] = h
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
proceed if deep
|
|
56
|
+
@table_hash
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
private
|
|
60
|
+
|
|
61
|
+
def proceed
|
|
62
|
+
@table_hash.each_pair do |index, hash|
|
|
63
|
+
l2_result_hash = BisearchEnzimHu::FpcrSubmitter.new.run(hash, index)
|
|
64
|
+
|
|
65
|
+
@table_hash[index][:fpcr] = l2_result_hash
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
# f = File.open("first_step_page.html")
|
|
73
|
+
# page = BisearchEnzimHu::L1ResultPage.new(f)
|
|
74
|
+
|
|
75
|
+
# puts page.parse
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
require 'nokogiri'
|
|
2
|
+
require 'uri'
|
|
3
|
+
|
|
4
|
+
# parsa, legge e memorizza in un hash il contenuto della pagina
|
|
5
|
+
# html con i risultati del secondo step
|
|
6
|
+
|
|
7
|
+
module BisearchEnzimHu
|
|
8
|
+
|
|
9
|
+
class L2ResultPage
|
|
10
|
+
HEAD = :head
|
|
11
|
+
SENSE = :sense
|
|
12
|
+
ANTISENSE = :antisense
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def initialize(f)
|
|
16
|
+
@doc = Nokogiri::HTML(f)
|
|
17
|
+
@direction = HEAD
|
|
18
|
+
@hash = nil
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def parse
|
|
22
|
+
@hash = {}
|
|
23
|
+
@doc.css("div.main").children.each_with_index do |el, i|
|
|
24
|
+
|
|
25
|
+
d = detect_direction(el)
|
|
26
|
+
if !d.nil?
|
|
27
|
+
@direction = d
|
|
28
|
+
@hash[@direction] ||={}
|
|
29
|
+
@hash[@direction][:results] ||=[]
|
|
30
|
+
@hash[@direction][:matches] ={}
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
detect_result(el)
|
|
34
|
+
detect_matches(el, i)
|
|
35
|
+
end
|
|
36
|
+
@hash
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
def detect_direction(el)
|
|
42
|
+
if el.name=="h2"
|
|
43
|
+
el.children.each do |el2|
|
|
44
|
+
if el2.name=="a" && el2["name"]=="spcr"
|
|
45
|
+
return SENSE
|
|
46
|
+
elsif el2.name=="a" && el2["name"]=="aspcr"
|
|
47
|
+
return ANTISENSE
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
nil
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def detect_result(el)
|
|
55
|
+
if el.name=="pre"
|
|
56
|
+
el.children.each do |el2|
|
|
57
|
+
if el2.name=="a"
|
|
58
|
+
@hash[@direction][:results] << parse_ensembl_url(el2["href"])
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def detect_matches(el, i)
|
|
65
|
+
if el.name.downcase=="h3" && el.children[0].name.downcase=="a" # && el.children[0]["name"]=~/^primer_s/
|
|
66
|
+
if el.children[0]["name"]=="primer_senfp" # Matches of forward primer
|
|
67
|
+
@hash[@direction][:matches][:forward] = @doc.css("div.main").children[i+1].content.to_i
|
|
68
|
+
elsif el.children[0]["name"]=="primer_senrp" # Matches of reverse primer
|
|
69
|
+
@hash[@direction][:matches][:reverse] = @doc.css("div.main").children[i+1].content.to_i
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def parse_ensembl_url(uri)
|
|
75
|
+
h = {}
|
|
76
|
+
h[:url] = uri
|
|
77
|
+
uri = URI(uri)
|
|
78
|
+
uri.query.split("&").each do |pair|
|
|
79
|
+
k, v = pair.split("=")
|
|
80
|
+
if v
|
|
81
|
+
k = k.to_sym
|
|
82
|
+
v = v.to_i if [:start, :end].include? k
|
|
83
|
+
h[k] = v
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
h[:length] = h[:end] - h[:start]
|
|
87
|
+
h
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# f = File.open("second_step_result_page_3res.html")
|
|
93
|
+
# L2ResultPage.new(f).parse
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
require 'mechanize'
|
|
2
|
+
require_relative 'l1_result_page'
|
|
3
|
+
|
|
4
|
+
module BisearchEnzimHu
|
|
5
|
+
|
|
6
|
+
# Primer Design Form (at http://bisearch.enzim.hu/?m=search)
|
|
7
|
+
class PrimerDesign
|
|
8
|
+
URL = "http://bisearch.enzim.hu/?m=search"
|
|
9
|
+
attr_reader :chr, :start_pos, :end_pos, :page, :form, :primers, :url
|
|
10
|
+
|
|
11
|
+
def initialize(options={})
|
|
12
|
+
@agent = Mechanize.new
|
|
13
|
+
@options = default_options.merge options
|
|
14
|
+
@url = @options.delete :url
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def sequence(seq, chr=nil, start_pos=nil)
|
|
19
|
+
@primers = {}
|
|
20
|
+
@chr = chr
|
|
21
|
+
@start_pos = start_pos
|
|
22
|
+
@end_pos = start_pos + seq.size if start_pos
|
|
23
|
+
@options[:seq] = seq
|
|
24
|
+
prepare
|
|
25
|
+
self
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def prepare
|
|
30
|
+
# filling form
|
|
31
|
+
@page = @agent.get(@url)
|
|
32
|
+
@form = @page.form
|
|
33
|
+
@options.each_pair do |field_name, value|
|
|
34
|
+
case get_type(field_name)
|
|
35
|
+
when :select # a dropdown
|
|
36
|
+
@form.field_with(name: field_name.to_s).options.find{|e| e.text.downcase=~Regexp.new(value.downcase)}.select
|
|
37
|
+
when :checkbox
|
|
38
|
+
@form.checkbox_with(name: field_name.to_s).send(value ? :check : :uncheck)
|
|
39
|
+
when :radiobutton
|
|
40
|
+
@form.radiobutton_with(name: field_name.to_s).send(value ? :check : :uncheck)
|
|
41
|
+
when :text
|
|
42
|
+
@form.field_with(name: field_name.to_s).value=value
|
|
43
|
+
when :text_area
|
|
44
|
+
@form.field_with(name: field_name.to_s).value=value # same as text
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
self
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def search(two_levels=true)
|
|
51
|
+
@primers = {}
|
|
52
|
+
puts "---> starting search primers"
|
|
53
|
+
t = Time.now
|
|
54
|
+
page = @agent.submit(@form)
|
|
55
|
+
puts "---> query completed (time: #{Time.now-t}s)"
|
|
56
|
+
@primers[:input] = {chr: @chr, start_pos: @start_pos, end_pos: @end_pos, seq: @options[:seq]}
|
|
57
|
+
res_page = BisearchEnzimHu::L1ResultPage.new(page.body)
|
|
58
|
+
# @primers[:output] = BisearchEnzimHu::L1ResultPage.new(page.body)
|
|
59
|
+
@primers[:output] = res_page.parse(two_levels)
|
|
60
|
+
self
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def prune
|
|
64
|
+
indexes_to_remove = []
|
|
65
|
+
puts @primers.inspect
|
|
66
|
+
puts @primers[:output].inspect
|
|
67
|
+
@primers[:output].each_pair do |i, h|
|
|
68
|
+
puts h.inspect
|
|
69
|
+
indexes_to_remove << i if h[:fpcr][:sense][:results].size>1
|
|
70
|
+
indexes_to_remove << i if h[:fpcr][:antisense][:results].size>1
|
|
71
|
+
end
|
|
72
|
+
indexes_to_remove.uniq!
|
|
73
|
+
puts "results to remove: [#{indexes_to_remove.join(', ')}]"
|
|
74
|
+
indexes_to_remove.each{|i| @primers[:output].delete(i)}
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
private
|
|
79
|
+
def default_options
|
|
80
|
+
{
|
|
81
|
+
bis: true,
|
|
82
|
+
optlen: 30,
|
|
83
|
+
mincpg: 0,
|
|
84
|
+
db: "homo sapiens",
|
|
85
|
+
url: URL
|
|
86
|
+
}
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def get_type(field_name)
|
|
90
|
+
field_types[field_name.to_sym] || :text
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def field_types
|
|
94
|
+
# default is :text
|
|
95
|
+
{
|
|
96
|
+
bis: :checkbox,
|
|
97
|
+
db: :select
|
|
98
|
+
}
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
|
metadata
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: bisearch_enzim_hu
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.3
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Iwan Buetti
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-05-15 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.6'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.6'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '2.6'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '2.6'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: mechanize
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: nokogiri
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
description:
|
|
84
|
+
email:
|
|
85
|
+
- iwan.buetti@gmail.com
|
|
86
|
+
executables: []
|
|
87
|
+
extensions: []
|
|
88
|
+
extra_rdoc_files: []
|
|
89
|
+
files:
|
|
90
|
+
- ".gitignore"
|
|
91
|
+
- Gemfile
|
|
92
|
+
- LICENSE.txt
|
|
93
|
+
- README.md
|
|
94
|
+
- Rakefile
|
|
95
|
+
- bisearch_enzim_hu.gemspec
|
|
96
|
+
- lib/bisearch_enzim_hu.rb
|
|
97
|
+
- lib/bisearch_enzim_hu/fpcr_submitter.rb
|
|
98
|
+
- lib/bisearch_enzim_hu/l1_result_page.rb
|
|
99
|
+
- lib/bisearch_enzim_hu/l2_result_page.rb
|
|
100
|
+
- lib/bisearch_enzim_hu/primer_design.rb
|
|
101
|
+
- lib/bisearch_enzim_hu/version.rb
|
|
102
|
+
homepage: https://github.com/iwan/bisearch_enzim_hu
|
|
103
|
+
licenses:
|
|
104
|
+
- MIT
|
|
105
|
+
metadata: {}
|
|
106
|
+
post_install_message:
|
|
107
|
+
rdoc_options: []
|
|
108
|
+
require_paths:
|
|
109
|
+
- lib
|
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
|
+
requirements:
|
|
112
|
+
- - ">="
|
|
113
|
+
- !ruby/object:Gem::Version
|
|
114
|
+
version: '0'
|
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
|
+
requirements:
|
|
117
|
+
- - ">="
|
|
118
|
+
- !ruby/object:Gem::Version
|
|
119
|
+
version: '0'
|
|
120
|
+
requirements: []
|
|
121
|
+
rubyforge_project:
|
|
122
|
+
rubygems_version: 2.0.3
|
|
123
|
+
signing_key:
|
|
124
|
+
specification_version: 4
|
|
125
|
+
summary: Wrapper for Bisearch Primer Design
|
|
126
|
+
test_files: []
|
|
127
|
+
has_rdoc:
|