ruby-igv 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/igv.rb +24 -15
- data/lib/igv/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8915f9a26a6b4b4bbe15dc5dd35d156ca9c84a5b2737c4b81ffa1441b5049e2d
|
4
|
+
data.tar.gz: 44980727b24b348a3167566179e9a75755cda0023761624de1fb72fdfe3701cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 232bc8a829604e65fb67e7b39aa0480e3c0165e1291022c1162469ed5d126caefe0881b124e70fb4c386a51937e1530d812fb5ec459d8067fa9264e78b368202
|
7
|
+
data.tar.gz: c57afdcf2dcbf5d9829fd3815e4fdc91148a1757906027f663690598438ec3e284b54ff75b07f8ab8c699be93b7674192b78821953cc0846cc333a48bc4572f8
|
data/README.md
CHANGED
@@ -23,9 +23,13 @@ igv.load 'http://hgdownload.cse.ucsc.edu/goldenPath/hg19/encodeDCC/wgEncodeUwR
|
|
23
23
|
igv.go 'chr18:78,016,233-78,016,640'
|
24
24
|
igv.save '/tmp/r/region.svg'
|
25
25
|
igv.save '/tmp/r/region.png'
|
26
|
-
igv.
|
26
|
+
igv.snapshot_dir = '/tmp/r2/'
|
27
|
+
igv.save 'region.jpg' # save to /tmp/r2/region.png
|
28
|
+
igv.send 'echo' # whatever you want
|
27
29
|
```
|
28
30
|
|
31
|
+
* [Controlling IGV through a Port](https://software.broadinstitute.org/software/igv/PortCommands)
|
32
|
+
|
29
33
|
## Contributing
|
30
34
|
|
31
35
|
* [Report bugs](https://github.com/kojix2/ruby-igv/issues)
|
data/lib/igv.rb
CHANGED
@@ -5,11 +5,11 @@ require 'fileutils'
|
|
5
5
|
class IGV
|
6
6
|
class Error < StandardError; end
|
7
7
|
|
8
|
-
attr_reader :host, :port, :snapshot_dir, :
|
8
|
+
attr_reader :host, :port, :snapshot_dir, :history
|
9
9
|
def initialize(host: '127.0.0.1', port: 60_151, snapshot_dir: Dir.pwd)
|
10
10
|
@host = host
|
11
11
|
@port = port
|
12
|
-
@
|
12
|
+
@history = []
|
13
13
|
connect
|
14
14
|
set_snapshot_dir(snapshot_dir)
|
15
15
|
end
|
@@ -30,11 +30,20 @@ class IGV
|
|
30
30
|
alias goto go
|
31
31
|
|
32
32
|
def genome(name_or_path)
|
33
|
-
|
33
|
+
path = File.expand_path(name_or_path)
|
34
|
+
if File.exist?(path)
|
35
|
+
send 'genome ' + path
|
36
|
+
else
|
37
|
+
send 'genome ' + name_or_path
|
38
|
+
end
|
34
39
|
end
|
35
40
|
|
36
41
|
def load(path_or_url)
|
37
|
-
|
42
|
+
if URI.parse(path_or_url).scheme
|
43
|
+
send 'load ' + path_or_url
|
44
|
+
else
|
45
|
+
send 'load ' + File.expand_path(path_or_url)
|
46
|
+
end
|
38
47
|
end
|
39
48
|
|
40
49
|
def region(contig, start, end_)
|
@@ -49,16 +58,6 @@ class IGV
|
|
49
58
|
end
|
50
59
|
end
|
51
60
|
|
52
|
-
def snapshot_dir=(snapshot_dir)
|
53
|
-
snapshot_dir = File.expand_path(snapshot_dir)
|
54
|
-
return if snapshot_dir == @snaphot_dir
|
55
|
-
|
56
|
-
FileUtils.mkdir_p(snapshot_dir)
|
57
|
-
send "snapshotDirectory #{snapshot_dir}"
|
58
|
-
@snapshot_dir = snapshot_dir
|
59
|
-
end
|
60
|
-
alias set_snapshot_dir snapshot_dir=
|
61
|
-
|
62
61
|
def expand(_track = '')
|
63
62
|
send "expand #{track}"
|
64
63
|
end
|
@@ -77,11 +76,21 @@ class IGV
|
|
77
76
|
alias quit exit
|
78
77
|
|
79
78
|
def send(cmd)
|
80
|
-
@
|
79
|
+
@history << cmd
|
81
80
|
@socket.puts(cmd.encode(Encoding::UTF_8))
|
82
81
|
@socket.gets&.chomp("\n")
|
83
82
|
end
|
84
83
|
|
84
|
+
def snapshot_dir=(snapshot_dir)
|
85
|
+
snapshot_dir = File.expand_path(snapshot_dir)
|
86
|
+
return if snapshot_dir == @snaphot_dir
|
87
|
+
|
88
|
+
FileUtils.mkdir_p(snapshot_dir)
|
89
|
+
send "snapshotDirectory #{snapshot_dir}"
|
90
|
+
@snapshot_dir = snapshot_dir
|
91
|
+
end
|
92
|
+
alias set_snapshot_dir snapshot_dir=
|
93
|
+
|
85
94
|
def save(file_path = nil)
|
86
95
|
if file_path
|
87
96
|
# igv assumes the path is just a single filename, but
|
data/lib/igv/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-igv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kojix2
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|