bio-sambamba 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +20 -1
- data/VERSION +1 -1
- data/lib/bio-sambamba/bamfile.rb +3 -3
- data/lib/bio-sambamba/samfile.rb +1 -1
- data/lib/bio-sambamba/samheader.rb +3 -3
- metadata +3 -3
data/README.md
CHANGED
@@ -14,10 +14,29 @@ Note: this software is under active development!
|
|
14
14
|
```
|
15
15
|
|
16
16
|
In order to use the gem, you also need <code>sambamba</code> tool installed.
|
17
|
-
|
17
|
+
|
18
|
+
If you use Debian, you can download a package for your architecture from
|
19
|
+
[github downloads](http://github.com/lomereiter/sambamba/downloads).
|
20
|
+
|
21
|
+
Otherwise, you need to do the following:
|
18
22
|
|
19
23
|
* install [DMD compiler](http://dlang.org/download.html)
|
20
24
|
* install [Ragel](http://www.complang.org/ragel/) finite state machine compiler
|
25
|
+
|
26
|
+
* On Mac OS X you can install [homebrew](http://mxcl.github.com/homebrew/) package manager,
|
27
|
+
then install dmd and ragel easily with
|
28
|
+
|
29
|
+
```sh
|
30
|
+
brew install dmd
|
31
|
+
brew install ragel
|
32
|
+
```
|
33
|
+
|
34
|
+
* On Arch Linux you can use pacman to install dmd and ragel
|
35
|
+
|
36
|
+
```sh
|
37
|
+
pacman -S dmd libphobos ragel
|
38
|
+
```
|
39
|
+
|
21
40
|
* clone sambamba repository and compile the tool
|
22
41
|
|
23
42
|
```sh
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/bio-sambamba/bamfile.rb
CHANGED
@@ -18,7 +18,7 @@ module Bio
|
|
18
18
|
|
19
19
|
# Returns an AlignmentIterator object for iterating over all alignments in the file
|
20
20
|
def alignments
|
21
|
-
Bio::Bam::AlignmentIterator.new ['sambamba', '--format=json', @filename]
|
21
|
+
Bio::Bam::AlignmentIterator.new ['sambamba', 'view', '--format=json', @filename]
|
22
22
|
end
|
23
23
|
|
24
24
|
# True if index file was found
|
@@ -35,9 +35,9 @@ module Bio
|
|
35
35
|
# * _chr_: reference sequence
|
36
36
|
# * _region_: a Range representing an interval. Coordinates are 1-based.
|
37
37
|
def fetch(chr, region)
|
38
|
-
Bio::Bam::AlignmentIterator.new ['sambamba', '--format=json',
|
38
|
+
Bio::Bam::AlignmentIterator.new ['sambamba', 'view', '--format=json',
|
39
39
|
@filename,
|
40
|
-
|
40
|
+
"#{chr}:#{region.min}-#{region.max}"]
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
data/lib/bio-sambamba/samfile.rb
CHANGED
@@ -17,7 +17,7 @@ module Bio
|
|
17
17
|
|
18
18
|
# Returns an AlignmentIterator object for iterating over all alignments in the file
|
19
19
|
def alignments
|
20
|
-
Bio::Bam::AlignmentIterator.new ['sambamba', '--format=json', '-S', @filename]
|
20
|
+
Bio::Bam::AlignmentIterator.new ['sambamba', 'view', '--format=json', '-S', @filename]
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -14,7 +14,7 @@ module Bio
|
|
14
14
|
# Raw text of SAM header
|
15
15
|
def raw_contents
|
16
16
|
if @raw_contents.nil? then
|
17
|
-
@raw_contents = Bio::Command.query_command(['sambamba', '-H', @filename] + @opts)
|
17
|
+
@raw_contents = Bio::Command.query_command(['sambamba', 'view', '-H', @filename] + @opts)
|
18
18
|
if @raw_contents.start_with? "sambamba" then
|
19
19
|
raise @raw_contents
|
20
20
|
end
|
@@ -46,7 +46,7 @@ module Bio
|
|
46
46
|
@sq_lines ||= @json['rg_lines'].map{|json| RGLine.new(json)}
|
47
47
|
end
|
48
48
|
|
49
|
-
#
|
49
|
+
# @return [PGLine] array of @PG lines
|
50
50
|
def pg_lines
|
51
51
|
@json ||= get_json
|
52
52
|
@sq_lines ||= @json['pg_lines'].map{|json| PGLine.new(json)}
|
@@ -55,7 +55,7 @@ module Bio
|
|
55
55
|
private
|
56
56
|
# Calls sambamba to get underlying JSON object
|
57
57
|
def get_json
|
58
|
-
command = ['sambamba', '-H', '--format=json', @filename] + @opts
|
58
|
+
command = ['sambamba', 'view', '-H', '--format=json', @filename] + @opts
|
59
59
|
line = Bio::Command.query_command(command)
|
60
60
|
raise line if line[0] != '{'
|
61
61
|
@json = Oj.load(line)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bio-sambamba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bio
|
@@ -168,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
168
|
version: '0'
|
169
169
|
segments:
|
170
170
|
- 0
|
171
|
-
hash:
|
171
|
+
hash: 1006609026242934180
|
172
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
173
|
none: false
|
174
174
|
requirements:
|