scbi_cominer 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.0.4 2012-09-25
2
+
3
+ Added offsets
4
+
1
5
  === 0.0.3 2012-09-25
2
6
 
3
7
  upcase in freqtable
@@ -97,20 +97,27 @@ class FrequencyTable
97
97
  end
98
98
 
99
99
  def add_read(read)
100
- add_fasta(read.name, read.fasta)
100
+ add_fasta(read.name, read.fasta, read.start_in_consensus, read.align_clip_start, read.align_clip_end)
101
101
  end
102
102
 
103
- def add_sequence(seq)
103
+ def add_sequence(seq, offset)
104
104
  add_fasta(seq.seq_name,seq.seq_fasta)
105
105
  end
106
106
 
107
- def add_fasta(name,fasta)
107
+ def add_fasta(name,fasta, in_consensus_offset, align_clip_start, align_clip_end)
108
108
 
109
109
  @sequences.push({:name=>name,:fasta=>fasta})
110
110
  index = @sequences.length
111
-
112
- i = 0
113
- fasta.upcase.each_char do |c|
111
+
112
+ fasta_u=fasta.upcase
113
+
114
+ i = (align_clip_start.to_i+in_consensus_offset.to_i)-1
115
+
116
+ # seq_i=in_seq_offset.to_i
117
+
118
+ # while !(c=fasta_u[seq_i]).nil?
119
+ # puts ("_"*i+fasta[align_clip_start.to_i-1..align_clip_end.to_i-1])[0..80]+'...'
120
+ fasta[align_clip_start.to_i-1..align_clip_end.to_i-1].upcase.each_char do |c|
114
121
 
115
122
  #get current freq
116
123
  freq = @frequency_table[c]
@@ -221,6 +228,8 @@ class FrequencyTable
221
228
 
222
229
  def inspect
223
230
 
231
+ # return @frequency_table.to_json
232
+
224
233
  res = ''
225
234
 
226
235
  @frequency_table.each do |c,v|
@@ -12,12 +12,14 @@ class Cominer
12
12
  @freq_table = FrequencyTable.new
13
13
 
14
14
  contig.reads.each do |name,read|
15
- # puts ">#{read.name} #{read.orientation} #{read.align_clip_start} #{read.align_clip_end}"
15
+ # puts ">#{read.name} #{read.orientation} #{read.align_clip_start} #{read.align_clip_end} #{read.start_in_consensus}"
16
+ # puts read.fasta[read.align_clip_start.to_i..read.align_clip_end.to_i]
16
17
  # puts read.fasta
17
18
  @freq_table.add_read(read)
18
19
  end
19
20
 
20
- # puts freq_table.inspect
21
+ puts freq_table.inspect
22
+ exit
21
23
 
22
24
  ef = EntropyFunction.new(@freq_table)
23
25
 
data/lib/scbi_cominer.rb CHANGED
@@ -8,5 +8,5 @@ $: << File.join(File.dirname(__FILE__),File.basename(__FILE__,File.extname(__FIL
8
8
  require 'cominer.rb'
9
9
 
10
10
  module ScbiCominer
11
- VERSION = '0.0.3'
11
+ VERSION = '0.0.4'
12
12
  end
@@ -23,10 +23,11 @@ class TestScbiCominer < Test::Unit::TestCase
23
23
  cominer_stats=Cominer.new(contig)
24
24
 
25
25
 
26
+
26
27
  # get all reads with orientation and align clips
27
28
  contig.reads.each do |name,read|
28
- puts ">#{read.name} #{read.orientation} #{read.align_clip_start} #{read.align_clip_end}"
29
- puts read.fasta
29
+ puts ">#{read.name} #{read.orientation} #{read.align_clip_start} #{read.align_clip_end} #{read.start_in_consensus}"
30
+ puts read.fasta[read.align_clip_start.to_i..read.align_clip_end.to_i]
30
31
  end
31
32
 
32
33
  # get position_table
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: scbi_cominer
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.3
5
+ version: 0.0.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Dario Guerrero