class Exodb::Isoform
Public Instance Methods
Get exon location
@return [Bio::Locations] of exon
# File lib/exodb/datamodel/isoform.rb, line 63 def cds_location return Bio::Locations.new(genbank_loc(:cds, :abs)) end
Get spliced coding region sequence
@param [Integer] end position to get sequence
@return [Bio::Sequence] an coding region sequence
# File lib/exodb/datamodel/isoform.rb, line 79 def cds_seq return self.generef.whole_seq.splice(genbank_loc(:cds, :trela)) end
Get the codon sequence at the giving position base on position of amino acid
@param [Integer] codon position @return [Bio::Sequence] the codon at given position
# File lib/exodb/datamodel/isoform.rb, line 108 def codon_at(codon_pos) return self.cds_seq.subseq(((codon_pos - 1) * 3) + 1 , ((codon_pos - 1) * 3) + 3) end
predict efect of variants
@param [array] list of variants
@return [array] list of predicted effect SPL-D splice_donor_variant SO:0001575 SPL-A splice_acceptor_variant SO:0001574 SPL-R splice_region_variant SO:0001630 COD-SS COD-SN COD-DS COD-DN COD-IS COD-IN UTR-3 UTR-5 INT INI STO-L STO-G PRO TFB
# File lib/exodb/datamodel/isoform.rb, line 204 def effect_pred(position, alt) results = [] prot_pos = genomic2prot_pos(position) if prot_pos case alt when /^-([ATCG])+/ results.push({vartype: $1.length % 3 == 0 ? 'COD-DS' : 'COD-DN'}) when /^\+([ATCG])+/ results.push({vartype: ($1.length - 1) % 3 == 0 ? 'COD-IS' : 'COD-IN'}) else results.push({vartype: 'COD-SS'}) end else #case #when test # #code #when test # #code #else # results.push({vartype: 'INT'}) #end end results.push({vartype: splice_rel_location[position]}) if splice_rel_location.has_key?(position) return results end
Get exon location
@return [Bio::Locations] of exon
# File lib/exodb/datamodel/isoform.rb, line 56 def exon_location return Bio::Locations.new(genbank_loc(:exon, :abs)) end
convert genomic position to cds position
@param [Integer] genomic position @return [Integer] Return all information of cds at given position
# File lib/exodb/datamodel/isoform.rb, line 116 def genomic2cds_pos(pos) cds_location.relative(pos) end
convert genomic position to cds position
@param [Integer] genomic position @return [Array] Return [codon and position in codon]
# File lib/exodb/datamodel/isoform.rb, line 124 def genomic2prot_pos(pos) cds_location.relative(pos, :aa) end
get length of spliced RNA
@return [Integer] length of spliced RNA
# File lib/exodb/datamodel/isoform.rb, line 93 def mrna_len return self.exon_location.length end
Get spliced RNA sequence
@return [Bio::Sequence] an RNA sequence
# File lib/exodb/datamodel/isoform.rb, line 70 def mrna_seq return self.return self.generef.whole_seq.splice(genbank_loc(:exon, :trela)).rna end
get length of protein product
@return [Integer] length of protein product
# File lib/exodb/datamodel/isoform.rb, line 100 def prot_len return self.cds_location.length end
Get spliced protein sequence
@return [Bio::Sequence] an protein sequence
# File lib/exodb/datamodel/isoform.rb, line 86 def prot_seq return self.cds_seq().translate end
get splice related position 1-3 base into exon and 3-8 base into intron
@return [Array] Return position of splice related site in array of [start, stop] SPL-D splice_donor_variant SO:0001575 SPL-A splice_acceptor_variant SO:0001574 SPL-R splice_region_variant SO:0001630
# File lib/exodb/datamodel/isoform.rb, line 134 def splice_rel_location if @splice_location == nil results = {} right = nil self[:exon].each do |exon| if !right.blank? if self.generef.strand == '+' results[right + 1] = 'SPL-D' results[right + 2] = 'SPL-D' results[exon[0] - 1] = 'SPL-A' results[exon[0] - 2] = 'SPL-A' else results[right + 1] = 'SPL-A' results[right + 2] = 'SPL-A' results[exon[0] - 1] = 'SPL-D' results[exon[0] - 2] = 'SPL-D' end Range.new(right - 2, right).each {|e| results[e] = 'SPL-R'} Range.new(right + 3, right + 8).each {|e| results[e] = 'SPL-R'} Range.new(exon[0], exon[0] + 2).each {|e| results[e] = 'SPL-R'} Range.new(exon[0] - 3, exon[0] - 8).each {|e| results[e] = 'SPL-R'} right = exon[1] else right = exon[1] end end @splice_location = results return results else return @splice_location end end
# File lib/exodb/datamodel/isoform.rb, line 178 def utr3location return Bio::Locations.new(self.generef.strand == '+' ? "#{self[:cds][-1][1] + 1}..#{self[:exon][-1][1]}" : "complement(#{self[:exon][0][0]}..#{self[:cds][0][0] - 1})") end
# File lib/exodb/datamodel/isoform.rb, line 174 def utr5location return Bio::Locations.new(self.generef.strand == '+' ? "#{self[:exon][0][0]}..#{self[:cds][0][0] - 1}" : "complement(#{self[:cds][-1][1] + 1}..#{self[:exon][-1][1]})") end
Protected Instance Methods
generate genbank style location string
@param [Symbol] field to generate [:exon, :cds] @param [Symbol] type to generate [:rel, :abs, :trela]
@return [String] a location string
# File lib/exodb/datamodel/isoform.rb, line 31 def genbank_loc(field, type) reducer = case type.to_sym when :rel self.generef[:start] - 1 when :trela self.generef[:seqstart] - 1 else 0 end loc = [] self[field.to_sym].each do |pos| loc.push("#{pos[0] - reducer}..#{pos[1] - reducer}") end return self.generef.strand == '+' ? "join(#{loc.join(',')})" : "complement(join(#{loc.join(',')}))" end