Class: Bio::Assembly::Contig
- Inherits:
-
Object
- Object
- Bio::Assembly::Contig
- Defined in:
- lib/bio-assembly/contig.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#from ⇒ Object
Returns the value of attribute from.
-
#name ⇒ Object
Returns the value of attribute name.
-
#orientation ⇒ Object
Returns the value of attribute orientation.
-
#quality ⇒ Object
Returns the value of attribute quality.
-
#reads ⇒ Object
Returns the value of attribute reads.
-
#seq ⇒ Object
(also: #consensus_seq)
Returns the value of attribute seq.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #add_read(read) ⇒ Object
- #each_read ⇒ Object
- #find_read_by_name(name) ⇒ Object
- #find_reads_in_range(clear_range_from, clear_range_to) ⇒ Object
-
#initialize(str = "") ⇒ Contig
constructor
A new instance of Contig.
- #num_base_segments ⇒ Object
- #num_bases ⇒ Object
- #num_reads ⇒ Object
Constructor Details
Instance Attribute Details
#from ⇒ Object
Returns the value of attribute from.
7 8 9 |
# File 'lib/bio-assembly/contig.rb', line 7 def from @from end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/bio-assembly/contig.rb', line 7 def name @name end |
#orientation ⇒ Object
Returns the value of attribute orientation.
7 8 9 |
# File 'lib/bio-assembly/contig.rb', line 7 def orientation @orientation end |
#quality ⇒ Object
Returns the value of attribute quality.
7 8 9 |
# File 'lib/bio-assembly/contig.rb', line 7 def quality @quality end |
#reads ⇒ Object
Returns the value of attribute reads.
7 8 9 |
# File 'lib/bio-assembly/contig.rb', line 7 def reads @reads end |
#seq ⇒ Object Also known as: consensus_seq
Returns the value of attribute seq.
7 8 9 |
# File 'lib/bio-assembly/contig.rb', line 7 def seq @seq end |
#to ⇒ Object
Returns the value of attribute to.
7 8 9 |
# File 'lib/bio-assembly/contig.rb', line 7 def to @to end |
Instance Method Details
#add_read(read) ⇒ Object
40 41 42 43 |
# File 'lib/bio-assembly/contig.rb', line 40 def add_read(read) # TODO do some checks for pos location @reads[read.name] = read end |
#each_read ⇒ Object
45 46 47 |
# File 'lib/bio-assembly/contig.rb', line 45 def each_read @reads.each_value { |read| yield read } end |
#find_read_by_name(name) ⇒ Object
17 18 19 |
# File 'lib/bio-assembly/contig.rb', line 17 def find_read_by_name(name) @reads[name] end |
#find_reads_in_range(clear_range_from, clear_range_to) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/bio-assembly/contig.rb', line 21 def find_reads_in_range(clear_range_from, clear_range_to) reads_in_range = Array.new each_read do |read| # Read starts in region if read.from+read.clear_range_from > clear_range_from and read.from+read.clear_range_from < clear_range_to reads_in_range.push read # Read ends in region elsif read.to+read.clear_range_to < clear_range_to and read.to+read.clear_range_to > clear_range_from reads_in_range.push read # Read encompasses region elsif read.from+read.clear_range_from < clear_range_from and read.to+read.clear_range_to > clear_range_to reads_in_range.push read end end reads_in_range; end |
#num_base_segments ⇒ Object
61 62 63 64 65 66 67 |
# File 'lib/bio-assembly/contig.rb', line 61 def num_base_segments num_base_sequences = 0 each_read do |read| num_base_sequences += read.base_sequences.size unless read.base_sequences.nil? end num_base_sequences end |
#num_bases ⇒ Object
53 54 55 |
# File 'lib/bio-assembly/contig.rb', line 53 def num_bases seq.length end |
#num_reads ⇒ Object
49 50 51 |
# File 'lib/bio-assembly/contig.rb', line 49 def num_reads @reads.size end |