parse_fasta 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/parse_fasta/record.rb +5 -1
- data/lib/parse_fasta/version.rb +1 -1
- data/spec/parse_fasta/record_spec.rb +21 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2fe1d91cfec3272d6f28872c5f048edd518b290
|
4
|
+
data.tar.gz: ef220e3c20cba089556a727a1cbe739f9a869037
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 909f37e235e112841ec124768e30ccbccd92e50065446ca132475b7c148dd63f5a4d6ce08be7a3194c8bd15cd12cd8e243008739ae26c0c6b9d09bb37b0e1cac
|
7
|
+
data.tar.gz: e6a9080b6f836a1b14987b3b9c8185c3a05997583d82d209f7b9f8c5f83b98fad4a5ce02c66bc9880e1a872feeb4fee1cbac34f98714ec37cb8022832009325c
|
data/CHANGELOG.md
CHANGED
data/lib/parse_fasta/record.rb
CHANGED
@@ -22,6 +22,9 @@ module ParseFasta
|
|
22
22
|
# @!attribute header
|
23
23
|
# @return [String] the full header of the record without the '>'
|
24
24
|
# or '@'
|
25
|
+
# @!attribute id
|
26
|
+
# @return [String] the "id" i.e., the first token when split by
|
27
|
+
# whitespace
|
25
28
|
# @!attribute seq
|
26
29
|
# @return [String] the sequence of the record
|
27
30
|
# @!attribute desc
|
@@ -30,7 +33,7 @@ module ParseFasta
|
|
30
33
|
# @!attribute qual
|
31
34
|
# @return [String or Nil] if the record is from a fastA file, it
|
32
35
|
# is nil; else, the quality string of the fastQ record
|
33
|
-
attr_accessor :header, :seq, :desc, :qual
|
36
|
+
attr_accessor :header, :id, :seq, :desc, :qual
|
34
37
|
|
35
38
|
# The constructor takes keyword args.
|
36
39
|
#
|
@@ -48,6 +51,7 @@ module ParseFasta
|
|
48
51
|
# character in it
|
49
52
|
def initialize args = {}
|
50
53
|
@header = args.fetch :header
|
54
|
+
@id = @header.split(" ")[0]
|
51
55
|
|
52
56
|
@desc = args.fetch :desc, nil
|
53
57
|
@qual = args.fetch :qual, nil
|
data/lib/parse_fasta/version.rb
CHANGED
@@ -21,8 +21,9 @@ require "spec_helper"
|
|
21
21
|
module ParseFasta
|
22
22
|
describe Record do
|
23
23
|
let(:header) { "apple pie is good"}
|
24
|
+
let(:id) { "apple" }
|
24
25
|
let(:seq) { "ACTG" }
|
25
|
-
let(:desc)
|
26
|
+
let(:desc) { "apple" }
|
26
27
|
let(:qual) { "abcd" }
|
27
28
|
|
28
29
|
let(:fasta_rec) {
|
@@ -37,15 +38,31 @@ module ParseFasta
|
|
37
38
|
}
|
38
39
|
|
39
40
|
describe "::new" do
|
40
|
-
context "fastA
|
41
|
+
context "either fastA or fastQ" do
|
41
42
|
it "sets :header" do
|
42
43
|
expect(fasta_rec.header).to eq header
|
44
|
+
expect(fastq_rec.header).to eq header
|
43
45
|
end
|
44
46
|
|
45
47
|
it "sets :seq" do
|
46
48
|
expect(fasta_rec.seq).to eq seq
|
49
|
+
expect(fastq_rec.seq).to eq seq
|
50
|
+
end
|
51
|
+
|
52
|
+
it "sets :id" do
|
53
|
+
expect(fasta_rec.id).to eq id
|
54
|
+
expect(fastq_rec.id).to eq id
|
47
55
|
end
|
48
56
|
|
57
|
+
it "sets :id to the first token when split by whitespace" do
|
58
|
+
rec = Record.new header: "apple\tpie is good",
|
59
|
+
seq: "actg"
|
60
|
+
|
61
|
+
expect(rec.id).to eq "apple"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context "fastA input" do
|
49
66
|
it "sets :desc to nil" do
|
50
67
|
expect(fasta_rec.desc).to eq nil
|
51
68
|
end
|
@@ -65,19 +82,11 @@ module ParseFasta
|
|
65
82
|
end
|
66
83
|
|
67
84
|
context "fastQ input" do
|
68
|
-
it "sets :
|
69
|
-
expect(fastq_rec.header).to eq header
|
70
|
-
end
|
71
|
-
|
72
|
-
it "sets :seq" do
|
73
|
-
expect(fastq_rec.seq).to eq seq
|
74
|
-
end
|
75
|
-
|
76
|
-
it "sets :desc to nil" do
|
85
|
+
it "sets :desc to desc" do
|
77
86
|
expect(fastq_rec.desc).to eq desc
|
78
87
|
end
|
79
88
|
|
80
|
-
it "sets :qual to
|
89
|
+
it "sets :qual to qual" do
|
81
90
|
expect(fastq_rec.qual).to eq qual
|
82
91
|
end
|
83
92
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parse_fasta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Moore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|