bettersam 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -2
- data/lib/bettersam.rb +6 -6
- data/test/test_test.rb +7 -2
- metadata +23 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a61794c089e1bbc0b2c7b5aebdf080cb0018a508
|
4
|
+
data.tar.gz: bf147789ee59d30182c24d6535618b919a8d3938
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6308aefe4a2681466d5fda521eaa167ecb2dea4dcefb9d7bf761f5c80b5ea771f01d0d65cc1a69922c063f01710e85f0c1cf2f9d7e2ed099b3367147f12f044
|
7
|
+
data.tar.gz: 9938db788b714bea439ef342695676fcf90c2febcae8284e8dc3a4adf04979179d1904e331ce481aa428ba54cca083d8024535e8de07c6bf8cb57c40a7baa87d
|
data/README.md
CHANGED
@@ -6,11 +6,9 @@ A SAM library for ruby, based on https://github.com/jesserod/samruby.
|
|
6
6
|
[![Gem Version](https://badge.fury.io/rb/bettersam.png)][gem]
|
7
7
|
[![Build Status](https://secure.travis-ci.org/Blahah/bettersam.png?branch=master)][travis]
|
8
8
|
[![Dependency Status](https://gemnasium.com/Blahah/bettersam.png?travis)][gemnasium]
|
9
|
-
[![Code Climate](https://codeclimate.com/github/Blahah/bettersam.png)][codeclimate]
|
10
9
|
[![Coverage Status](https://coveralls.io/repos/Blahah/bettersam/badge.png?branch=master)][coveralls]
|
11
10
|
|
12
11
|
[gem]: https://badge.fury.io/rb/bettersam
|
13
12
|
[travis]: https://travis-ci.org/Blahah/bettersam
|
14
13
|
[gemnasium]: https://gemnasium.com/Blahah/bettersam
|
15
|
-
[codeclimate]: https://codeclimate.com/github/Blahah/bettersam
|
16
14
|
[coveralls]: https://coveralls.io/r/Blahah/bettersam
|
data/lib/bettersam.rb
CHANGED
@@ -5,7 +5,7 @@ class BetterSam
|
|
5
5
|
# value (i.e. value = 2^(i+1))
|
6
6
|
$flags = [
|
7
7
|
nil,
|
8
|
-
0x1, # 1. read paired
|
8
|
+
0x1, # 1. read paired
|
9
9
|
0x2, # 2. read mapped in proper pair (i.e. with acceptable insert size)
|
10
10
|
0x4, # 3. read unmapped
|
11
11
|
0x8, # 4. mate unmapped
|
@@ -29,7 +29,7 @@ public
|
|
29
29
|
|
30
30
|
def parse_line(line)
|
31
31
|
return false if line[0] == "@"
|
32
|
-
|
32
|
+
|
33
33
|
f = line.chomp.split("\t", -1)
|
34
34
|
raise "SAM lines must have at least 11 fields (had #{f.size})" if f.size < 11
|
35
35
|
|
@@ -52,7 +52,7 @@ public
|
|
52
52
|
while i < f.size
|
53
53
|
tag = f[i]
|
54
54
|
i += 1
|
55
|
-
colon_index = tag.rindex(':')
|
55
|
+
colon_index = tag.rindex(':')
|
56
56
|
raise line if f.rindex == nil
|
57
57
|
key = tag[0, colon_index]
|
58
58
|
value = int_or_raw(tag[colon_index + 1, tag.size - colon_index] || "")
|
@@ -97,7 +97,7 @@ public
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def primary_aln?
|
100
|
-
|
100
|
+
(@flag & $flags[9]) == 0
|
101
101
|
end
|
102
102
|
|
103
103
|
def quality_fail?
|
@@ -115,7 +115,7 @@ public
|
|
115
115
|
end
|
116
116
|
|
117
117
|
def pair_opposite_strands?
|
118
|
-
(!self.read_reverse_strand? && self.mate_reverse_strand?) ||
|
118
|
+
(!self.read_reverse_strand? && self.mate_reverse_strand?) ||
|
119
119
|
(self.read_reverse_strand? && !self.mate_reverse_strand?)
|
120
120
|
end
|
121
121
|
|
@@ -150,7 +150,7 @@ public
|
|
150
150
|
l = str.length
|
151
151
|
@cigar_list = []
|
152
152
|
while str.length>0
|
153
|
-
if str =~ /([0-9]+[MIDNSHPX=]+)/
|
153
|
+
if str =~ /([0-9]+[MIDNSHPX=]+)/
|
154
154
|
@cigar_list << {$1[0..-2].to_i => $1[-1]}
|
155
155
|
str = str.slice($1.length, l)
|
156
156
|
else
|
data/test/test_test.rb
CHANGED
@@ -13,6 +13,7 @@ class TestBetterSam < Test::Unit::TestCase
|
|
13
13
|
@l3 = BetterSam.new("FCC00CKABXX:2:1101:19524:66398#CAGATCAT 145 chromosome03 1789377 23 4M1I2M1D93M = 1788766 -711 GGAGGATCGGGCCTCGTGGGCCGACGGTGAGCGAGTTGTTGTTGTTCCATACGGGGGCGCCGGAGTTGGTGCTCCACAGCGGGCCGTTGAACGAGCTCGA Bc`aaT\Y_]RLMKKMHEMV_T[Y[deaeeeaadbaaa\_feecedddddadfcegdcXdggcggggggggg`gfbecbcggggggggeggggggggggg AS:i:-51 XN:i:0 XM:i:6 XO:i:2 XG:i:2 NM:i:8 MD:Z:2T0C2^A2T0A5G1A81 YS:i:0 YT:Z:DP")
|
14
14
|
@l4l = BetterSam.new("FCC00CKABXX:2:1101:16909:83925#CAGATCAT 145 nivara_3s 1572267 23 5M2D3M2I3M1I86M = 1571498 -868 GTCCTCCAGGAGGATCGGGCCTCGTGAGCCGACGGTGAGCGAGTTGTTGTTGTTCCATACGGGGGCGCCGGAGTTGGTGCTCCACAGCGGGCCGTTGAAC BBBBBB_Z`cU]^SZS][]USKV[L`ac`dedeageeefagegagffdd`egedgggedgggggggdggggggggefeeeQgeagggggggggggggggg AS:i:-53 XN:i:0 XM:i:4 XO:i:3 XG:i:5 NM:i:9 MD:Z:2G2^TG3T5T0A81 YS:i:0 YT:Z:DP")
|
15
15
|
@l4r = BetterSam.new("FCC00CKABXX:2:1101:16909:83925#CAGATCAT 145 chromosome03 1789378 23 7M4I3M5I81M = 1788753 -716 GTCCTCCAGGAGGATCGGGCCTCGTGAGCCGACGGTGAGCGAGTTGTTGTTGTTCCATACGGGGGCGCCGGAGTTGGTGCTCCACAGCGGGCCGTTGAAC BBBBBB_Z`cU]^SZS][]USKV[L`ac`dedeageeefagegagffdd`egedgggedgggggggdggggggggefeeeQgeagggggggggggggggg AS:i:-59 XN:i:0 XM:i:4 XO:i:2 XG:i:9 NM:i:13 MD:Z:3A1A2T6G75 YS:i:0 YT:Z:DP")
|
16
|
+
@l5l = BetterSam.new("FCC2HFRACXX:7:2314:9299:67450#TGACCAAT 355 Sb02g000720.1 1186 18 71M = 1238 -150 CGTCATCTTCTCTCATATATTTGTATCACCCATCCATCCATCTGCCTTCGATATGCATCTCCACTCCGCCG __^cc]^\`eegea`ffdfghhfd]eghhfffef``degfhf_^gdfhfg_fghhhfdhffdfhffbeWcW AS:i:142 XN:i:0 XM:i:0 XO:i:0 XG:i:0 NM:i:0 MD:Z:71 YS:i:44 YT:Z:CP")
|
16
17
|
end
|
17
18
|
|
18
19
|
should "be a paired read" do
|
@@ -77,7 +78,7 @@ class TestBetterSam < Test::Unit::TestCase
|
|
77
78
|
|
78
79
|
should "mark another snp" do
|
79
80
|
assert @l2.mark_snp(1789386)==2, "this is #{@l2.mark_snp(1789386)}, but i think it should be 3"
|
80
|
-
end
|
81
|
+
end
|
81
82
|
|
82
83
|
should "mark a third snp" do
|
83
84
|
assert @l3.mark_snp(1789386)==9, "this is #{@l3.mark_snp(1789386)}, but i think it should be 9"
|
@@ -89,5 +90,9 @@ class TestBetterSam < Test::Unit::TestCase
|
|
89
90
|
assert @l4r.put_snp==1789386, "this is #{@l4r.put_snp}, but I think it should be 1789386"
|
90
91
|
end
|
91
92
|
|
93
|
+
should "not be primary alignment" do
|
94
|
+
assert !@l5l.primary_aln?
|
95
|
+
end
|
96
|
+
|
92
97
|
end
|
93
|
-
end
|
98
|
+
end
|
metadata
CHANGED
@@ -1,84 +1,84 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bettersam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Smith
|
8
|
-
-
|
8
|
+
- Chris Boursnell
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-06-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: simplecov
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - '>='
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '0'
|
21
|
-
type: :
|
21
|
+
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - '>='
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - '>='
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
|
-
type: :
|
35
|
+
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - '>='
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: turn
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - '>='
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
|
-
type: :
|
49
|
+
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - '>='
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: shoulda-context
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - '>='
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
|
-
type: :
|
63
|
+
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: coveralls
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - '>='
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
|
-
type: :
|
77
|
+
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - '>='
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
description: Extended SAM (Sequence Alignment/Map) file parsing
|
@@ -89,8 +89,8 @@ extra_rdoc_files: []
|
|
89
89
|
files:
|
90
90
|
- Rakefile
|
91
91
|
- lib/bettersam.rb
|
92
|
-
- test/test_test.rb
|
93
92
|
- test/helper.rb
|
93
|
+
- test/test_test.rb
|
94
94
|
- README.md
|
95
95
|
- LICENSE
|
96
96
|
homepage: https://github.com/blahah/bettersam
|
@@ -103,18 +103,19 @@ require_paths:
|
|
103
103
|
- lib
|
104
104
|
required_ruby_version: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
|
-
- -
|
106
|
+
- - '>='
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: '0'
|
109
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
|
-
- -
|
111
|
+
- - '>='
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: '0'
|
114
114
|
requirements: []
|
115
115
|
rubyforge_project:
|
116
|
-
rubygems_version: 2.
|
116
|
+
rubygems_version: 2.0.6
|
117
117
|
signing_key:
|
118
118
|
specification_version: 4
|
119
119
|
summary: Extended SAM file parsing
|
120
120
|
test_files: []
|
121
|
+
has_rdoc:
|