From: martinahansen Date: Sun, 29 May 2011 07:59:24 +0000 (+0000) Subject: working on find_adaptor X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=0fc081bb88d2bf515b8f6e71c79035abbe1f3b81;p=biopieces.git working on find_adaptor git-svn-id: http://biopieces.googlecode.com/svn/trunk@1439 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/bp_bin/find_adaptor b/bp_bin/find_adaptor index 85377e4..cd103f4 100755 --- a/bp_bin/find_adaptor +++ b/bp_bin/find_adaptor @@ -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