Class: Bio::PolyploidTools::SNPSequence

Inherits:
SNP
  • Object
show all
Defined in:
lib/bio/PolyploidTools/SNPSequence.rb

Direct Known Subclasses

SNPMutant

Instance Attribute Summary collapse

Attributes inherited from SNP

#chromosome, #container, #contig, #errors, #exon_list, #flanking_size, #gene, #genomes_count, #hit_count, #ideal_max, #ideal_min, #max_hits, #orientation, #original, #original_name, #position, #primer_3_min_seq_length, #repetitive, #snp, #snp_in, #snp_type, #template_sequence, #use_reference, #variation_free_region

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SNP

#add_exon, #aligned_sequences, #aligned_sequences_fasta, #aligned_snp_position, #chromosome_genome, #chromosome_group, #covered_region, #cut_and_pad_sequence_to_primer_region, #cut_sequence_to_primer_region, #exon_for_chromosome, #exon_sequences, #get_snp_position_after_trim, #get_target_sequence, #initialize, #left_padding, #local_position, #mask_aligned_chromosomal_snp, #padded_position, #parental_sequences, parseVCF, #primer_3_all_strings, #primer_3_string, #primer_fasta_string, #primer_region, #return_primer_3_string, #reverse_complement_string, #right_padding, #sequences_to_align, #setTemplateFromFastaFile, #short_s, #snp_id_in_seq, #surrounding_exon_sequences, #surrounding_masked_chromosomal_snps, #surrounding_parental_sequences, #to_fasta, #to_polymarker_coordinates, #to_polymarker_sequence, #to_s

Constructor Details

This class inherits a constructor from Bio::PolyploidTools::SNP

Instance Attribute Details

#sequence_originalObject

Returns the value of attribute sequence_original.



10
11
12
# File 'lib/bio/PolyploidTools/SNPSequence.rb', line 10

def sequence_original
  @sequence_original
end

Class Method Details

.parse(reg_str) ⇒ Object

Format: snp name,chromsome from contig,microarray sequence BS00068396_51,2AS,CGAAGCGATCCTACTACATTGCGTTCCTTTCCCACTCCCAGGTCCCCCTAATGCAGGATCTTGATTAGTCGTGTGAACAACTGAAATTTGAGCGCCACAA



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/bio/PolyploidTools/SNPSequence.rb', line 14

def self.parse(reg_str)
  reg_str.chomp!
  snp = SNPSequence.new

  arr = reg_str.split(",")
  
  if arr.size == 3
    snp.gene, snp.chromosome, snp.sequence_original = arr
  elsif arr.size == 2
   snp.gene, snp.sequence_original = arr
   snp.chromosome = ""
 else
   throw SNPSequenceException.new "Need two or three fields to parse, and got #{arr.size} in #{reg_str}"
  end
  #snp.position = snp.position.to_i
  #snp.original.upcase!
  #snp.snp.upcase!  
  snp.chromosome. strip!
  snp.parse_sequence_snp
  
  snp
end

Instance Method Details

#parse_sequence_snpObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/bio/PolyploidTools/SNPSequence.rb', line 37

def parse_sequence_snp
  pos = 0
  match_data = /(?<pre>\w*)\[(?<org>[ACGT])\/(?<snp>[ACGT])\](?<pos>\w*)/.match(sequence_original.strip)
  if match_data
    @position = Regexp.last_match(:pre).size + 1
    @original = Regexp.last_match(:org)
    @snp = Regexp.last_match(:snp)
    
    amb_base = Bio::NucleicAcid.to_IUAPC("#{@original}#{@snp}")
    
    @template_sequence = "#{Regexp.last_match(:pre)}#{amb_base}#{Regexp.last_match(:pos)}"
    
 end 
end