dna 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/dna.gemspec +2 -2
- data/lib/dna/dna.rb +1 -1
- data/lib/dna/version.rb +1 -1
- data/readme.md +39 -36
- metadata +4 -4
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.1.
|
8
|
+
s.version = "0.1.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-08-
|
12
|
+
s.date = "2012-08-15"
|
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/version.rb
CHANGED
data/readme.md
CHANGED
@@ -1,60 +1,38 @@
|
|
1
1
|
# DNA
|
2
2
|
|
3
|
-
A
|
3
|
+
A biological sequence file parser for Ruby
|
4
4
|
|
5
5
|
Austin G. Davis-Richardson
|
6
6
|
|
7
|
-
|
7
|
+
Features
|
8
8
|
|
9
|
-
- [
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
- Supported Formats ([submit a format request](https://github.com/audy/dna/issues/new?title=request%20for%20new%20format))
|
10
|
+
- [fasta](http://en.wikipedia.org/wiki/FASTA)
|
11
|
+
- [fastq](http://en.wikipedia.org/wiki/Fastq)
|
12
|
+
- [qseq](http://blog.kokocinski.net/index.php/qseq-files-format?blog=2)
|
13
|
+
- Autodetection of file formats so your scripts can be format agnostic
|
14
|
+
- Automatic Gzip support
|
15
|
+
- Files are read from disk (not stored in memory)
|
14
16
|
|
15
17
|
## Installation
|
16
18
|
|
17
19
|
With Ruby 1.8.7 or better:
|
18
20
|
|
19
|
-
`gem install dna`
|
20
|
-
|
21
|
-
## CLI
|
22
|
-
|
23
|
-
DNA gem has grep-like capabilities. Print records with (Ruby) regexp match in header.
|
24
|
-
|
25
21
|
```
|
26
|
-
$
|
27
|
-
|
28
|
-
@1
|
29
|
-
TGAAACTTATTGATCACCCCGCTTGGCGTTGGGGAGAAATTCAGAAAAGAGTGCTTGATGGGGCGCCACATGCCGTGCAACCCACTCTCTTTCACGCAGCGCGCCCCA
|
30
|
-
+1
|
31
|
-
5888.6778888650/-//&,(,./*-11'//0&,-0.(.,,,,/2/&-,,,,,.(.,(,..&---&-,,,((*-----*+.&,,,,,(//&,,,-(,,+(,,,--&(
|
32
|
-
@2
|
33
|
-
GTCGCGGCTTACCACCCAACGATTTTTTTTAGAGGTGCTGGTTTCA
|
34
|
-
+2
|
35
|
-
2550//*-1./4.--/'+.2.,,,,,,,,&(/00.11426554+13
|
36
|
-
|
37
|
-
$ dna spec/data/test.fasta "\d"
|
38
|
-
|
39
|
-
>1
|
40
|
-
GAGAGATCTCATGACACAGCCGAAG
|
41
|
-
>2
|
42
|
-
GAGACAUAUCCNNNAA
|
43
|
-
|
22
|
+
$ (sudo) gem install dna
|
44
23
|
```
|
45
24
|
|
46
|
-
|
47
25
|
## Usage
|
48
26
|
|
49
27
|
```ruby
|
50
28
|
|
51
29
|
require 'dna'
|
52
30
|
|
53
|
-
#
|
31
|
+
# Automatic Format Detection
|
54
32
|
|
55
33
|
File.open('sequences.fasta') do |handle|
|
56
34
|
records = Dna.new handle
|
57
|
-
|
35
|
+
|
58
36
|
records.each do |record|
|
59
37
|
puts record.length
|
60
38
|
end
|
@@ -73,8 +51,7 @@ File.open('sequences.qseq') do |handle|
|
|
73
51
|
puts records.first.inspect
|
74
52
|
end
|
75
53
|
|
76
|
-
#
|
77
|
-
|
54
|
+
# Even supports Gzip
|
78
55
|
File.open('sequences.fasta.gz') do |handle|
|
79
56
|
records = Dna.new handle
|
80
57
|
|
@@ -83,3 +60,29 @@ File.open('sequences.fasta.gz') do |handle|
|
|
83
60
|
end
|
84
61
|
end
|
85
62
|
```
|
63
|
+
|
64
|
+
## Bonus Feature
|
65
|
+
|
66
|
+
The DNA gem is also a command-line tool with grep-like capabilities. Print records with (Ruby) regexp match in header.
|
67
|
+
|
68
|
+
```
|
69
|
+
$ dna spec/data/input.fastq "[1-2]"
|
70
|
+
|
71
|
+
@1
|
72
|
+
TGAAACTTATTGATCACCCCGCTTGGCGTTGGGGAGAAATTCAGAAAAGAGTGCTTGATGGGGCGCCACATGCCGTGCAACCCACTCTCTTTCACGCAGCGCGCCCCA
|
73
|
+
+1
|
74
|
+
5888.6778888650/-//&,(,./*-11'//0&,-0.(.,,,,/2/&-,,,,,.(.,(,..&---&-,,,((*-----*+.&,,,,,(//&,,,-(,,+(,,,--&(
|
75
|
+
@2
|
76
|
+
GTCGCGGCTTACCACCCAACGATTTTTTTTAGAGGTGCTGGTTTCA
|
77
|
+
+2
|
78
|
+
2550//*-1./4.--/'+.2.,,,,,,,,&(/00.11426554+13
|
79
|
+
|
80
|
+
$ dna spec/data/test.fasta "\d"
|
81
|
+
|
82
|
+
>1
|
83
|
+
GAGAGATCTCATGACACAGCCGAAG
|
84
|
+
>2
|
85
|
+
GAGACAUAUCCNNNAA
|
86
|
+
|
87
|
+
```
|
88
|
+
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dna
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Austin G. Davis-Richardson
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-08-
|
18
|
+
date: 2012-08-15 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
type: :runtime
|