From: Diane Trout Date: Sat, 1 Jul 2006 06:18:07 +0000 (+0000) Subject: make sure subsequences have a species name X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=mussa.git;a=commitdiff_plain;h=2235a6e6326a93f261cfd01fb85f7c832b45935f make sure subsequences have a species name copy species name from our source sequence --- diff --git a/alg/sequence.cpp b/alg/sequence.cpp index 7523ab6..65ff57d 100644 --- a/alg/sequence.cpp +++ b/alg/sequence.cpp @@ -457,7 +457,7 @@ Sequence::subseq(int start, int count) const } Sequence new_seq(std::string::substr(start, count)); new_seq.set_fasta_header(get_fasta_header()); - //new_seq.set_species(get_species()); + new_seq.set_species(get_species()); new_seq.motif_list = motif_list; // attempt to copy & reannotate position based annotations diff --git a/alg/test/test_sequence.cpp b/alg/test/test_sequence.cpp index c510739..b331bfa 100644 --- a/alg/test/test_sequence.cpp +++ b/alg/test/test_sequence.cpp @@ -80,6 +80,17 @@ BOOST_AUTO_TEST_CASE( sequence_filter ) BOOST_CHECK_EQUAL(s3, "AAGGNN"); } +BOOST_AUTO_TEST_CASE( subseq_names ) +{ + Sequence s1("AAGGCCTT"); + s1.set_species("species"); + s1.set_fasta_header("a fasta header"); + Sequence s2 = s1.subseq(2,2); + BOOST_CHECK_EQUAL(s2, "GG"); + BOOST_CHECK_EQUAL(s2.get_species(), s1.get_species()); + BOOST_CHECK_EQUAL(s2.get_fasta_header(), s1.get_fasta_header()); +} + //! Can we load data from a file BOOST_AUTO_TEST_CASE( sequence_load ) {