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 +4 -0
- data/lib/scbi_cominer/classes/frequency_table.rb +15 -6
- data/lib/scbi_cominer/cominer.rb +4 -2
- data/lib/scbi_cominer.rb +1 -1
- data/test/test_scbi_cominer.rb +3 -2
- metadata +1 -1
data/History.txt
CHANGED
@@ -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
|
-
|
113
|
-
|
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|
|
data/lib/scbi_cominer/cominer.rb
CHANGED
@@ -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
|
-
|
21
|
+
puts freq_table.inspect
|
22
|
+
exit
|
21
23
|
|
22
24
|
ef = EntropyFunction.new(@freq_table)
|
23
25
|
|
data/lib/scbi_cominer.rb
CHANGED
data/test/test_scbi_cominer.rb
CHANGED
@@ -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
|