]> git.donarmstrong.com Git - biopieces.git/commitdiff
shifted ruby biopiece records to use symbols instead of strings
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 20 Aug 2010 12:40:02 +0000 (12:40 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 20 Aug 2010 12:40:02 +0000 (12:40 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@1068 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/swapcase_seq
code_ruby/Maasha/lib/biopieces.rb

index 4831f2aa1abd15375c0b0423269ef30a6c5424fe..cb1989cf9d1f10c4f0c6eef9c9048bea2062b707 100755 (executable)
@@ -38,7 +38,7 @@ bp = Biopieces.new
 options = bp.parse(ARGV, casts)
 
 bp.each_record do |record|
-  record["SEQ"].swapcase! if record.has_key? "SEQ"
+  record[:SEQ].swapcase! if record.has_key? :SEQ
   bp.puts record
 end
 
index 05bc736fe7365b4b0235db053c5b12e9d7c0a9d5..22c1b27eabd67e6f41bf03bad679aa6ace264b2b 100644 (file)
@@ -68,7 +68,7 @@ class Biopieces
     @in.each_line do |line|
       case line
       when /^([^:]+): (.*)$/
-        record[$1] = $2
+        record[$1.to_sym] = $2
       when /^---$/
         yield record unless record.empty?
         record = {}
@@ -89,7 +89,7 @@ class Biopieces
     @out = Stream::open(@options, mode="w", @output) unless @out.is_a? IO
 
     record.each do |key,value|
-      @out.print "#{key}: #{value}\n"
+      @out.print "#{key.to_s}: #{value}\n"
     end
 
     @out.print "---\n"