bio-faster 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +12 -0
- data/{README.rdoc → README.md} +13 -5
- data/Rakefile +7 -8
- data/VERSION +1 -1
- data/bio-faster.gemspec +6 -5
- data/ext/faster.c +6 -1
- data/spec/parser_spec.rb +25 -5
- data/test/data/sample.fasta +1 -1
- metadata +18 -17
data/.travis.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 1.8.7
|
4
|
+
- 1.9.2
|
5
|
+
- 1.9.3
|
6
|
+
# - jruby-18mode # JRuby in 1.8 mode
|
7
|
+
# - jruby-19mode # JRuby in 1.9 mode
|
8
|
+
# - rbx-18mode
|
9
|
+
# - rbx-19mode
|
10
|
+
# uncomment this line if your project needs to run something other than `rake`:
|
11
|
+
#script: bundle exec rake ext:build
|
12
|
+
#script: bundle exec rake
|
data/{README.rdoc → README.md}
RENAMED
@@ -1,14 +1,21 @@
|
|
1
|
-
|
1
|
+
[![Build Status](https://secure.travis-ci.org/fstrozzi/bioruby-faster.png?branch=master)](http://travis-ci.org/fstrozzi/bioruby-faster)
|
2
|
+
|
3
|
+
Bio::Faster
|
4
|
+
==========
|
2
5
|
|
3
6
|
Fast and simple parser for FastA / FastQ files, based on Heng Li Kseq library written in C.
|
4
7
|
http://lh3lh3.users.sourceforge.net/parsefastq.shtml
|
5
8
|
|
6
|
-
|
9
|
+
Examples
|
10
|
+
========
|
11
|
+
|
12
|
+
[See the wiki page](https://github.com/fstrozzi/bioruby-faster/wiki)
|
7
13
|
|
8
|
-
See the
|
14
|
+
[See the specs](https://github.com/fstrozzi/bioruby-faster/blob/master/spec/parser_spec.rb)
|
9
15
|
|
10
16
|
|
11
|
-
|
17
|
+
Contributing to bio-faster
|
18
|
+
==========================
|
12
19
|
|
13
20
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
14
21
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
@@ -18,7 +25,8 @@ See the wiki page.
|
|
18
25
|
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
19
26
|
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
20
27
|
|
21
|
-
|
28
|
+
Copyright
|
29
|
+
=========
|
22
30
|
|
23
31
|
Copyright (c) 2011 Francesco Strozzi. See LICENSE.txt for
|
24
32
|
further details.
|
data/Rakefile
CHANGED
@@ -41,15 +41,12 @@ Rcov::RcovTask.new do |test|
|
|
41
41
|
test.rcov_opts << '--exclude "gems/*"'
|
42
42
|
end
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
end
|
44
|
+
require 'rspec/core'
|
45
|
+
require 'rspec/core/rake_task'
|
46
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
47
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
49
48
|
end
|
50
49
|
|
51
|
-
task :default => :test
|
52
|
-
|
53
50
|
require 'rake/rdoctask'
|
54
51
|
Rake::RDocTask.new do |rdoc|
|
55
52
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
@@ -73,7 +70,9 @@ namespace :ext do
|
|
73
70
|
FileList["*.o"].each do |file|
|
74
71
|
rm file
|
75
72
|
end
|
76
|
-
|
73
|
+
cd ".."
|
77
74
|
end
|
78
75
|
end
|
79
76
|
|
77
|
+
task :default => ["ext:build",:spec]
|
78
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/bio-faster.gemspec
CHANGED
@@ -5,24 +5,25 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "bio-faster"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Francesco Strozzi"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-04-02"
|
13
13
|
s.description = "A fast parser for Fasta and FastQ files"
|
14
14
|
s.email = "francesco.strozzi@gmail.com"
|
15
15
|
s.extensions = ["ext/extconf.rb"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE.txt",
|
18
|
-
"README.
|
18
|
+
"README.md"
|
19
19
|
]
|
20
20
|
s.files = [
|
21
21
|
".document",
|
22
|
+
".travis.yml",
|
22
23
|
"Gemfile",
|
23
24
|
"Gemfile.lock",
|
24
25
|
"LICENSE.txt",
|
25
|
-
"README.
|
26
|
+
"README.md",
|
26
27
|
"Rakefile",
|
27
28
|
"VERSION",
|
28
29
|
"bio-faster.gemspec",
|
@@ -41,7 +42,7 @@ Gem::Specification.new do |s|
|
|
41
42
|
s.licenses = ["MIT"]
|
42
43
|
s.require_paths = ["lib"]
|
43
44
|
s.required_ruby_version = Gem::Requirement.new(">= 1.9")
|
44
|
-
s.rubygems_version = "1.8.
|
45
|
+
s.rubygems_version = "1.8.15"
|
45
46
|
s.summary = "A fast parser for Fasta and FastQ files"
|
46
47
|
|
47
48
|
if s.respond_to? :specification_version then
|
data/ext/faster.c
CHANGED
@@ -26,7 +26,12 @@ static VALUE method_parse(VALUE self, VALUE file) {
|
|
26
26
|
while (kseq_read(seq) >= 0) {
|
27
27
|
VALUE arr = rb_ary_new();
|
28
28
|
rb_ary_push(arr, rb_str_new2(seq->name.s));
|
29
|
-
if (seq->comment.l)
|
29
|
+
if (seq->comment.l) {
|
30
|
+
rb_ary_push(arr, rb_str_new2(seq->comment.s));
|
31
|
+
}
|
32
|
+
else {
|
33
|
+
rb_ary_push(arr, Qnil);
|
34
|
+
}
|
30
35
|
rb_ary_push(arr, rb_str_new2(seq->seq.s));
|
31
36
|
if (seq->qual.l) {
|
32
37
|
VALUE rb_quality = rb_ary_new();
|
data/spec/parser_spec.rb
CHANGED
@@ -71,10 +71,30 @@ describe Bio::Faster do
|
|
71
71
|
faster_res[0][2].should == "AGCAATTTCCCTTTTCCTGTCCTTTTTATAACATTGTGGAGGAAGACGGCAGCATAAAAAGGACAGTATTTGATTAAAAAATGATAAAAATTTTCAAAC"
|
72
72
|
|
73
73
|
faster_res[-1][0].should == "seq4"
|
74
|
-
faster_res[-1][1].should ==
|
74
|
+
faster_res[-1][1].should == nil
|
75
75
|
faster_res[-1][2].should == "mgltrrealssiaavggekalkdalavlggps"
|
76
76
|
end
|
77
77
|
|
78
|
+
it "can return the sequence data in a more friendly way" do
|
79
|
+
Bio::Faster.parse(File.join(TEST_DATA,"sample.fastq")) do |sequence_id, comment, sequence, quality|
|
80
|
+
sequence_id.should == "HISEQ1:86:D0306ACXX:2:1101:20970:17588"
|
81
|
+
comment.should == "1:N:0:CTTGTA"
|
82
|
+
sequence.should == "CGGTGCTGTTGTTATGCTGATGCTTATTAGTGCAAGTGTAGCTCCTCCGATTAGATGAATTAACAGGTGTCCTGCAGTAATGTTGGCTGTTAGTCGTAC"
|
83
|
+
quality.class.should == Array
|
84
|
+
break
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
it "can return the sequence data in a more friendly way (also for FastA)" do
|
89
|
+
Bio::Faster.parse(File.join(TEST_DATA,"sample.fasta")) do |sequence_id, comment, sequence, quality|
|
90
|
+
quality.should == nil # it is a Fasta file, so no quality
|
91
|
+
sequence_id.should == "seq1"
|
92
|
+
comment.should == "comment1"
|
93
|
+
sequence.should == "AGCAATTTCCCTTTTCCTGTCCTTTTTATAACATTGTGGAGGAAGACGGCAGCATAAAAAGGACAGTATTTGATTAAAAAATGATAAAAATTTTCAAAC"
|
94
|
+
break
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
78
98
|
|
79
99
|
describe "quality conversion for FastQ files (Sanger/Phred only)" do
|
80
100
|
|
@@ -87,8 +107,8 @@ describe Bio::Faster do
|
|
87
107
|
end
|
88
108
|
|
89
109
|
faster_quals = []
|
90
|
-
Bio::Faster.parse(File.join(TEST_DATA,"sample.fastq")) do |
|
91
|
-
faster_quals <<
|
110
|
+
Bio::Faster.parse(File.join(TEST_DATA,"sample.fastq")) do |sequence_id, comment, sequence, quality|
|
111
|
+
faster_quals << quality
|
92
112
|
end
|
93
113
|
faster_quals.should == bioruby_quals
|
94
114
|
|
@@ -103,8 +123,8 @@ describe Bio::Faster do
|
|
103
123
|
end
|
104
124
|
|
105
125
|
faster_quals = []
|
106
|
-
Bio::Faster.parse(File.join(TEST_DATA,"sff_sample.fastq")) do |
|
107
|
-
faster_quals <<
|
126
|
+
Bio::Faster.parse(File.join(TEST_DATA,"sff_sample.fastq")) do |sequence_id, comment, sequence, quality|
|
127
|
+
faster_quals << quality
|
108
128
|
end
|
109
129
|
faster_quals.should == bioruby_quals
|
110
130
|
|
data/test/data/sample.fasta
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bio-faster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-04-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: shoulda
|
16
|
-
requirement: &
|
16
|
+
requirement: &2161251160 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2161251160
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &2161250660 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.0.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2161250660
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: jeweler
|
38
|
-
requirement: &
|
38
|
+
requirement: &2161250100 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.6.4
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2161250100
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rcov
|
49
|
-
requirement: &
|
49
|
+
requirement: &2161249560 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2161249560
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: bio
|
60
|
-
requirement: &
|
60
|
+
requirement: &2161249020 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.4.2
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2161249020
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
|
-
requirement: &
|
71
|
+
requirement: &2161248500 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2161248500
|
80
80
|
description: A fast parser for Fasta and FastQ files
|
81
81
|
email: francesco.strozzi@gmail.com
|
82
82
|
executables: []
|
@@ -84,13 +84,14 @@ extensions:
|
|
84
84
|
- ext/extconf.rb
|
85
85
|
extra_rdoc_files:
|
86
86
|
- LICENSE.txt
|
87
|
-
- README.
|
87
|
+
- README.md
|
88
88
|
files:
|
89
89
|
- .document
|
90
|
+
- .travis.yml
|
90
91
|
- Gemfile
|
91
92
|
- Gemfile.lock
|
92
93
|
- LICENSE.txt
|
93
|
-
- README.
|
94
|
+
- README.md
|
94
95
|
- Rakefile
|
95
96
|
- VERSION
|
96
97
|
- bio-faster.gemspec
|
@@ -125,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
126
|
version: '0'
|
126
127
|
requirements: []
|
127
128
|
rubyforge_project:
|
128
|
-
rubygems_version: 1.8.
|
129
|
+
rubygems_version: 1.8.15
|
129
130
|
signing_key:
|
130
131
|
specification_version: 3
|
131
132
|
summary: A fast parser for Fasta and FastQ files
|