Class: Exodb::Isoform

Inherits:
Object
  • Object
show all
Includes:
XrefsField, Mongoid::Document
Defined in:
lib/exodb/datamodel/isoform.rb

Instance Method Summary collapse

Methods included from XrefsField

#get_xref

Instance Method Details

#cds_locationBio::Locations

Get exon location

Returns:

  • (Bio::Locations)

    of exon


63
64
65
# File 'lib/exodb/datamodel/isoform.rb', line 63

def cds_location
	return Bio::Locations.new(genbank_loc(:cds, :abs))
end

#cds_seqBio::Sequence

Get spliced coding region sequence

Parameters:

  • end (Integer)

    position to get sequence

Returns:

  • (Bio::Sequence)

    an coding region sequence


79
80
81
# File 'lib/exodb/datamodel/isoform.rb', line 79

def cds_seq
	return self.generef.whole_seq.splice(genbank_loc(:cds, :trela))
end

#codon_at(codon_pos) ⇒ Bio::Sequence

Get the codon sequence at the giving position base on position of amino acid

Parameters:

  • codon (Integer)

    position

Returns:

  • (Bio::Sequence)

    the codon at given position


108
109
110
# 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

#effect_pred(position, alt) ⇒ array

predict efect of variants

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

Parameters:

  • list (array)

    of variants

Returns:

  • (array)

    list of predicted effect


204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# 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

#exon_locationBio::Locations

Get exon location

Returns:

  • (Bio::Locations)

    of exon


56
57
58
# File 'lib/exodb/datamodel/isoform.rb', line 56

def exon_location
	return Bio::Locations.new(genbank_loc(:exon, :abs))
end

#genomic2cds_pos(pos) ⇒ Integer

convert genomic position to cds position

Parameters:

  • genomic (Integer)

    position

Returns:

  • (Integer)

    Return all information of cds at given position


116
117
118
# File 'lib/exodb/datamodel/isoform.rb', line 116

def genomic2cds_pos(pos)
	cds_location.relative(pos)
end

#genomic2prot_pos(pos) ⇒ Array

convert genomic position to cds position

Parameters:

  • genomic (Integer)

    position

Returns:

  • (Array)

    Return [codon and position in codon]


124
125
126
# File 'lib/exodb/datamodel/isoform.rb', line 124

def genomic2prot_pos(pos)
	cds_location.relative(pos, :aa)
end

#mrna_lenInteger

get length of spliced RNA

Returns:

  • (Integer)

    length of spliced RNA


93
94
95
# File 'lib/exodb/datamodel/isoform.rb', line 93

def mrna_len
	return self.exon_location.length
end

#mrna_seqBio::Sequence

Get spliced RNA sequence

Returns:

  • (Bio::Sequence)

    an RNA sequence


70
71
72
# 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

#prot_lenInteger

get length of protein product

Returns:

  • (Integer)

    length of protein product


100
101
102
# File 'lib/exodb/datamodel/isoform.rb', line 100

def prot_len
	return self.cds_location.length
end

#prot_seqBio::Sequence

Get spliced protein sequence

Returns:

  • (Bio::Sequence)

    an protein sequence


86
87
88
# File 'lib/exodb/datamodel/isoform.rb', line 86

def prot_seq
	return self.cds_seq().translate
end

#splice_rel_locationArray

get splice related position 1-3 base into exon and 3-8 base into intron

SPL-D splice_donor_variant SO:0001575 SPL-A splice_acceptor_variant SO:0001574 SPL-R splice_region_variant SO:0001630

Returns:

  • (Array)

    Return position of splice related site in array of [start, stop]


134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# 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

#utr3locationObject


178
179
180
# 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

#utr5locationObject


174
175
176
# 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