Sha256: 297f6b58d24352972b069bb0bd8a3cb8d33f09f5049b493477dbc0269ca917d2
Contents?: true
Size: 1.85 KB
Versions: 2
Compression:
Stored size: 1.85 KB
Contents
require 'tempfile' module EcfClassify module Runner def self.general(seqs,file) general = Tempfile.new("general") sigma3 = Tempfile.new("sigma3") pfam = Tempfile.new("pfam") begin out = HMMER.hmmsearch(seqs,general.path,:general) raise out[0] if out[1] != 0 out = HMMER.hmmsearch(seqs,sigma3.path,:sigma3) raise out[0] if out[1] != 0 out = HMMER.hmmsearch(seqs,pfam.path,:sigma2_4) raise out[0] if out[1] != 0 script = Utils.path("lib/scripts/extract_ECF.py") out = `python3 #{script} --general #{general.path} --pfam #{pfam.path} --sigma3 #{sigma3.path} --infile #{seqs} --conserved #{file}` raise unless $?.success? ensure [general,sigma3,pfam].map(&:close) [general,sigma3,pfam].map(&:unlink) end return out end def self.specific(seqs, type, probabilities = nil) ungrouped = nil stats = nil th = nil case type when :groups th = 0.0016 stats = EcfClassify::Zenodo.path(:groups_statistics) ungrouped = "Ungrouped" when :subgroups th = 0.0041 stats = EcfClassify::Zenodo.path(:subgroups_statistics) ungrouped = "Unsubgrouped" else raise "type #{type} unknown" end specific = Tempfile.new("#{type}") begin out = HMMER.hmmsearch(seqs,specific.path,type) raise out[0] if out[1] != 0 script = Utils.path("lib/scripts/classify.py") cmd = "python3 #{script} --hmm-result #{specific.path} --th #{th} --stats-file #{stats} --ungrouped #{ungrouped}" if probabilities cmd += " --probabilities #{probabilities}" end out = `#{cmd}` raise unless $?.success? ensure specific.close specific.unlink end return out end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ecf_classify-1.0.3 | lib/ecf_classify/runner.rb |
ecf_classify-1.0.2 | lib/ecf_classify/runner.rb |