]> git.donarmstrong.com Git - biopieces.git/commitdiff
fixed stdin read for fastq and ruby code
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 18 Mar 2011 16:29:49 +0000 (16:29 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 18 Mar 2011 16:29:49 +0000 (16:29 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@1293 74ccb610-7750-0410-82ae-013aeee3265d

code_ruby/Maasha/lib/biopieces.rb
code_ruby/Maasha/lib/fastq.rb

index 2ab9aa71ce462df296744e94d1e79181fb463034..05658e4d11a4c564915f0620f69640ed83a4d1d8 100644 (file)
@@ -453,6 +453,7 @@ class OptionHandler
   def options_check_files(cast)
     if cast[:type] == 'files!' and @options.has_key? cast[:long]
       @options[cast[:long]].each do |path|
+        next if path == "-"
         raise ArgumentError, "File not readable: '#{path}'" unless File.readable? path
       end
     end
@@ -570,7 +571,11 @@ class Stream < IO
   # specified in options[:stream_out] or options[:data_out].
   def self.open(options, mode, stdio)
     if mode == "r"
-      $stdin.tty? ? read(options[:stream_in]) : stdio
+      if options[:data_in].first == "-"
+        self.nread(["-"])
+      else
+        $stdin.tty? ? read(options[:stream_in]) : stdio
+      end
     elsif mode == "w"
       options[:stream_out] ? self.write(options[:stream_out], options[:compress]) : stdio
     else
index 298878590711be9240e5f4bc2ba33c6cf1cc4d20..44a9013fe5c5b4747dd0c531f01cbf8aa0e077e6 100644 (file)
@@ -34,7 +34,10 @@ class Fastq
   # Class method allowing open to be used on (zipped) files.
   # See File.open.
   def self.open(*args)
-    if File.pipe? *args.first
+    tyt = *args
+    if tyt.first == "-"
+      ios = self.new(STDIN)
+    elsif File.pipe? *args.first
       ios = self.new(File.open(*args))
     else
       ios = self.zopen(*args)