transrate 1.0.0.alpha.8.bowtie → 1.0.0.beta1

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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/README.md +2 -0
  4. data/bin/transrate +3 -5
  5. data/deps/deps.yaml +12 -20
  6. data/lib/transrate.rb +1 -1
  7. data/lib/transrate/assembly.rb +21 -0
  8. data/lib/transrate/contig.rb +33 -3
  9. data/lib/transrate/express.rb +29 -24
  10. data/lib/transrate/read_metrics.rb +40 -28
  11. data/lib/transrate/sam_checker.rb +6 -31
  12. data/lib/transrate/samtools.rb +1 -1
  13. data/lib/transrate/score_optimiser.rb +31 -0
  14. data/lib/transrate/snap.rb +28 -3
  15. data/lib/transrate/transrater.rb +5 -10
  16. data/lib/transrate/version.rb +1 -1
  17. data/test/data/express_results.xprs +5 -0
  18. data/test/test_bin.rb +2 -8
  19. data/test/test_express.rb +22 -0
  20. data/test/test_read_metrics.rb +17 -29
  21. data/test/test_transrater.rb +1 -1
  22. data/test/vagrant/centos_6.5_64/Vagrantfile +122 -0
  23. data/test/vagrant/debian_7.4_64/Vagrantfile +126 -0
  24. data/test/vagrant/debian_7.4_64/provision.sh +28 -0
  25. data/test/vagrant/fedora_20_64/Vagrantfile +122 -0
  26. data/test/vagrant/fedora_20_64/provision.sh +16 -0
  27. data/test/vagrant/fedora_20_64/sample_data/params.xprs +182 -0
  28. data/test/vagrant/fedora_20_64/sample_data/reads_1.fastq +40000 -0
  29. data/test/vagrant/fedora_20_64/sample_data/reads_1.fastq-reads_2.fastq-read_count.txt +1 -0
  30. data/test/vagrant/fedora_20_64/sample_data/reads_2.fastq +40000 -0
  31. data/test/vagrant/fedora_20_64/sample_data/transcripts.fasta +498 -0
  32. data/test/vagrant/fedora_20_64/sample_data/transcripts.fasta_results.xprs +16 -0
  33. data/test/vagrant/fedora_20_64/sample_data/transcripts/Genome +17 -0
  34. data/test/vagrant/fedora_20_64/sample_data/transcripts/GenomeIndex +1 -0
  35. data/test/vagrant/fedora_20_64/sample_data/transcripts/GenomeIndexHash +0 -0
  36. data/test/vagrant/fedora_20_64/sample_data/transcripts/OverflowTable +0 -0
  37. data/test/vagrant/ubuntu_12.04_64/Vagrantfile +126 -0
  38. data/test/vagrant/ubuntu_12.04_64/provision.sh +24 -0
  39. data/test/vagrant/ubuntu_12.04_64/sample_data/params.xprs +182 -0
  40. data/test/vagrant/ubuntu_12.04_64/sample_data/reads_1.fastq +40000 -0
  41. data/test/vagrant/ubuntu_12.04_64/sample_data/reads_1.fastq-reads_2.fastq-read_count.txt +1 -0
  42. data/test/vagrant/ubuntu_12.04_64/sample_data/reads_2.fastq +40000 -0
  43. data/test/vagrant/ubuntu_12.04_64/sample_data/transcripts.fasta +498 -0
  44. data/test/vagrant/ubuntu_12.04_64/sample_data/transcripts.fasta_results.xprs +16 -0
  45. data/test/vagrant/ubuntu_12.04_64/sample_data/transcripts/Genome +17 -0
  46. data/test/vagrant/ubuntu_12.04_64/sample_data/transcripts/GenomeIndex +1 -0
  47. data/test/vagrant/ubuntu_12.04_64/sample_data/transcripts/GenomeIndexHash +0 -0
  48. data/test/vagrant/ubuntu_12.04_64/sample_data/transcripts/OverflowTable +0 -0
  49. data/transrate.gemspec +4 -4
  50. metadata +111 -71
  51. data/lib/transrate/bowtie.rb +0 -103
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f6903da751cadec5102d2fa7e9c2381a9c39a25
4
- data.tar.gz: bf9b30c2e334ae98ad6d959b085d521d43e5daf4
3
+ metadata.gz: 015defaf8abd6b99791790ba1d59b016345c78b7
4
+ data.tar.gz: ea71a0e84c35c4fbc002314f8730530671c5b38c
5
5
  SHA512:
6
- metadata.gz: 97cdf2d6c922b1c0a901a1aa8f6e85013a8ec0c9cff54795b8bba3fa903efa7ef2ae4673c8e71e8ee292326eaadbf3ee617094c978a4fd39c836f6d8fb0d0672
7
- data.tar.gz: 08ae932477980abe97b2b7fe874a14bd170688b1f8f60472971f21cc2ae0c7bb742d9a5c89ee923ccf5c476c4e59c5863a02a2e1994b4deb74e13e228e792136
6
+ metadata.gz: 1c27bdcb6cdc2bf1c855fd8d30e1b834a09e1557974880b7f18a06f0eca7cd383504237a2f299bfa90e1f52bcbe3395b9b263d021c3ebc3bd02f092f6df9115d
7
+ data.tar.gz: bdcbe15c1dcd33233aada0b55955c8ad6d7cf1cc73f54893ea131f2e7f445b6447d9d2f47de8a1b82786413db275966d3e7db80d65e84a020020d2c22b74a3f1
data/.gitignore CHANGED
@@ -46,3 +46,6 @@ Makefile
46
46
  transrate.bundle
47
47
  transrate.o
48
48
  .RUBYARCHDIR.time
49
+
50
+ # vagrant stuff
51
+ .vagrant
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
  <img alt="Transrate - understand your transcriptome assembly" src="https://github.com/Blahah/transrate/raw/master/docs/transrate_logo_full.png">
3
3
  </p>
4
4
 
5
+ Need help? Chat to us live: [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/Blahah/transrate?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
6
+
5
7
  ## Development status
6
8
 
7
9
  [![Gem Version](http://img.shields.io/gem/v/transrate.svg)][gem]
data/bin/transrate CHANGED
@@ -58,7 +58,7 @@ opts = Trollop::options do
58
58
  opt :outfile, "prefix filename to use for CSV output",
59
59
  :default => 'transrate'
60
60
  opt :loglevel, "the amount of information to print. " +
61
- "one of [error, warn, info, debug]",
61
+ "one of [error, info, warn, debug]",
62
62
  :default => 'info'
63
63
  opt :install_deps, "install any missing dependencies"
64
64
  end
@@ -142,8 +142,6 @@ end
142
142
 
143
143
  logger.level = Yell::Level.new opts.loglevel.to_sym
144
144
 
145
- logger.info "Loading reference dataset"
146
-
147
145
  r = opts.reference ? Assembly.new(opts.reference) : nil
148
146
  report_width = 35
149
147
 
@@ -176,7 +174,7 @@ opts.assembly.split(',').each do |assembly|
176
174
  pretty_print_hash(contig_results, report_width)
177
175
  end
178
176
 
179
- logger.info "Contig metrics done in #{(Time.now - t0).round(1)} seconds"
177
+ logger.info "Contig metrics done in #{Time.now - t0} seconds"
180
178
 
181
179
  read_results = {}
182
180
 
@@ -221,7 +219,7 @@ opts.assembly.split(',').each do |assembly|
221
219
  if (opts.left && opts.right)
222
220
  score = transrater.assembly_score
223
221
  unless score.nil?
224
- logger.info "TRANSRATE ASSEMBLY SCORE: #{score.round(2)}"
222
+ logger.info "TRANSRATE ASSEMBLY SCORE: #{score.round(4)}"
225
223
  logger.info "-" * report_width
226
224
  end
227
225
  end
data/deps/deps.yaml CHANGED
@@ -25,24 +25,16 @@ blastplus:
25
25
  64bit:
26
26
  macosx: ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.2.29/ncbi-blast-2.2.29+-universal-macosx.tar.gz
27
27
  linux: ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.2.29/ncbi-blast-2.2.29+-x64-linux.tar.gz
28
- bowtie2:
28
+ snap:
29
29
  binaries:
30
- - bowtie2
31
- - bowtie2-align-l
32
- - bowtie2-align-s
33
- - bowtie2-build
34
- - bowtie2-build-l
35
- - bowtie2-build-s
36
- - bowtie2-inspect
37
- - bowtie2-inspect-l
38
- - bowtie2-inspect-s
30
+ - snap
39
31
  version:
40
- number: '2.2.3'
41
- command: 'bowtie2 --version'
32
+ number: '1.0dev.63'
33
+ command: 'snap'
42
34
  url:
43
35
  64bit:
44
- linux: http://downloads.sourceforge.net/project/bowtie-bio/bowtie2/2.2.3/bowtie2-2.2.3-linux-x86_64.zip
45
- macosx: http://downloads.sourceforge.net/project/bowtie-bio/bowtie2/2.2.3/bowtie2-2.2.3-macos-x86_64.zip
36
+ linux: https://github.com/HibberdLab/snap/raw/dev/bin/linux/snap.tar.gz
37
+ macosx: https://github.com/HibberdLab/snap/raw/dev/bin/macosx/snap.tar.gz
46
38
  samtools:
47
39
  binaries:
48
40
  - samtools
@@ -58,23 +50,23 @@ bam-read:
58
50
  binaries:
59
51
  - bam-read
60
52
  version:
61
- number: '0.3.4'
53
+ number: '1.0.0.beta1'
62
54
  command: 'bam-read'
63
55
  url:
64
56
  64bit:
65
- linux: https://github.com/cboursnell/transrate-bam-read/raw/master/bin/linux/bam-read
66
- macosx: https://github.com/Blahah/transrate-bam-read/raw/master/bin/macosx/bam-read
57
+ linux: https://github.com/cboursnell/transrate-tools/raw/master/bin/linux/bam-read
58
+ macosx: https://github.com/Blahah/transrate-tools/raw/master/bin/macosx/bam-read
67
59
  unpack: false
68
60
  bam-split:
69
61
  binaries:
70
62
  - bam-split
71
63
  version:
72
- number: '0.2'
64
+ number: '1.0.0.beta1'
73
65
  command: 'bam-split'
74
66
  url:
75
67
  64bit:
76
- linux: https://github.com/Blahah/transrate-bam-read/raw/master/bin/linux/bam-split
77
- macosx: https://github.com/Blahah/transrate-bam-read/raw/master/bin/macosx/bam-split
68
+ linux: https://github.com/Blahah/transrate-tools/raw/master/bin/linux/bam-split
69
+ macosx: https://github.com/Blahah/transrate-tools/raw/master/bin/macosx/bam-split
78
70
  unpack: false
79
71
  express:
80
72
  binaries:
data/lib/transrate.rb CHANGED
@@ -8,7 +8,7 @@ require 'transrate/version'
8
8
  require 'transrate/contig'
9
9
  require 'transrate/assembly'
10
10
  require 'transrate/snap'
11
- require 'transrate/bowtie'
11
+ require 'transrate/score_optimiser'
12
12
  require 'transrate/express'
13
13
  require 'transrate/read_metrics'
14
14
  require 'transrate/comparative_metrics'
@@ -184,6 +184,27 @@ module Transrate
184
184
 
185
185
  end # basic_bin_stats
186
186
 
187
+ def classify_contigs
188
+ # create hash of file handles for each output
189
+ base = File.basename @file
190
+ files = Hash.new do
191
+ %w(good fragmented chimeric bad).each do |type|
192
+ handle = File.open("#{type}.#{base}", "wb")
193
+ [type.to_sym, handle]
194
+ end
195
+ end
196
+ # loop through contigs writing them out to the appropriate file
197
+ @assembly.each_pair do |name, contig|
198
+ category = contig.classify
199
+ handle = files[category]
200
+ handle.push contig.to_fasta
201
+ end
202
+ # close all the file handles
203
+ files.each do |handle|
204
+ handle.close
205
+ end
206
+ end
207
+
187
208
  end # Assembly
188
209
 
189
210
  end # Transrate
@@ -12,8 +12,9 @@ module Transrate
12
12
  # read-based metrics
13
13
  attr_accessor :eff_length, :eff_count, :tpm
14
14
  attr_accessor :coverage, :uncovered_bases, :p_uncovered_bases
15
- attr_accessor :p_seq_true, :p_unique, :in_bridges
16
- attr_accessor :p_good, :p_not_segmented
15
+ attr_accessor :p_seq_true, :p_unique
16
+ attr_accessor :low_uniqueness_bases, :in_bridges
17
+ attr_accessor :p_good, :p_not_segmented, :good
17
18
  # reference-based metrics
18
19
  attr_accessor :has_crb, :reference_coverage
19
20
  attr_accessor :hits
@@ -34,6 +35,8 @@ module Transrate
34
35
  @p_unique = 0
35
36
  @p_not_segmented = 1
36
37
  @score = -1
38
+ @good = 0
39
+ @coverage = 0
37
40
  end
38
41
 
39
42
  def each &block
@@ -232,9 +235,36 @@ module Transrate
232
235
  [p_bases_covered, 0.01].max.to_f * # proportion of bases covered
233
236
  [p_not_segmented, 0.01].max.to_f * # prob contig has 0 changepoints
234
237
  [p_good, 0.01].max.to_f * # proportion of reads that mapped good
235
- [p_seq_true, 0.01].max.to_f
238
+ [p_seq_true, 0.01].max.to_f # scaled 1 - mean per-base edit distance
236
239
  @score = [prod, 0.01].max
237
240
  end
241
+
242
+ # Classify the contig into one of the following classes:
243
+ # - good (score >= 0.5)
244
+ # - fragmented (in_bridges > 0) and no other problems
245
+ # - chimeric (p_not_segmented < 0.25) and no other problems
246
+ # - bad (score < 0.5 and not in any other category)
247
+ def classify
248
+ return :good if score >= 0.5
249
+ # fragmented?
250
+ if in_bridges > 5
251
+ if p_not_segmented * p_bases_covered * p_seq_true * p_unique >= 0.5
252
+ return :fragmented
253
+ end
254
+ end
255
+ # chimeric?
256
+ if p_not_segmented < 0.25
257
+ if p_good * p_bases_covered * p_seq_true * p_unique >= 0.5
258
+ return :chimeric
259
+ end
260
+ end
261
+ return :bad
262
+ end
263
+
264
+ def to_fasta
265
+ @seq.seq.to_fasta(@name)
266
+ end
267
+
238
268
  end
239
269
 
240
270
  end
@@ -8,6 +8,8 @@ module Transrate
8
8
 
9
9
  require 'ostruct'
10
10
 
11
+ attr_reader :fin_output
12
+
11
13
  # return an Express object
12
14
  def initialize
13
15
  which = Cmd.new('which express')
@@ -26,31 +28,34 @@ module Transrate
26
28
  assembly = assembly.file if assembly.is_a? Assembly
27
29
 
28
30
  ex_output = 'results.xprs'
29
- fin_output = "#{File.basename assembly}_#{ex_output}"
31
+ @fin_output = "#{File.basename assembly}_#{ex_output}"
30
32
 
31
- unless File.exists? fin_output
33
+ unless File.exists? @fin_output
32
34
  runner = Cmd.new build_command(assembly, bamfile)
33
35
  runner.run
34
36
  unless runner.status.success?
35
- abort "express failed on the bam file\n#{runner.stderr}"
37
+ logger.warn "express failed. cleaning sam file and trying again"
38
+ File.delete("hits.1.samp.bam")
39
+ fix_problem_snap_output bamfile
40
+ runner.run
41
+ unless runner.status.success?
42
+ abort "express failed on the cleaned sam file\n#{runner.stderr}"
43
+ end
36
44
  end
37
- File.rename(ex_output, fin_output)
45
+ File.rename(ex_output, @fin_output)
38
46
  end
39
-
40
- OpenStruct.new(:results_file => fin_output,
41
- :expression => load_expression(fin_output),
42
- :align_samp => 'hits.1.samp.bam')
47
+ return 'hits.1.samp.bam'
43
48
  end
44
49
 
45
50
  # return the constructed eXpress command
46
51
  def build_command assembly, bamfile
47
52
  cmd = "#{@express}"
48
- cmd << " #{File.expand_path assembly}"
49
- cmd << " #{File.expand_path bamfile}"
50
53
  cmd << " --output-dir ."
51
54
  cmd << " --output-align-samp"
52
55
  cmd << " --no-update-check"
53
56
  cmd << " --additional-online 1"
57
+ cmd << " #{File.expand_path assembly}"
58
+ cmd << " #{File.expand_path bamfile}"
54
59
  cmd
55
60
  end
56
61
 
@@ -60,7 +65,7 @@ module Transrate
60
65
  expression = {}
61
66
  first = true
62
67
  File.open(file).each do |line|
63
- if first
68
+ if first # skip header line
64
69
  first = false
65
70
  next
66
71
  end
@@ -78,19 +83,19 @@ module Transrate
78
83
  expression
79
84
  end
80
85
 
81
- # def fix_problem_snap_output bam
82
- # # express failed, probably because of temporary snap error
83
- # # convert bam to sam
84
- # sam = "#{File.expand_path(File.basename(bam, File.extname(bam)))}.sam"
85
- # Samtools.run "view -h #{bam} > #{sam}"
86
- # # run sam fixer on sam
87
- # checker = SamChecker.new
88
- # fixed_sam = "#{File.expand_path(File.basename(sam, File.extname(sam)))}.fixed.sam"
89
- # checker.fix_sam(sam, fixed_sam)
90
- # # convert sam to bam
91
- # Samtools.run "view -bS #{fixed_sam} > #{bam}"
92
- # bam
93
- # end
86
+ def fix_problem_snap_output bam
87
+ # express failed, probably because of temporary snap error
88
+ # convert bam to sam
89
+ sam = "#{File.expand_path(File.basename(bam, File.extname(bam)))}.sam"
90
+ Samtools.run "view -h #{bam} > #{sam}"
91
+ # run sam fixer on sam
92
+ checker = SamChecker.new
93
+ fixed_sam = "#{File.expand_path(File.basename(sam, File.extname(sam)))}.fixed.sam"
94
+ checker.fix_sam(sam, fixed_sam)
95
+ # convert sam to bam
96
+ Samtools.run "view -bS #{fixed_sam} > #{bam}"
97
+ bam
98
+ end
94
99
 
95
100
  end # Express
96
101
 
@@ -2,16 +2,16 @@ module Transrate
2
2
 
3
3
  class ReadMetrics
4
4
 
5
- attr_reader :fragments_mapping
6
- attr_reader :p_good_mapping
7
- attr_reader :bad
5
+ attr_reader :fragments, :fragments_mapping, :p_good_mapping
6
+ attr_reader :good, :bad
8
7
  attr_reader :supported_bridges
9
8
  attr_reader :has_run
10
9
  attr_reader :read_length
11
10
 
12
11
  def initialize assembly
13
12
  @assembly = assembly
14
- @mapper = Bowtie2.new
13
+ @mapper = Snap.new
14
+ @express = Express.new
15
15
  self.initial_values
16
16
 
17
17
  load_executables
@@ -47,31 +47,36 @@ module Transrate
47
47
  @read_length = get_read_length(left, right)
48
48
 
49
49
  # map reads
50
- @mapper.build_index(@assembly.file)
51
- samfile = @mapper.map_reads(@assembly.file, left, right,
50
+ @mapper.build_index(@assembly.file, threads)
51
+ bamfile = @mapper.map_reads(@assembly.file, left, right,
52
52
  insertsize: insertsize,
53
53
  insertsd: insertsd,
54
54
  threads: threads)
55
55
  @fragments = @mapper.read_count
56
- bamfile = Samtools.sam_to_bam(samfile)
57
- File.delete samfile
58
56
 
59
- # classify bam file into valid and invalid alignments
60
57
  sorted_bam = "#{File.basename(bamfile, '.bam')}.merged.sorted.bam"
61
58
  merged_bam = "#{File.basename(bamfile, '.bam')}.merged.bam"
62
- valid_bam, invalid_bam = split_bam bamfile
63
- readsorted_bam = Samtools.readsort_bam valid_bam
59
+ assigned_bam = "hits.1.samp.bam"
60
+ readsorted_bam = "#{File.basename(bamfile, '.bam')}.readsorted.bam"
61
+ valid_bam = "#{File.basename(bamfile, '.bam')}.valid.bam"
62
+ invalid_bam = "#{File.basename(bamfile, '.bam')}.invalid.bam"
64
63
 
65
- # pass valid alignments to eXpress for assignment
66
- # always have to run the eXpress command to load the results
67
- assigned_bam = assign_and_quantify readsorted_bam
68
-
69
- # merge the assigned alignments back with the invalid ones
70
- unless File.exist? sorted_bam
71
- unless File.exist? merged_bam
64
+ # check for latest files first and create what is needed
65
+ if !File.exist?(sorted_bam)
66
+ if !File.exist?(merged_bam)
67
+ if !File.exist?(assigned_bam)
68
+ if !File.exist?(readsorted_bam)
69
+ if !File.exist?(valid_bam)
70
+ valid_bam, invalid_bam = split_bam bamfile
71
+ end
72
+ readsorted_bam = Samtools.readsort_bam(valid_bam)
73
+ File.delete valid_bam
74
+ end
75
+ assigned_bam = assign_and_quantify readsorted_bam
76
+ File.delete readsorted_bam
77
+ end
72
78
  Samtools.merge_bam(invalid_bam, assigned_bam,
73
79
  merged_bam, threads=threads)
74
-
75
80
  File.delete invalid_bam
76
81
  File.delete assigned_bam
77
82
  end
@@ -148,15 +153,13 @@ module Transrate
148
153
  end
149
154
 
150
155
  def assign_and_quantify bamfile
151
- express = Express.new
152
- results = express.run(@assembly, bamfile)
153
- analyse_expression results.expression
154
- results.align_samp
156
+ express_bam = @express.run(@assembly, bamfile)
155
157
  end
156
158
 
157
159
  def analyse_expression express_output
158
160
  express_output.each_pair do |name, expr|
159
- contig = @assembly[name]
161
+ contig_name = Bio::FastaDefline.new(name.to_s).entry_id
162
+ contig = @assembly[contig_name]
160
163
  if expr[:eff_len]==0
161
164
  coverage = 0
162
165
  else
@@ -176,7 +179,7 @@ module Transrate
176
179
  csv_output = "#{File.basename(@assembly.file)}_bam_info.csv"
177
180
  csv_output = File.expand_path(csv_output)
178
181
 
179
- analyse_bam(bamfile, csv_output)
182
+ analyse_bam bamfile, csv_output
180
183
  # open output csv file
181
184
  @potential_bridges = 0
182
185
 
@@ -189,6 +192,13 @@ module Transrate
189
192
  else
190
193
  raise "couldn't find bamfile: #{bamfile}"
191
194
  end
195
+ express_results = "#{File.basename @assembly.file}_results.xprs"
196
+
197
+ if File.exist?(express_results)
198
+ analyse_expression(@express.load_expression(express_results))
199
+ else
200
+ abort "Can't find #{express_results}"
201
+ end
192
202
  @assembly.assembly.each_pair do |name, contig|
193
203
  @contigs_good += 1 if contig.score >= 0.5
194
204
  end
@@ -212,7 +222,7 @@ module Transrate
212
222
 
213
223
  def analyse_bam bamfile, csv_output
214
224
  if !File.exist?(csv_output)
215
- cmd = "#{@bam_reader} #{bamfile} #{csv_output}"
225
+ cmd = "#{@bam_reader} #{bamfile} #{csv_output} 0.7"
216
226
  reader = Cmd.new cmd
217
227
  reader.run
218
228
  if !reader.status.success?
@@ -224,12 +234,13 @@ module Transrate
224
234
  end
225
235
 
226
236
  def populate_contig_data row
227
- contig = @assembly[row[:name]]
237
+ name = Bio::FastaDefline.new(row[:name].to_s).entry_id
238
+ contig = @assembly[name]
228
239
  scale = 0.7
229
240
  contig.p_seq_true = (row[:p_seq_true] - scale) * (1.0 / (1 - scale))
230
241
  contig.uncovered_bases = row[:bases_uncovered]
231
242
  @bases_uncovered += contig.uncovered_bases
232
- if row[:fragments_mapped] and row[:fragments_mapped] > 0
243
+ if row[:fragments_mapped] and row[:fragments_mapped] > 1
233
244
  contig.p_good = row[:good]/row[:fragments_mapped].to_f
234
245
  end
235
246
  contig.p_not_segmented = row[:p_not_segmented]
@@ -242,6 +253,7 @@ module Transrate
242
253
  @potential_bridges += 1
243
254
  end
244
255
  @fragments_mapped += row[:fragments_mapped]
256
+ contig.good = row[:good]
245
257
  @good += row[:good]
246
258
  if row[:bases_uncovered] > 0
247
259
  @contigs_uncovbase += 1