require 'yaml' require File.expand_path( File.dirname(__FILE__) + '/../spec_helper' ) # contains shared behavior that we need. require File.expand_path( File.dirname(__FILE__) + '/../transmem_spec_shared' ) require 'fasta' require 'transmem/phobius' index_klass = Phobius::Index base_klass = Phobius describe index_klass do before(:all) do @phobius_file = Tfiles + '/phobius.small.small.txt' @obj = Phobius::Index.new(@phobius_file) @test_hash = { 'gi|16127995|ref|NP_414542.1| protein description' => 0, 'gi|16127996|ref|NP_414543.1| protein description' => 0, 'gi|16127997|ref|NP_414544.1| protein description' => 0, 'gi|16127998|ref|NP_414545.1| protein description' => 0, 'gi|16127999|ref|NP_414546.1| protein description' => 0, 'gi|16128000|ref|NP_414547.1| protein description' => 0, 'gi|16128001|ref|NP_414548.1| protein description' => 9, 'gi|16128002|ref|NP_414549.1| protein description' => 0, 'gi|16128003|ref|NP_414550.1| protein description' => 0, 'gi|16128004|ref|NP_414551.1| protein description' => 6, 'gi|16128005|ref|NP_414552.1| protein description' => 0, 'gi|90111078|ref|NP_414553.2| protein description' => 0, 'gi|16128007|ref|NP_414554.1| protein description' => 0, 'gi|16128008|ref|NP_414555.1| protein description' => 0, 'gi|16128009|ref|NP_414556.1| protein description' => 0, 'gi|16128010|ref|NP_414557.1| protein description' => 0, 'gi|16128011|ref|NP_414558.1| protein description' => 0, 'gi|16128012|ref|NP_414559.1| protein description' => 1, 'gi|49175991|ref|YP_025292.1| protein description' => 0, 'gi|16128013|ref|NP_414560.1| protein description' => 11, 'gi|16128014|ref|NP_414561.1| protein description' => 0, 'gi|16128015|ref|NP_414562.1| protein description' => 0, 'gi|16128016|ref|NP_414563.1| protein description' => 0, 'gi|16128017|ref|NP_414564.1| protein description' => 0, 'gi|16128018|ref|NP_414565.1| protein description' => 0, 'gi|16128019|ref|NP_414566.1| protein description' => 0, 'gi|16128020|ref|NP_414567.1| protein description' => 0, 'gi|16128021|ref|NP_414568.1| protein description' => 4, 'gi|16128022|ref|NP_414569.1| protein description' => 0, 'gi|16128023|ref|NP_414570.1| protein description' => 0, 'gi|16128024|ref|NP_414571.1| protein description' => 0, 'gi|16128025|ref|NP_414572.1| protein description' => 0, 'gi|16128026|ref|NP_414573.1| protein description' => 0, 'gi|16128027|ref|NP_414574.1| protein description' => 0, 'gi|90111079|ref|NP_414576.4| protein description' => 0, 'gi|90111080|ref|NP_414577.2| protein description' => 0, 'gi|16128030|ref|NP_414578.1| protein description' => 0, 'gi|49175993|ref|NP_414579.3| protein description' => 0, 'gi|16128032|ref|NP_414580.1| protein description' => 0, 'gi|16128033|ref|NP_414581.1| protein description' => 0, 'gi|16128034|ref|NP_414582.1| protein description' => 12, 'gi|90111081|ref|NP_414583.2| protein description' => 0, 'gi|16128036|ref|NP_414584.1| protein description' => 0, 'gi|16128037|ref|NP_414585.1| protein description' => 0, 'gi|16128038|ref|NP_414586.1| protein description' => 0, 'gi|16128039|ref|NP_414587.1| protein description' => 12, 'gi|16128040|ref|NP_414588.1| protein description' => 0, 'gi|16128041|ref|NP_414589.1| protein description' => 13, 'gi|16128042|ref|NP_414590.1| protein description' => 0, 'gi|16128043|ref|NP_414591.1| protein description' => 0, } @ref_to_key = { 'gi|16127905|ref|NP_414542.1| thr operon leader peptide [Escherichia coli K12]' => 'gi|16127905|ref|NP_414542.1|', 'SWN:PWP1_HUMAN PERIODIC TRYPTOPHAN PROTEIN 1 HOMOLOG' => 'SWN:PWP1_HUMAN', 'MY:B|/-"[super]"duper!@#$%^&*(wil) and other stuff' => 'MY:B|/-[super]duper!@#$%^&*(wil)'} end it_should_behave_like 'a transmem index' end describe "a phobius parser", :shared => true do it 'parses a phobius file into a hash structure' do @file_to_hash.exist_as_a_file?.should be_true hash = @class.default_index(@file_to_hash) hash.should == @structure_to_create end end describe base_klass, "parsing the 'short' file format" do before(:all) do @class = base_klass @file_to_hash = Tfiles + '/phobius.small.small.txt' @structure_to_create = YAML.load(PhobiusSupportingFile::MY_YAML1) end it_should_behave_like 'a phobius parser' end describe index_klass, 'on small mock set' do before(:all) do phobius_file = Tfiles + '/phobius.small.small.txt' fasta_file = Tfiles + '/small.fasta' # Note that it needs a fasta object to do this! @obj = index_klass.new(phobius_file, Fasta.new(fasta_file)) @tm_test = { :mykey => 'gi|16128001|ref|NP_414548.1|', # "MPDFFSFINSVLWGSVMIYLLFGAGCWFTFRTGFVQFRYIRQFGKSLKNSIHPQPGGLTSFQSLCTSLAARVGSGNLAGVALAITAGGPGAVFWMWVAAFIGMATSFAECSLAQLYKERDVNGQFRGGPAWYMARGLGMRWMGVLFAVFLLIAYGIIFSGVQANAVARALSFSFDFPPLVTGIILAVFTLLAITRGLHGVARLMQGFVPLMAIIWVLTSLVICVMNIGQLPHVIWSIFESAFGWQEAAGGAAGYTLSQAITNGFQRSMFSNEAGMGSTPNAAAAAASWPPHPAAQGIVQMIGIFIDTLVICTASAMLILLAGNGTTYMPLEGIQLIQKAMRVLMGSWGAEFVTLVVILFAFSSIVANYIYAENNLFFLRLNNPKAIWCLRICTFATVIGGTLLSLPLMWQLADIIMACMAITNLTAILLLSPVVHTIASDYLRQRKLGVRPVFDPLRYPDIGRQLSPDAWDDVSQE" # transmembrane sequences: # LWGSVMIYLLFGAGCWFTF # LAARVGSGNLAGVALAITAG # FWMWVAAFIGMATSFAECSLAQLY # LGMRWMGVLFAVFLLIAYGI # FPPLVTGIILAVFTLLAIT # GFVPLMAIIWVLTSLVICVMNIG # IVQMIGIFIDTLVICTASAMLILLA # VLMGSWGAEFVTLVVILFAFSSIVANYIY # IIMACMAITNLTAILLLSPVVHTIA :seqs => %w(VLWG LAIT LAG), :exps => { :number => [3.0, 4.0, (2.0+3)/2], :fraction => [3.0/4, 4.0/4, ((2.0+3)/2)/3 ], } } end it_should_behave_like "a calculator of transmembrane overlap" end module PhobiusSupportingFile MY_YAML1 =<