Class: Bio::PolyploidTools::Marker
- Inherits:
-
Object
- Object
- Bio::PolyploidTools::Marker
- Includes:
- Comparable
- Defined in:
- lib/bio/PolyploidTools/Marker.rb
Instance Attribute Summary collapse
-
#best_hit ⇒ Object
Returns the value of attribute best_hit.
-
#chr ⇒ Object
Returns the value of attribute chr.
-
#chr_arm ⇒ Object
Returns the value of attribute chr_arm.
- #contig ⇒ Object
-
#coordinates_chr ⇒ Object
Returns the value of attribute coordinates_chr.
-
#distance_cm ⇒ Object
Returns the value of attribute distance_cm.
-
#index_90k ⇒ Object
Returns the value of attribute index_90k.
-
#map_order ⇒ Object
Returns the value of attribute map_order.
-
#original ⇒ Object
readonly
include Virgola.
-
#sequence ⇒ Object
Returns the value of attribute sequence.
-
#snp ⇒ Object
readonly
include Virgola.
-
#snp_id ⇒ Object
Returns the value of attribute snp_id.
-
#snp_name ⇒ Object
Returns the value of attribute snp_name.
-
#template_sequence ⇒ Object
readonly
include Virgola.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(anOter) ⇒ Object
-
#initialize(line) ⇒ Marker
constructor
A new instance of Marker.
- #to_csv ⇒ Object
-
#to_fasta ⇒ Object
after_map :parse_sequence_snp.
Constructor Details
#initialize(line) ⇒ Marker
Returns a new instance of Marker.
42 43 44 45 46 47 48 |
# File 'lib/bio/PolyploidTools/Marker.rb', line 42 def initialize(line) line.chomp! @template_sequence = nil #INDEX_90K,SNP_ID,SNP_NAME,CHR,COORDINATES_CHR,MAP_ORDER,CHR_ARM,DISTANCE_CM,SEQUENCE @index_90k, @snp_id, @snp_name, @chr, @coordinates_chr, @map_order, @chr_arm, @distance_cm, @sequence, @contig = line.split(',') parse_sequence_snp end |
Instance Attribute Details
#best_hit ⇒ Object
Returns the value of attribute best_hit.
6 7 8 |
# File 'lib/bio/PolyploidTools/Marker.rb', line 6 def best_hit @best_hit end |
#chr ⇒ Object
Returns the value of attribute chr.
10 11 12 |
# File 'lib/bio/PolyploidTools/Marker.rb', line 10 def chr @chr end |
#chr_arm ⇒ Object
Returns the value of attribute chr_arm.
13 14 15 |
# File 'lib/bio/PolyploidTools/Marker.rb', line 13 def chr_arm @chr_arm end |
#contig ⇒ Object
26 27 28 29 |
# File 'lib/bio/PolyploidTools/Marker.rb', line 26 def contig @contig = best_hit.target_id.chomp if best_hit @contig end |
#coordinates_chr ⇒ Object
Returns the value of attribute coordinates_chr.
11 12 13 |
# File 'lib/bio/PolyploidTools/Marker.rb', line 11 def coordinates_chr @coordinates_chr end |
#distance_cm ⇒ Object
Returns the value of attribute distance_cm.
14 15 16 |
# File 'lib/bio/PolyploidTools/Marker.rb', line 14 def distance_cm @distance_cm end |
#index_90k ⇒ Object
Returns the value of attribute index_90k.
7 8 9 |
# File 'lib/bio/PolyploidTools/Marker.rb', line 7 def index_90k @index_90k end |
#map_order ⇒ Object
Returns the value of attribute map_order.
12 13 14 |
# File 'lib/bio/PolyploidTools/Marker.rb', line 12 def map_order @map_order end |
#original ⇒ Object (readonly)
include Virgola
5 6 7 |
# File 'lib/bio/PolyploidTools/Marker.rb', line 5 def original @original end |
#sequence ⇒ Object
Returns the value of attribute sequence.
15 16 17 |
# File 'lib/bio/PolyploidTools/Marker.rb', line 15 def sequence @sequence end |
#snp ⇒ Object (readonly)
include Virgola
5 6 7 |
# File 'lib/bio/PolyploidTools/Marker.rb', line 5 def snp @snp end |
#snp_id ⇒ Object
Returns the value of attribute snp_id.
8 9 10 |
# File 'lib/bio/PolyploidTools/Marker.rb', line 8 def snp_id @snp_id end |
#snp_name ⇒ Object
Returns the value of attribute snp_name.
9 10 11 |
# File 'lib/bio/PolyploidTools/Marker.rb', line 9 def snp_name @snp_name end |
#template_sequence ⇒ Object (readonly)
include Virgola
5 6 7 |
# File 'lib/bio/PolyploidTools/Marker.rb', line 5 def template_sequence @template_sequence end |
Class Method Details
Instance Method Details
#<=>(anOter) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/bio/PolyploidTools/Marker.rb', line 35 def <=>(anOter) return 0 if anOter.snp_name == @snp_name return @chr_arm <=> anOter.chr_arm if anOter.chr_arm != @chr_arm return @snp_name <=> anOter.snp_name if anOter.coordinates_chr == @coordinates_chr return @coordinates_chr <=> anOter.coordinates_chr end |
#to_csv ⇒ Object
31 32 33 |
# File 'lib/bio/PolyploidTools/Marker.rb', line 31 def to_csv "#{index_90k},#{snp_id},#{snp_name},#{chr},#{coordinates_chr},#{map_order},#{chr_arm},#{distance_cm},#{sequence},#{contig}" end |
#to_fasta ⇒ Object
after_map :parse_sequence_snp
22 23 24 |
# File 'lib/bio/PolyploidTools/Marker.rb', line 22 def to_fasta ">#{self.snp_name}\n#{self.template_sequence}" end |