Class: Bio::PolyploidTools::SNPMutant
- Inherits:
-
SNPSequence
- Object
- SNP
- SNPSequence
- Bio::PolyploidTools::SNPMutant
- Defined in:
- lib/bio/PolyploidTools/SNPMutant.rb
Instance Attribute Summary collapse
-
#chr ⇒ Object
Returns the value of attribute chr.
-
#contig ⇒ Object
Returns the value of attribute contig.
-
#library ⇒ Object
Returns the value of attribute library.
-
#parsed_flanking ⇒ Object
Returns the value of attribute parsed_flanking.
-
#parsed_start ⇒ Object
Returns the value of attribute parsed_start.
-
#region_size ⇒ Object
Returns the value of attribute region_size.
Attributes inherited from SNPSequence
Attributes inherited from SNP
#chromosome, #container, #errors, #exon_list, #flanking_size, #gene, #genomes_count, #hit_count, #ideal_max, #ideal_min, #max_hits, #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
-
.parse(reg_str) ⇒ Object
Format: seqid,library,position,wt_base,mut_base IWGSC_CSS_1AL_scaff_1455974,Kronos2281,127,C,T.
Instance Method Summary collapse
- #chromosome_genome ⇒ Object
- #chromosome_group ⇒ Object
- #full_sequence ⇒ Object
- #full_sequence=(seq) ⇒ Object
- #parse_sequence_snp ⇒ Object
Methods inherited from SNP
#add_exon, #aligned_sequences, #aligned_sequences_fasta, #aligned_snp_position, #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, #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
#chr ⇒ Object
Returns the value of attribute chr.
10 11 12 |
# File 'lib/bio/PolyploidTools/SNPMutant.rb', line 10 def chr @chr end |
#contig ⇒ Object
Returns the value of attribute contig.
10 11 12 |
# File 'lib/bio/PolyploidTools/SNPMutant.rb', line 10 def contig @contig end |
#library ⇒ Object
Returns the value of attribute library.
10 11 12 |
# File 'lib/bio/PolyploidTools/SNPMutant.rb', line 10 def library @library end |
#parsed_flanking ⇒ Object
Returns the value of attribute parsed_flanking.
10 11 12 |
# File 'lib/bio/PolyploidTools/SNPMutant.rb', line 10 def parsed_flanking @parsed_flanking end |
#parsed_start ⇒ Object
Returns the value of attribute parsed_start.
10 11 12 |
# File 'lib/bio/PolyploidTools/SNPMutant.rb', line 10 def parsed_start @parsed_start end |
#region_size ⇒ Object
Returns the value of attribute region_size.
10 11 12 |
# File 'lib/bio/PolyploidTools/SNPMutant.rb', line 10 def region_size @region_size end |
Class Method Details
.parse(reg_str) ⇒ Object
Format: seqid,library,position,wt_base,mut_base IWGSC_CSS_1AL_scaff_1455974,Kronos2281,127,C,T
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/bio/PolyploidTools/SNPMutant.rb', line 14 def self.parse(reg_str) reg_str.chomp! snp = SNPMutant.new arr = reg_str.split(",") throw SNPSequenceException.new "Need five fields to parse, and got #{arr.size} in #{reg_str}" if arr.size < 5 snp.contig, snp.library, snp.position, snp.original, snp.snp, parsed_flanking, region_size = reg_str.split(",") snp.position = snp.position.to_i snp.gene = "EMPTY" begin toks = snp.contig.split('_') #1AL_1455974_Kronos2281_127C #snp.chr = contig.split('_')[2][0,2] #This parses the default from the IWGSC. We may want to make this a lambda #snp.chr = toks[2][0,2] name = toks[2] + "_" + toks[4] + "_" + snp.library + "_" + snp.position.to_s snp.gene = name snp.chromosome = toks[2][0,2] snp.chr = snp.chromosome rescue Exception => e $stderr.puts "WARN: snp.chr couldnt be set, the sequence id to parse was #{snp.contig}. We expect something like: IWGSC_CSS_1AL_scaff_1455974" snp.gene = "Error" $stderr.puts e end snp.flanking_size=100 snp.region_size = region_size.to_i if region_size snp.flanking_size = parsed_flanking.to_i if parsed_flanking snp end |
Instance Method Details
#chromosome_genome ⇒ Object
61 62 63 |
# File 'lib/bio/PolyploidTools/SNPMutant.rb', line 61 def chromosome_genome chr[1] end |
#chromosome_group ⇒ Object
57 58 59 |
# File 'lib/bio/PolyploidTools/SNPMutant.rb', line 57 def chromosome_group chr[0] end |
#full_sequence ⇒ Object
53 54 55 |
# File 'lib/bio/PolyploidTools/SNPMutant.rb', line 53 def full_sequence() self.template_sequence end |
#full_sequence=(seq) ⇒ Object
47 48 49 50 51 |
# File 'lib/bio/PolyploidTools/SNPMutant.rb', line 47 def full_sequence=(seq) self.template_sequence = seq self.sequence_original = self.to_polymarker_sequence(self.flanking_size) self.parse_sequence_snp end |
#parse_sequence_snp ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/bio/PolyploidTools/SNPMutant.rb', line 70 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 |