+ //! set sequence (filtered)
+ void set_sequence(const std::string &, AlphabetRef);
+ //! get sequence
+ std::string get_sequence() const;
+ //! set species name
+ void set_species(const std::string &);
+ //! get species name
+ std::string get_species() const;
+ //! set the fasta header
+ void set_fasta_header(std::string header);
+ //! get the fasta header
+ std::string get_fasta_header() const;
+ //! get name (will return the first non-empty, of fasta_header, species)
+ std::string get_name() const;
+ //! return a reference to whichever alphabet we're currently representing
+ const Alphabet& get_alphabet() const;
+
+ //! load sequence from fasta file using the sequences current alphabet
+ void load_fasta(const boost::filesystem::path file_path, int seq_num=1,
+ int start_index=0, int end_index=0);
+ //! load sequence AGCT from fasta file
+ //! \throw mussa_load_error
+ //! \throw sequence_empty_error
+ //! \throw sequence_empty_file_error
+ void load_fasta(const boost::filesystem::path file_path,
+ AlphabetRef a,
+ int seq_num=1,
+ int start_index=0, int end_index=0);
+ void load_fasta(std::istream& file,
+ int seq_num=1, int start_index=0, int end_index=0);
+ //! load sequence from stream
+ //! \throw mussa_load_error
+ //! \throw sequence_empty_error
+ //! \throw sequence_empty_file_error
+ void load_fasta(std::istream& file,
+ AlphabetRef a,
+ int seq_num=1,
+ int start_index=0, int end_index=0);
+ //! load sequence annotations
+ //! \throws mussa_load_error
+ void load_annot(const boost::filesystem::path file_path, int start_index, int end_index);
+ //! load sequence annotations
+ //! \throws mussa_load_error
+ void load_annot(std::istream& data_stream, int start_index, int end_index);
+ //! parse annotation file
+ /*! \throws annotation_load_error
+ */
+ void parse_annot(std::string data, int start_index=0, int end_index=0);
+ //! add an annotation to our list of annotations
+ void add_annotation(const SeqSpanRef a);
+ //! add an annotation using tristan's mussa file paramenters
+ void add_annotation(std::string name, std::string type, size_type start, size_type stop);
+ //! create an initialized annotation with the "standard" types.
+ SeqSpanRef make_annotation(std::string name, std::string type, size_type start, size_type stop) const;
+ const SeqSpanRefList& annotations() const;
+
+ const MotifList& motifs() const;
+
+ //! add a motif to our list of motifs
+ void add_motif(const Sequence& a_motif);
+ //! clear our list of found motifs
+ void clear_motifs();
+ //! search a sequence for a_motif
+ //! \throws motif_normalize_error if there's something wrong with a_motif
+ std::vector<int> find_motif(const Sequence& a_motif) const;
+ //! annotate the current sequence with other sequences
+ void find_sequences(std::list<Sequence>::iterator start,
+ std::list<Sequence>::iterator end);
+ SeqSpanRef seqspan() { return seq; }
+
+ void save(boost::filesystem::fstream &save_file);
+ //void load_museq(boost::filesystem::path load_file_path, int seq_num);
+ static SequenceRef load_museq(boost::filesystem::fstream& load_file);
+
+protected:
+ SeqSpanRef seq;
+ //! fasta header
+ std::string header;
+ //! species name
+ std::string species;
+
+ //! store annotation regions
+ SeqSpanRefListRef annotation_list;
+ //! a seperate list for motifs since we're currently not saving them
+ MotifListRef motif_list;
+
+ //! copy over all our annotation children
+ void copy_children(Sequence &, size_type start, size_type count) const;
+
+ void motif_scan(const Sequence& a_motif, std::vector<int> * motif_match_starts) const;
+ std::string rc_motif(std::string a_motif) const;
+ //! look for a string sequence type and and it to an annotation list
+ void add_string_annotation(std::string a_seq, std::string name);
+
+ // boost::serialization support
+ friend class boost::serialization::access;
+ template<class Archive>
+ void serialize(Archive& ar, const unsigned int /*version*/) {
+ ar & BOOST_SERIALIZATION_NVP(seq);
+ ar & BOOST_SERIALIZATION_NVP(header);
+ ar & BOOST_SERIALIZATION_NVP(species);
+ ar & BOOST_SERIALIZATION_NVP(annotation_list);
+ ar & BOOST_SERIALIZATION_NVP(motif_list);
+ }
+};
+BOOST_CLASS_EXPORT(Sequence);