[BioRuby-cvs] bioruby/lib/bio/shell/plugin entry.rb, 1.8, 1.9 seq.rb, 1.18, 1.19 blast.rb, 1.1, 1.2 psort.rb, 1.1, 1.2
Katayama Toshiaki
k at dev.open-bio.org
Sun Dec 24 08:50:20 UTC 2006
Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin
In directory dev.open-bio.org:/tmp/cvs-serv9972
Modified Files:
entry.rb seq.rb blast.rb psort.rb
Log Message:
* seq, ent, obj commands are changed to getseq, getent, getobj respectively
Index: blast.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/blast.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** blast.rb 25 Jul 2006 18:43:17 -0000 1.1
--- blast.rb 24 Dec 2006 08:50:18 -0000 1.2
***************
*** 21,28 ****
data = Bio::FastaFormat.new(query)
desc = data.definition
! tmp = seq(data.seq)
else
desc = "query"
! tmp = seq(query)
end
--- 21,28 ----
data = Bio::FastaFormat.new(query)
desc = data.definition
! tmp = getseq(data.seq)
else
desc = "query"
! tmp = getseq(query)
end
Index: entry.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/entry.rb,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** entry.rb 27 Feb 2006 09:37:14 -0000 1.8
--- entry.rb 24 Dec 2006 08:50:18 -0000 1.9
***************
*** 13,16 ****
--- 13,25 ----
private
+ # Read a text file and collect the first word of each line in array
+ def readlist(filename)
+ list = []
+ File.open(filename).each do |line|
+ list << line[/^\S+/]
+ end
+ return list
+ end
+
# Obtain a Bio::Sequence::NA (DNA) or a Bio::Sequence::AA (Amino Acid)
# sequence from
***************
*** 19,23 ****
# * "filename" -- "gbvrl.gbk" (first entry only)
# * "db:entry" -- "embl:BUM" (entry is retrieved by the ent method)
! def seq(arg)
seq = ""
if arg.kind_of?(Bio::Sequence)
--- 28,32 ----
# * "filename" -- "gbvrl.gbk" (first entry only)
# * "db:entry" -- "embl:BUM" (entry is retrieved by the ent method)
! def getseq(arg)
seq = ""
if arg.kind_of?(Bio::Sequence)
***************
*** 26,31 ****
ent = flatauto(arg)
elsif arg[/:/]
! str = ent(arg)
! ent = flatparse(str)
else
tmp = arg
--- 35,39 ----
ent = flatauto(arg)
elsif arg[/:/]
! ent = getobj(arg)
else
tmp = arg
***************
*** 35,45 ****
tmp = ent.seq
elsif ent.respond_to?(:naseq)
! seq = ent.naseq
elsif ent.respond_to?(:aaseq)
! seq = ent.aaseq
end
if tmp and tmp.is_a?(String) and not tmp.empty?
! seq = Bio::Sequence.auto(tmp).seq
end
return seq
--- 43,56 ----
tmp = ent.seq
elsif ent.respond_to?(:naseq)
! #seq = ent.naseq
! tmp = ent.naseq
elsif ent.respond_to?(:aaseq)
! #seq = ent.aaseq
! tmp = ent.aaseq
end
if tmp and tmp.is_a?(String) and not tmp.empty?
! #seq = Bio::Sequence.auto(tmp).seq
! seq = Bio::Sequence.auto(tmp)
end
return seq
***************
*** 50,54 ****
# * "filename" -- local file (first entry only)
# * "db:entry" -- local BioFlat, OBDA, EMBOSS, KEGG API
! def ent(arg)
entry = ""
db, entry_id = arg.to_s.strip.split(/:/)
--- 61,65 ----
# * "filename" -- local file (first entry only)
# * "db:entry" -- local BioFlat, OBDA, EMBOSS, KEGG API
! def getent(arg)
entry = ""
db, entry_id = arg.to_s.strip.split(/:/)
***************
*** 87,92 ****
# Obtain a parsed object from sources that ent() supports.
! def obj(arg)
! str = ent(arg)
flatparse(str)
end
--- 98,103 ----
# Obtain a parsed object from sources that ent() supports.
! def getobj(arg)
! str = getent(arg)
flatparse(str)
end
Index: psort.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/psort.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** psort.rb 25 Jul 2006 18:42:09 -0000 1.1
--- psort.rb 24 Dec 2006 08:50:18 -0000 1.2
***************
*** 14,18 ****
def psort1(str)
! seq = seq(str)
if seq.is_a?(Bio::Sequence::NA)
seq = seq.translate
--- 14,18 ----
def psort1(str)
! seq = getseq(str)
if seq.is_a?(Bio::Sequence::NA)
seq = seq.translate
***************
*** 30,34 ****
def psort2(str)
! seq = seq(str)
if seq.is_a?(Bio::Sequence::NA)
seq = seq.translate
--- 30,34 ----
def psort2(str)
! seq = getseq(str)
if seq.is_a?(Bio::Sequence::NA)
seq = seq.translate
Index: seq.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/seq.rb,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** seq.rb 19 Sep 2006 06:20:38 -0000 1.18
--- seq.rb 24 Dec 2006 08:50:18 -0000 1.19
***************
*** 18,22 ****
seq = str
else
! seq = seq(str)
end
--- 18,22 ----
seq = str
else
! seq = getseq(str)
end
***************
*** 43,47 ****
def sixtrans(str)
! seq = seq(str)
[ 1, 2, 3, -1, -2, -3 ].each do |frame|
title = "Translation #{frame.to_s.rjust(2)}"
--- 43,47 ----
def sixtrans(str)
! seq = getseq(str)
[ 1, 2, 3, -1, -2, -3 ].each do |frame|
title = "Translation #{frame.to_s.rjust(2)}"
***************
*** 54,58 ****
def seqstat(str)
max = 150
! seq = seq(str)
rep = "\n* * * Sequence statistics * * *\n\n"
if seq.respond_to?(:complement)
--- 54,58 ----
def seqstat(str)
max = 150
! seq = getseq(str)
rep = "\n* * * Sequence statistics * * *\n\n"
if seq.respond_to?(:complement)
***************
*** 133,142 ****
# Argument need to be at least 16 bases in length.
def doublehelix(str)
! seq = seq(str)
! if str.length < 16
warn "Error: Sequence must be longer than 16 bases."
return
end
! if ! seq.respond_to?(:complement)
warn "Error: Sequence must be a DNA sequence."
return
--- 133,142 ----
# Argument need to be at least 16 bases in length.
def doublehelix(str)
! seq = getseq(str)
! if seq.length < 16
warn "Error: Sequence must be longer than 16 bases."
return
end
! if seq.moltype != Bio::Sequence::NA
warn "Error: Sequence must be a DNA sequence."
return
More information about the bioruby-cvs
mailing list