Sha256: f83c977e37d5841a140278fa2c3d07c63c0a5c473541a6e30d2c04e6176209e8

Contents?: true

Size: 936 Bytes

Versions: 1

Compression:

Stored size: 936 Bytes

Contents

require 'phgx'

module STRING
  extend Resource
  self.pkgdir = "phgx"
  self.subdir = "share/string"

  STRING.claim STRING.root.find, :rake, Rbbt.share.install.STRING.Rakefile.find(:lib)
end

if defined? Entity and defined? Gene and Entity === Gene
  module Gene
    property :string_interactors => :array2single do |*args|
      threshold = args.first || 800
      string = STRING.protein_protein.tsv(:unnamed => true, :persist => true, :type => :double)
      all = self.ensembl.collect do |gene|
        interactors = gene.proteins.collect{|protein| Misc.zip_fields((string[protein] || [[],[]])).select{|i, score| score.to_i > threshold}.collect{|ints,s| ints}}.compact.flatten.uniq
        Protein.setup(interactors, "Ensembl Protein ID", organism).transcript.gene.compact.uniq
      end

      all.compact.first.annotate all if Annotated === all.compact.first 

      all
    end
    #persist :_ary_string_interactors
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rbbt-phgx-2.0.0 lib/rbbt/sources/string.rb