dna 0.2.0 → 0.2.1
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.
- data/dna.gemspec +2 -2
- data/lib/dna/dna.rb +2 -2
- data/lib/dna/phred.rb +1 -1
- data/lib/dna/version.rb +1 -1
- data/readme.md +28 -2
- data/spec/phred_spec.rb +4 -3
- metadata +3 -3
data/dna.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "dna"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Austin G. Davis-Richardson"]
|
12
|
-
s.date = "2012-12-
|
12
|
+
s.date = "2012-12-19"
|
13
13
|
s.description = "Simple FASTA/FASTQ/QSEQ parser library for Ruby."
|
14
14
|
s.email = "harekrishna@gmail.com"
|
15
15
|
s.executables = ["dna"]
|
data/lib/dna/dna.rb
CHANGED
data/lib/dna/phred.rb
CHANGED
data/lib/dna/version.rb
CHANGED
data/readme.md
CHANGED
@@ -53,9 +53,10 @@ File.open('sequences.qseq') do |handle|
|
|
53
53
|
puts records.first.inspect
|
54
54
|
end
|
55
55
|
|
56
|
-
# Even supports Gzip
|
56
|
+
# Even supports Gzip but you must specify the format
|
57
|
+
# (can't rewind in Gzip)
|
57
58
|
File.open('sequences.fasta.gz') do |handle|
|
58
|
-
records = Dna.new handle
|
59
|
+
records = Dna.new handle, :format => :fasta
|
59
60
|
|
60
61
|
records.each do |record|
|
61
62
|
puts record.length
|
@@ -63,6 +64,31 @@ File.open('sequences.fasta.gz') do |handle|
|
|
63
64
|
end
|
64
65
|
```
|
65
66
|
|
67
|
+
## Support for PHRED score parsing
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
|
71
|
+
# Illumina > 1.3)
|
72
|
+
|
73
|
+
record.illumina_qualities # => [31, ..., 37]
|
74
|
+
|
75
|
+
# Error probabilities
|
76
|
+
|
77
|
+
record.illumina_probabilities
|
78
|
+
# => [1.0, 0.7943282347242815, ..., 0.3981071705534972]
|
79
|
+
|
80
|
+
# Solexa + Illumina =< 1.3
|
81
|
+
|
82
|
+
record.solexa_qualities
|
83
|
+
record.solexa_probabilities
|
84
|
+
|
85
|
+
# Sanger
|
86
|
+
|
87
|
+
record.sanger_qualities
|
88
|
+
record.sanger_probabilities
|
89
|
+
|
90
|
+
```
|
91
|
+
|
66
92
|
## Bonus Feature
|
67
93
|
|
68
94
|
The DNA gem is also a command-line tool with grep-like capabilities. Print records with (Ruby) regexp match in header.
|
data/spec/phred_spec.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
# XXX should probably use the actual record objects
|
1
2
|
class TestRecord
|
2
3
|
include Phred
|
3
|
-
attr_accessor :
|
4
|
+
attr_accessor :quality
|
4
5
|
end
|
5
6
|
|
6
7
|
##
|
@@ -62,12 +63,12 @@ describe Phred do
|
|
62
63
|
format_definitions.each_pair do |type, properties|
|
63
64
|
|
64
65
|
it "should properly convert #{type} raw ascii PHRED scores to integers" do
|
65
|
-
test_record.
|
66
|
+
test_record.quality = properties[:string]
|
66
67
|
test_record.send(:"#{type}_scores").should == properties[:scores]
|
67
68
|
end
|
68
69
|
|
69
70
|
it "should properly convert #{type.to_s} raw ascii PHRED scores to probabilities" do
|
70
|
-
test_record.
|
71
|
+
test_record.quality = properties[:string]
|
71
72
|
test_record.send(:"#{type}_probabilities").should == properties[:probabilities]
|
72
73
|
end
|
73
74
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dna
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
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-
|
12
|
+
date: 2012-12-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jeweler
|
@@ -74,7 +74,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
74
|
version: '0'
|
75
75
|
segments:
|
76
76
|
- 0
|
77
|
-
hash:
|
77
|
+
hash: 1149140625798689145
|
78
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
79
|
none: false
|
80
80
|
requirements:
|