1 #ifndef _MUSSA_CLASS_H_
2 #define _MUSSA_CLASS_H_
3 // This file is part of the Mussa source distribution.
4 // http://mussa.caltech.edu/
5 // Contact author: Tristan De Buysscher, tristan@caltech.edu
7 // This program and all associated source code files are Copyright (C) 2005
8 // the California Institute of Technology, Pasadena, CA, 91125 USA. It is
9 // under the GNU Public License; please see the included LICENSE.txt
10 // file for more information, or contact Tristan directly.
13 // ----------------------------------------
14 // ---------- mussa_class.hh -----------
15 // ----------------------------------------
21 #include "alg/nway_paths.hpp"
22 #include "alg/sequence.hpp"
24 std::string int_to_str(int an_int);
28 friend class ConnWindow;
30 enum analysis_modes { TransitiveNway, RadialNway, EntropyNway,
36 void save_muway(std::string save_path);
37 //! load a saved analysis directory
38 void load(std::string ana_path);
40 //! clear parameters and initialize data lists
43 // set parameters from a file - 'mupa' ~ mussa parameters
44 void load_mupa_file(std::string para_file_path);
46 // set parameters individually (eg from user input into gui classes)
48 void set_name(std::string a_name);
49 //! return name for this analysis
50 std::string get_name();
52 //! return number of sequences in this analyzis
53 /*! this returns either the_seqs.size() or seq_files.size()
54 * depending on which has data loaded in
55 * (silly delayed loading of sequence data)
58 //! set number of bases for this window size
59 void set_window(int a_window);
60 //! get number of bases for the sliding window
61 int get_window() const;
62 //! set number of bases that must match for a window to be saved
63 void set_threshold(int a_threshold);
64 //! get number of bases that must match for a window to be saved
65 int get_threshold() const;
66 void set_soft_thres(int sft_thres);
68 void set_analysis_mode(enum analysis_modes new_ana_mode);
69 enum analysis_modes get_analysis_mode() const;
70 //! return a string name for an analysis mode
71 std::string get_analysis_mode_name() const;
73 //! return the refined paths found by the nway analysis.
74 const NwayPaths& paths() const;
76 //! run seqcomp and the nway filtering algorithm.
77 /*!analyze will run seqcomp and then the nway algorithm
78 * on whatever sequences have been loaded into this mussa instance.
79 * w & t are for command line override functionality, set to 0 to ignore
80 * \throws mussa_analysis_error
82 void analyze(int w=0, int t=0,
83 enum analysis_modes ana_mode=TransitiveNway,
84 double ent_thres=0.0);
85 /*! Run the nway filtering algorithm,
86 * this might be used when changing the soft threshhold?
90 //! appends a string sequence to the list of the_seqs
91 void add_a_seq(std::string a_seq);
92 //! Load a sequence from a fasta file and any annotations
93 /*! \param[in] seq_file the full path to the fasta file
94 * \param[in] annot_file the full path to an annotation file,
95 * if is an empty string, we won't bother loading anything
96 * \param[in] fasta_index specify which sequence in a multisequence fasta
98 * \param[in] sub_seq_start starting slice index to select a subsequence
99 * use 0 start from the beginning.
100 * \param[in] sub_seq_end ending slice index to select a subsequence
101 * use 0 to go to the end.
103 void load_sequence(std::string seq_file, std::string annot_file,
104 int fasta_index, int sub_seq_start=0, int sub_seq_end=0);
105 //! allow examining the sequences we have loaded
106 const std::vector<Sequence>& sequences() const;
108 // deprecated - support bridge for python version of mussa
109 // these save & load from the old file format
111 void load_old(char * load_file_path, int s_num);
115 // parameters needed for a mussa analysis
116 //! name of this analysis. (will also be used when saving an analysis)
117 std::string analysis_name;
118 //! how many base pairs to include in a sliding window
120 //! how many base pairs need to match order to record a window as conserved
123 //! which nway comparison algorithm to use.
124 enum analysis_modes ana_mode;
126 //! should we append _w<window_size> to the saved analysis
128 //! should we append _t<threshold> to the saved analysis
132 std::vector<Sequence> the_seqs;
134 std::vector<std::vector<FLPs> > all_comps;
135 //! N-way data, ie the mussa results
139 //! loads sequence and annotations from fasta and annotation file