]> git.donarmstrong.com Git - biopieces.git/commitdiff
working on find_adaptor
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Sun, 29 May 2011 07:59:24 +0000 (07:59 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Sun, 29 May 2011 07:59:24 +0000 (07:59 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@1439 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/find_adaptor

index 85377e4f86e93b150a699f809c117c8e744ed242..cd103f446f0780499fe0e310cd38ea43905c7f0d 100755 (executable)
@@ -39,9 +39,10 @@ class PatScanError < StandardError; end;
 class PatScan
   def initialize(options, tmpdir, file_pattern, cpus)
     @options      = options
+               @tmpdir       = tmpdir
     @file_pattern = file_pattern
     @cpus         = cpus
-    @files_fasta  = Dir.glob(File.join(tmpdir, "*.fna"))
+    @files_fasta  = Dir.glob(File.join(@tmpdir, "*.fna"))
 
     pat = Pattern.new(@options)
     pat.write(@file_pattern)
@@ -109,12 +110,12 @@ class PatScan
   end
 
   def parse_results
-    files_result = Dir.glob(File.join(tmpdir, "*.out"))
+    files_result = Dir.glob(File.join(@tmpdir, "*.out"))
 
     matches = {}
 
     files_result.each do |file|
-      Fasta.open(file, mode='r') do |ios|
+      Fasta.open(file, 'r') do |ios|
         ios.each do |entry|
           if entry.seq_name =~ /^(\d+):\[(\d+),(\d+)\]$/
             name  = $1.to_i
@@ -157,7 +158,7 @@ class Pattern
   end
 
   def write(file)
-    File.open(file, mode='w') do |ios|
+    File.open(file, 'w') do |ios|
       ios.puts self.to_i
     end
   end
@@ -217,7 +218,7 @@ BASE_PER_FILE = 10_000_000
 options = Biopieces.options_parse(ARGV, casts)
 
 #tmpdir       = Biopieces.mktmpdir
-tmpdir       = "Tyt" # DEBUG TODO
+tmpdir       = "/home/maasha/Tyt"
 file_records = File.join(tmpdir, "data.stream")
 file_pattern = File.join(tmpdir, "pattern.txt")
 
@@ -227,7 +228,7 @@ bases       = 0
 
 Biopieces.open(options[:stream_in], file_records) do |input, output|
   file_fasta = File.join(tmpdir, "#{number_file}.fna")
-  out_fa     = Fasta.open(file_fasta, mode='w')
+  out_fa     = Fasta.open(file_fasta, 'w')
 
   input.each do |record|
     output.puts record
@@ -244,7 +245,7 @@ Biopieces.open(options[:stream_in], file_records) do |input, output|
         bases = 0
         number_file += 1
         file_fasta = File.join(tmpdir, "#{number_file}.fna")
-        out_fa     = Fasta.open(file_fasta, mode='w')
+        out_fa     = Fasta.open(file_fasta, 'w')
       end
     end
   end