Sha256: ab085742b7659066c313a6fcfc4c1b063233c173a18f97167add22669cfc0cfe

Contents?: true

Size: 1.17 KB

Versions: 29

Compression:

Stored size: 1.17 KB

Contents

#
# = bio/shell/plugin/psort.rb - plugin for PSORT
#
# Copyright::   Copyright (C) 2006
#               Toshiaki Katayama <k@bioruby.org>
# License::     The Ruby License
#
# $Id: psort.rb,v 1.3 2007/04/05 23:35:41 trevor Exp $
#

module Bio::Shell

  private

  def psort1(str)
    seq = getseq(str)
    if seq.is_a?(Bio::Sequence::NA)
      seq = seq.translate
    end

    psort = Bio::PSORT::PSORT1.imsut
    fasta = seq.to_fasta

    results = psort.exec(fasta).final_result
    results.each do |result|
      puts "#{result["certainty"].to_f*100.0}\t#{result["prediction"]}"
    end
    return results.first["prediction"]
  end

  def psort2(str)
    seq = getseq(str)
    if seq.is_a?(Bio::Sequence::NA)
      seq = seq.translate
    end

    psort = Bio::PSORT::PSORT2.imsut
    fasta = seq.to_fasta

    results = psort.exec(fasta).prob.sort_by{|x, y| y}.reverse
    results.each do |loc, prob|
      next if prob <= 0.0
      puts "#{prob}\t#{Bio::PSORT::PSORT2::SclNames[loc]}"
    end
    return results.first.first
  end

  def psort2locations
    names = Bio::PSORT::PSORT2::SclNames
    names.sort.each do |loc, desc|
      puts "#{loc}\t#{desc}"
    end
    return names
  end
end

Version data entries

29 entries across 29 versions & 6 rubygems

Version Path
bio-shell-1.0.1 lib/bio/shell/plugin/psort.rb
bio-shell-1.0.0 lib/bio/shell/plugin/psort.rb
bio-1.5.2 lib/bio/shell/plugin/psort.rb
bio-shell-0.0.0 lib/bio/shell/plugin/psort.rb
bio-1.5.1 lib/bio/shell/plugin/psort.rb
bio-1.5.0 lib/bio/shell/plugin/psort.rb
bioruby-bio-1.2.9.9001 lib/bio/shell/plugin/psort.rb
bioruby-bio-1.2.9.9501 lib/bio/shell/plugin/psort.rb
bioruby-bio-1.3.0.5000 lib/bio/shell/plugin/psort.rb
bioruby-bio-1.3.0.9901 lib/bio/shell/plugin/psort.rb
bioruby-bio-1.3.0 lib/bio/shell/plugin/psort.rb
bioruby-bio-1.3.1.5000 lib/bio/shell/plugin/psort.rb
jandot-bio-1.2.1 lib/bio/shell/plugin/psort.rb
ngoto-bio-1.2.9.9001 lib/bio/shell/plugin/psort.rb
ngoto-bio-1.2.9.9501 lib/bio/shell/plugin/psort.rb
ngoto-bio-1.3.0.5000 lib/bio/shell/plugin/psort.rb
ngoto-bio-1.3.0 lib/bio/shell/plugin/psort.rb
ngoto-bio-1.3.1.5000 lib/bio/shell/plugin/psort.rb
wwood-bioruby-1.2.11 lib/bio/shell/plugin/psort.rb
bio-1.4.3.0001 lib/bio/shell/plugin/psort.rb