Sha256: f8199e1490c4ff96949b6e3c9fb0590ac3992ba1fec8b480581cec00ac707130

Contents?: true

Size: 1.54 KB

Versions: 5

Compression:

Stored size: 1.54 KB

Contents

#$: << File.expand_path('~/fln/full_lengther_next/lib')

$: << File.expand_path(File.join(File.dirname(__FILE__)))
require 'types'
require 'my_worker'

class MyWorkerEst < MyWorker
	#####################################################################################
	# WORKER FUNCTIONS
	#####################################################################################
	def receive_initial_config(params)
		# Reads the parameters
		@options = params.first
		@blast_path = params.last
		@match = [] # Any sequence matching with a EST
		@unmatch = [] # Sequences with :test_code annotation that it hasn't match with a EST
	end

	def process_object (array_seqs)
		$WORKER_LOG.info "Worker LIST #{array_seqs.length}"
		array_seqs.sort!{|s1, s2| s2.t_code <=> s1.t_code} #Order by testcode
		blastEST(array_seqs)
		return [@match, @unmatch]
	end

	#####################################################################################
	# CUSTOM FUNCTIONS
	#####################################################################################
	
	def blastEST(array_seqs)
		blast = run_blast(array_seqs, @blast_path, 'blastn', 1e-6, nil, false)
		if blast.nil?
			$LOG.info 'BLAST FAILED'
			Process.exit(-1)
		else
			blast_analysis(blast, array_seqs)
		end
	end
	
	def blast_analysis(blast, array_seqs)
		blast.querys.each_with_index do |query, i|
			if query.hits.first.nil?
				if !array_seqs[i].type == CODING #Keep if is coding
					@unmatch << array_seqs[i]
				end
			else
				seq = array_seqs[i]
				seq.hit = query.hits.first
				@match << seq
			end
		end	
	end
	
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
full_lengther_next-1.0.6 lib/full_lengther_next/my_worker_EST.rb
full_lengther_next-1.0.5 lib/full_lengther_next/my_worker_EST.rb
full_lengther_next-1.0.4 lib/full_lengther_next/my_worker_EST.rb
full_lengther_next-1.0.3 lib/full_lengther_next/my_worker_EST.rb
full_lengther_next-1.0.2 lib/full_lengther_next/my_worker_EST.rb