dna 0.0.7 → 0.0.8

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.
@@ -0,0 +1,20 @@
1
+ class FastaParser
2
+
3
+ def initialize(handle)
4
+ @handle = handle
5
+ end
6
+
7
+ def each
8
+ sequence, header = nil, nil
9
+ @handle.each do |line|
10
+ if line[0].chr == '>'
11
+ yield Fasta.new(:name => header, :sequence => sequence) if sequence
12
+ sequence = ''
13
+ header = line[1..-1].strip
14
+ else
15
+ sequence << line.strip.tr(' ','')
16
+ end
17
+ end
18
+ yield Fasta.new(:name => header, :sequence => sequence)
19
+ end
20
+ end
@@ -0,0 +1,26 @@
1
+ class FastqParser
2
+
3
+ def initialize(handle)
4
+ @handle = handle
5
+ end
6
+
7
+ def each
8
+ c = (0..3).cycle
9
+ params = { :name => nil, :sequence => nil, :quality => nil }
10
+ @handle.each do |line|
11
+ n = c.next
12
+ case n
13
+ when 0
14
+ params[:name] = line.strip[1..-1]
15
+ when 1
16
+ params[:sequence] = line.strip
17
+ when 2
18
+ nil
19
+ when 3
20
+ params[:quality] = line.strip
21
+ record = Fastq.new params
22
+ yield record
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ class QSEQParser
2
+
3
+ def initialize(handle)
4
+ @handle = handle
5
+ end
6
+
7
+ def each
8
+ @handle.each do |line|
9
+ line = line.strip.split("\t")
10
+ record = QSEQ.new(
11
+ :machine => line[0],
12
+ :run => line[1],
13
+ :lane => line[2],
14
+ :tile => line[3],
15
+ :x => line[4],
16
+ :y => line[5],
17
+ :index => line[6],
18
+ :read_no => line[7],
19
+ :sequence => line[8],
20
+ :quality => line[9],
21
+ :filtered => line[10]
22
+ )
23
+ yield record
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,12 @@
1
+ >1
2
+ GAGAGATCTCAT
3
+ GAC
4
+ AC
5
+ AG
6
+ C
7
+ CGAAG
8
+ >2
9
+ GAGACAUAUC
10
+
11
+ CNNNA
12
+ A
@@ -0,0 +1,8 @@
1
+ @1
2
+ TGAAACTTATTGATCACCCCGCTTGGCGTTGGGGAGAAATTCAGAAAAGAGTGCTTGATGGGGCGCCACATGCCGTGCAACCCACTCTCTTTCACGCAGCGCGCCCCA
3
+ +
4
+ 5888.6778888650/-//&,(,./*-11'//0&,-0.(.,,,,/2/&-,,,,,.(.,(,..&---&-,,,((*-----*+.&,,,,,(//&,,,-(,,+(,,,--&(
5
+ @2
6
+ GTCGCGGCTTACCACCCAACGATTTTTTTTAGAGGTGCTGGTTTCA
7
+ +
8
+ 2550//*-1./4.--/'+.2.,,,,,,,,&(/00.11426554+13
@@ -0,0 +1,2 @@
1
+ HWUSI-EAS1690 0007 1 1 1139 20892 0 1 GTGTGCCAGCCGCCGCGGTAATACGTAGGTGGCAAGCGTTGTCCGGATTTATTGGGTGTAAAGGGCGCGTAGGCGGCCCTGTAAGTCAGTGGTGAAATCTC fffffffffffffffeeeeedddddabdd\dddabeeeee^aabdcabddaKdddc`RcY`_c`aT`Ib]Tc^\cZEKOZ_\]\bZVK^UZG]`[^BBBBB 1
2
+ HWUSI-EAS1690 0007 1 1 1174 18551 0 1 GTGTGCCAGCAGCCGCGGTAATACAGAGGGGGCAAGCGTTGTTCGGAATTACTGGGCGTAAAGGGCGCGTAGGCGGCCCGCTAAGCCGAACGTGAAATCCC ffffffffffcffffffeffddddYdb^ddbJ]Y^eeede^eadeedLeed\ddddIdddd`ddd^edcTacaa`aJ^aLZ^]Y^BBBBBBBBBBBBBBBB 1
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: 17
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 7
10
- version: 0.0.7
9
+ - 8
10
+ version: 0.0.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Austin G. Davis-Richardson
@@ -28,9 +28,15 @@ extra_rdoc_files: []
28
28
 
29
29
  files:
30
30
  - lib/dna.rb
31
+ - lib/parsers/fasta.rb
32
+ - lib/parsers/fastq.rb
33
+ - lib/parsers/qseq.rb
31
34
  - spec/dna_spec.rb
32
35
  - spec/record_spec.rb
33
36
  - spec/spec_helper.rb
37
+ - spec/data/test.fasta
38
+ - spec/data/test.fastq
39
+ - spec/data/test.qseq
34
40
  - readme.md
35
41
  homepage: http://github.com/audy/dna
36
42
  licenses: []