require_relative 'test_helper' require 'bio' require 'npsearch/sequence' # A class to test the Sequence Class class TestSequences < Minitest::Test def setup seq = ">test_sequences\n" \ "MFYFESFGRMWLVVCLLNSAFLTTVISGQADNTRAEVLSNAEIADEEAKELIDNLIKSKKDYS\n" \ "SSDDDLYQMNEEDKRGLFPTGGMDPLGASYFTGKRGADSNEEETTDKRGFPNSRLDTLGSRYF\n" \ "NGKRGFPNSGGLDTLGSRYFNGKRGFPSSGGMDTLGSGYFNGKRAFPSSGGMDTLGSRYFNGK\n" \ "RAFPNSGGMDTLGSRYFNGKRGFPGSGGMDVLGSRYFNGKRGFPSSGGMDTLGSSYFNGKRGF\n" \ "PSSGGMDTLGSGYFNGKRGFPNSGGMDTLGASYFTGKRGFPSSGGLDTLGSRYFNGKRGFPNS\n" \ 'GGMDTLGGRYFNGKRAIFDDFDQTDSLHGLKKGSSFLHGGLSSGGRVPGMKKRSVSSEENATE' sequence = Bio::FastaFormat.new(seq) sp = { name: 'test_sequences', cmax: '0.492', cmax_pos: '31', ymax: '0.612', ymax_pos: '31', smax: '0.950', smax_pos: '17', smean: '0.786', d: '0.706', sp: 'Y', dmaxcut: '0.300', networks: 'SignalP-noTM', orf: sequence.seq } @seq = NpSearch::Sequence.new(sequence, sp, 2) end def test_id assert_equal('test_sequences', @seq.id) end def test_sp sp = 'MFYFESFGRMWLVVCLLNSAFLTTVISGQA' assert_equal(sp, @seq.signalp) end def test_seq seq = 'DNTRAEVLSNAEIADEEAKELIDNLIKSKKDYSSSDDDLYQMNEEDKRGLFPTGGMDPLGASY' \ 'FTGKRGADSNEEETTDKRGFPNSRLDTLGSRYFNGKRGFPNSGGLDTLGSRYFNGKRGFPSSG' \ 'GMDTLGSGYFNGKRAFPSSGGMDTLGSRYFNGKRAFPNSGGMDTLGSRYFNGKRGFPGSGGMD' \ 'VLGSRYFNGKRGFPSSGGMDTLGSSYFNGKRGFPSSGGMDTLGSGYFNGKRGFPNSGGMDTLG' \ 'ASYFTGKRGFPSSGGLDTLGSRYFNGKRGFPNSGGMDTLGGRYFNGKRAIFDDFDQTDSLHGL' \ 'KKGSSFLHGGLSSGGRVPGMKKRSVSSEENATE' assert_equal(seq, @seq.seq) end def test_html_seq seq = 'MFYFESFGRMWLVVCLLNSAFLTTVISGQADNTRAEVLSNAEIADEEAKELIDNLIKSKK' \ 'DYSSSDDDLYQMNEEDKRGLFPTGGMDPLGASY' \ 'FTGKRGADSNEEE' \ 'TTDKRGFPNSRLDTLGSRYFNGKR' \ 'GFPNSGGLDTLGSRYFNGKRGFPSSGGMDTLGSGYFNG' \ 'KRAFPSSGGMDTLGSRYFN' \ 'GKRAFPNSGGMDTLGSRYFNGKRGFPGSGGMDVLGSRYFNGKRGFPSSGGMDTLGSSY' \ 'FNGKRGFPSSGGM' \ 'DTLGSGYFNGKR' \ 'GFPNSGGMDTLGASYFTGKR' \ 'GFPSSGGLDTLGSRYFNGKRGFPNSGGMDTLGGRYFNG' \ 'KRAIFDDFDQTDSLHGLKK'\ 'GSSFLHGGLSSGGRVPGMKKRSVSSEENATE'\ '' assert_equal(seq, @seq.html_seq) end def test_translated_frame frame = 2 assert_equal(frame, @seq.translated_frame) end def test_default_score score = 0 assert_equal(score, @seq.score) end def test_default_potential_cleaved_nps potential_cleaved_nps = nil assert_equal(potential_cleaved_nps, @seq.potential_cleaved_nps) end end