[BioRuby-cvs] bioruby/lib/bio sequence.rb,0.47,0.48
Katayama Toshiaki
k at pub.open-bio.org
Mon Nov 21 19:33:01 EST 2005
Update of /home/repository/bioruby/bioruby/lib/bio
In directory pub.open-bio.org:/tmp/cvs-serv11009/lib/bio
Modified Files:
sequence.rb
Log Message:
* added forward_complement(!) and reverse_complement(!) methods
* changed complement(!) methods to aliases of reverse_complement(!) methods
Index: sequence.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence.rb,v
retrieving revision 0.47
retrieving revision 0.48
diff -C2 -d -r0.47 -r0.48
*** sequence.rb 15 Nov 2005 14:58:57 -0000 0.47
--- sequence.rb 22 Nov 2005 00:32:59 -0000 0.48
***************
*** 46,50 ****
def self.auto(str)
! moltype = guess(str)
if moltype == NA
NA.new(str)
--- 46,50 ----
def self.auto(str)
! moltype = self.guess(str)
if moltype == NA
NA.new(str)
***************
*** 259,279 ****
end
! # Returns a reverse complement sequence (including the universal codes).
! def complement
s = self.class.new(self)
! s.complement!
s
end
! def complement!
if self.rna?
- self.reverse!
self.tr!('augcrymkdhvbswn', 'uacgyrkmhdbvswn')
else
- self.reverse!
self.tr!('atgcrymkdhvbswn', 'tacgyrkmhdbvswn')
end
self
end
# Translate into the amino acid sequence from the given frame and the
--- 259,296 ----
end
! # Returns complement sequence without reversing ("atgc" -> "tacg")
! def forward_complement
s = self.class.new(self)
! s.forward_complement!
s
end
! # Convert to complement sequence without reversing ("atgc" -> "tacg")
! def forward_complement!
if self.rna?
self.tr!('augcrymkdhvbswn', 'uacgyrkmhdbvswn')
else
self.tr!('atgcrymkdhvbswn', 'tacgyrkmhdbvswn')
end
self
end
+
+ # Returns reverse complement sequence ("atgc" -> "gcat")
+ def reverse_complement
+ s = self.class.new(self)
+ s.reverse_complement!
+ s
+ end
+
+ # Convert to reverse complement sequence ("atgc" -> "gcat")
+ def reverse_complement!
+ self.reverse!
+ self.forward_complement!
+ end
+
+ # Aliases for short
+ alias complement reverse_complement
+ alias complement! reverse_complement!
+
# Translate into the amino acid sequence from the given frame and the
More information about the bioruby-cvs
mailing list