Skip to content
Snippets Groups Projects
Commit 35f58028 authored by Denys Bulavka's avatar Denys Bulavka
Browse files

Fixed some bugs

parent 1b16e862
No related branches found
No related tags found
No related merge requests found
""
This repository contains the scripts and database used for the paper "Thousands of protein linear motif classes may still be undiscovered"
Below is an example of the usage to reproduce the results presented in the paper
For questions regarding the use of these scripts, please contact the authors of the paper.
Copyright (C) 2021 by Denys Bulavka <dbulavka@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
""
Database description:
The database was downloaded on the 22nd of May of 2015, named elm_original_20150522.csv, version history in http://elm.eu.org/infos/news.html. This file can be found in the folder 'database'. This file has 210 motifs.
......
......@@ -26,7 +26,7 @@ private:
public:
Mdp_toolbox();
Mdp_toolbox(std::string, bool, bool);
Mdp_toolbox(std::string, bool, std::string);
std::vector<Motif_pair> get_pairs_k_discriminant_positions(int);
int get_mdp(Motif_pair);
std::vector<Motif_class> get_k_discriminant_motifs(Motif_class, int);
......
......@@ -29,7 +29,6 @@ private:
void count_sequences();
void compute_probability();
void compute_empiric_motif_numbers();
float compute_empiric_based_probability(std::vector<int> &);
void compute_empiric_motif_probabilities();
void compute_theoretic_motif_probabilities();
void iteration(std::vector<int> &);
......@@ -38,6 +37,7 @@ private:
public:
Statistical_toolbox();
Statistical_toolbox(Mdp_toolbox);
float compute_empiric_based_probability(std::vector<int> &);
std::map<std::vector<int>, float> get_empiric_motif_probabilities();
std::map<std::vector<int>, float> get_theoretic_motif_probabilities();
};
......
......@@ -2,7 +2,7 @@
Mdp_toolbox::Mdp_toolbox(){}
Mdp_toolbox::Mdp_toolbox(std::string database_location, bool clean_ends, bool clean_marked_motifs)
Mdp_toolbox::Mdp_toolbox(std::string database_location, bool clean_ends, std::string clean_marked_motifs)
{
database = Database(database_location, clean_ends, clean_marked_motifs);
......
......@@ -134,7 +134,7 @@ std::stringstream Report_manager::empiric_motif_probabilities()
output << "Structure" << separator << "Probability" << std::endl;
for(std::pair<std::vector<int>, float> element: statistical_toolbox.get_empiric_motif_probabilities())
output << element.first << separator << element.second << std::endl;
output << element.first << separator << statistical_toolbox.compute_empiric_based_probability(element.first)<< separator << element.second << std::endl;
return output;
}
......
......@@ -5,6 +5,7 @@ Statistical_toolbox::Statistical_toolbox(){}
Statistical_toolbox::Statistical_toolbox(Mdp_toolbox mdp_toolbox)
{
this->mdp_toolbox = mdp_toolbox;
count_sequences();
}
void Statistical_toolbox::compute_empiric_motif_numbers()
......@@ -121,7 +122,6 @@ float Statistical_toolbox::compute_empiric_based_probability(std::vector<int> &s
std::map<std::vector<int>, float> Statistical_toolbox::get_theoretic_motif_probabilities()
{
count_sequences();
compute_theoretic_motif_probabilities();
return theoretic_motif_probabilities;
}
......@@ -20,7 +20,7 @@ int main(int argc, char* argv[])
help_message << "-k: Discriminant index" << std::endl;;
if((option = getopt(argc, argv, "hd:cm:r:k:")) == -1)
if((option = getopt(argc, argv, ":hd:cm:r:k:")) == -1)
{
std::cout << help_message.str();
return 0;
......@@ -39,6 +39,8 @@ int main(int argc, char* argv[])
case 'd':
database_location = optarg;
break;
case ':':
throw std::invalid_argument("Option requires an operand");
case 'c':
clean_ends = true;
break;
......@@ -52,7 +54,7 @@ int main(int argc, char* argv[])
discriminant_index = std::atoi(optarg);
break;
}
}while((option = getopt(argc, argv, "hd:cmr:k:")) != -1);
}while((option = getopt(argc, argv, ":hd:cm:r:k:")) != -1);
//Make sure that if report 3 or 4 is invoked we have specified the discriminant_index
if((report == 3 or report == 4) and discriminant_index == -1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment