[BioRuby-cvs] bioruby/lib/bio sequence.rb,0.44,0.45
Katayama Toshiaki
k at pub.open-bio.org
Sat Nov 5 03:22:55 EST 2005
Update of /home/repository/bioruby/bioruby/lib/bio
In directory pub.open-bio.org:/tmp/cvs-serv29278/lib/bio
Modified Files:
sequence.rb
Log Message:
* Bio::Sequence.auto method is added
* Bio::Sequence#blast and Bio::Sequence#fasta methods are removed
Index: sequence.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence.rb,v
retrieving revision 0.44
retrieving revision 0.45
diff -C2 -d -r0.44 -r0.45
*** sequence.rb 26 Sep 2005 13:00:04 -0000 0.44
--- sequence.rb 5 Nov 2005 08:22:52 -0000 0.45
***************
*** 34,37 ****
--- 34,65 ----
class Sequence < String
+ def self.auto(str)
+ moltype = guess(str)
+ if moltype == NA
+ NA.new(str)
+ else
+ AA.new(str)
+ end
+ 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 to_s
String.new(self)
***************
*** 75,86 ****
end
- def fasta(factory, header = nil)
- factory.query(self.to_fasta(header))
- end
-
- def blast(factory, header = nil)
- factory.query(self.to_fasta(header))
- end
-
def window_search(window_size, step_size = 1)
i = 0
--- 103,106 ----
***************
*** 108,130 ****
end
return count
- 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
--- 128,131 ----
More information about the bioruby-cvs
mailing list