[BioRuby-cvs] bioruby/lib/bio sequence.rb,0.42,0.43
Katayama Toshiaki
k at pub.open-bio.org
Fri Sep 23 10:28:01 EDT 2005
Update of /home/repository/bioruby/bioruby/lib/bio
In directory pub.open-bio.org:/tmp/cvs-serv23142
Modified Files:
sequence.rb
Log Message:
* Bio::Sequence::NA#gc_percent is changed returns integer instead of float
* Bio::Sequence::NA#gc method is removed
* added Bio::Sequence#guess and Bio::Sequence.guess
* plugin - modified to use new guess method
Index: sequence.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence.rb,v
retrieving revision 0.42
retrieving revision 0.43
diff -C2 -d -r0.42 -r0.43
*** sequence.rb 20 Sep 2005 02:00:15 -0000 0.42
--- sequence.rb 23 Sep 2005 14:27:59 -0000 0.43
***************
*** 110,113 ****
--- 110,132 ----
end
+ def guess(threshold = 0.9)
+ cmp = self.composition
+
+ bases = cmp['A'] + cmp['T'] + cmp['G'] + cmp['C'] +
+ cmp['a'] + cmp['t'] + cmp['g'] + cmp['c']
+
+ total = self.length - cmp['N'] - cmp['n']
+
+ if bases.to_f / total > threshold
+ return NA
+ else
+ return AA
+ end
+ end
+
+ def self.guess(str, *args)
+ self.new(str).guess(*args)
+ end
+
def randomize(hash = nil)
length = self.length
***************
*** 229,236 ****
at = count['a'] + count['t'] + count['u']
gc = count['g'] + count['c']
! gc = format("%.1f", gc.to_f / (at + gc) * 100)
! return gc.to_f
end
- alias :gc :gc_percent
def illegal_bases
--- 248,254 ----
at = count['a'] + count['t'] + count['u']
gc = count['g'] + count['c']
! gc = 100 * gc / (at + gc)
! return gc
end
def illegal_bases
More information about the bioruby-cvs
mailing list