9 #ifndef IMPMULTIFIT_PROTEOMICS_READER_H
10 #define IMPMULTIFIT_PROTEOMICS_READER_H
17 #include <IMP/multifit/multifit_config.h>
18 IMPMULTIFIT_BEGIN_NAMESPACE
19 class ProteinRecordData {
26 surface_filename_ =
"";
29 ProteinRecordData() { reset_all(); }
30 ProteinRecordData(
const std::string &name) {
34 ProteinRecordData(
const std::string &name,
const std::string fn) {
39 ProteinRecordData(
const std::string &name,
int start_res,
int end_res,
40 const std::string fn) {
43 start_res_ = start_res;
47 ProteinRecordData(
const std::string &name,
int start_res,
int end_res,
48 const std::string &fn,
const std::string &surface_fn,
49 const std::string &ref_fn) {
52 start_res_ = start_res;
55 surface_filename_ = surface_fn;
56 ref_filename_ = ref_fn;
62 int start_res_, end_res_;
63 std::string filename_;
64 std::string surface_filename_;
65 std::string ref_filename_;
78 const std::string &mol_fn,
const std::string &surface_fn,
79 const std::string &ref_fn) {
80 prot_data_.push_back(ProteinRecordData(name, start_res, end_res, mol_fn,
82 prot_map_[name] = prot_data_.size() - 1;
83 return prot_map_[name];
89 "protein with name" << rec.name_
90 <<
" was added already");
91 prot_data_.push_back(rec);
92 prot_map_[rec.name_] = prot_data_.size() - 1;
93 return prot_map_[rec.name_];
96 int find(
const std::string &name)
const {
97 if (prot_map_.find(name) == prot_map_.end())
return -1;
98 return prot_map_.find(name)->second;
100 void add_interaction(
const Ints &ii,
bool used_for_filter,
float linker_len) {
101 interactions_.push_back(ii);
102 interaction_in_filter_.push_back(used_for_filter);
103 interaction_linker_len_.push_back(linker_len);
105 void add_cross_link_interaction(
Int prot1,
Int res1,
Int prot2,
Int res2,
106 bool used_in_filter,
Float linker_len) {
108 std::make_pair(IntPair(prot1, res1), IntPair(prot2, res2)));
109 xlink_in_filter_.push_back(used_in_filter);
110 xlink_len_.push_back(linker_len);
112 void add_ev_pair(
Int prot1,
Int prot2) {
113 ev_.push_back(std::make_pair(prot1, prot2));
115 int get_number_of_proteins()
const {
return prot_data_.size(); }
116 int get_number_of_interactions()
const {
return interactions_.size(); }
117 Ints get_interaction(
int interaction_ind)
const {
119 "index out of range\n");
120 return interactions_[interaction_ind];
122 bool get_interaction_part_of_filter(
int interaction_ind)
const {
124 "index out of range\n");
125 return interaction_in_filter_[interaction_ind];
127 int get_interaction_linker_length(
int interaction_ind)
const {
129 "index out of range\n");
130 return interaction_linker_len_[interaction_ind];
132 int get_number_of_cross_links()
const {
return xlinks_.size(); }
133 std::pair<IntPair, IntPair> get_cross_link(
int xlink_ind)
const {
134 IMP_USAGE_CHECK(xlink_ind < (
int)xlinks_.size(),
"index out of range\n");
135 return xlinks_[xlink_ind];
137 bool get_cross_link_part_of_filter(
int xlink_ind)
const {
138 IMP_USAGE_CHECK(xlink_ind < (
int)xlinks_.size(),
"index out of range\n");
139 return xlink_in_filter_[xlink_ind];
141 float get_cross_link_length(
int xlink_ind)
const {
142 IMP_USAGE_CHECK(xlink_ind < (
int)xlinks_.size(),
"index out of range\n");
143 return xlink_len_[xlink_ind];
147 int get_number_of_ev_pairs()
const {
return ev_.size(); }
148 IntPair get_ev_pair(
int ev_ind)
const {
153 std::string get_protein_name(
int protein_ind)
const {
155 "index out of range\n");
156 return prot_data_[protein_ind].name_;
158 int get_end_res(
int protein_ind)
const {
160 "index out of range\n");
161 return prot_data_[protein_ind].end_res_;
163 int get_start_res(
int protein_ind)
const {
165 "index out of range\n");
166 return prot_data_[protein_ind].start_res_;
168 std::string get_protein_filename(
int protein_ind)
const {
170 "index out of range\n");
171 return prot_data_[protein_ind].filename_;
173 std::string get_reference_filename(
int protein_ind)
const {
175 "index out of range\n");
176 return prot_data_[protein_ind].ref_filename_;
178 std::string get_surface_filename(
int protein_ind)
const {
180 "index out of range\n");
181 return prot_data_[protein_ind].surface_filename_;
183 ProteinRecordData get_protein_data(
int protein_ind)
const {
185 "index out of range\n");
186 return prot_data_[protein_ind];
206 int get_num_allowed_violated_interactions()
const {
207 return num_allowed_violated_interactions_;
209 void set_num_allowed_violated_interactions(
int n) {
210 num_allowed_violated_interactions_ = n;
212 int get_num_allowed_violated_cross_links()
const {
213 return num_allowed_violated_xlinks_;
215 void set_num_allowed_violated_cross_links(
int n) {
216 num_allowed_violated_xlinks_ = n;
218 int get_num_allowed_violated_ev()
const {
return num_allowed_violated_ev_; }
219 void set_num_allowed_violated_ev(
int n) { num_allowed_violated_ev_ = n; }
222 std::vector<ProteinRecordData> prot_data_;
223 std::map<std::string, int> prot_map_;
225 std::vector<bool> interaction_in_filter_;
226 Floats interaction_linker_len_;
227 int num_allowed_violated_interactions_;
230 std::vector<std::pair<IntPair, IntPair> > xlinks_;
231 std::vector<bool> xlink_in_filter_;
233 int num_allowed_violated_xlinks_;
236 int num_allowed_violated_ev_;
244 const char *proteomics_fn);
246 ProteomicsData *get_partial_proteomics_data(
const ProteomicsData *pd,
248 IMPMULTIFIT_END_NAMESPACE
Decorator for helping deal with a hierarchy.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
Storage of proteomics data.
IMP::Vector< String > Strings
Standard way to pass a bunch of String values.
IMP::Vector< Float > Floats
Standard way to pass a bunch of Float values.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Storage of a model, its restraints, constraints and particles.
Handling of file input/output.
int add_protein(std::string name, int start_res, int end_res, const std::string &mol_fn, const std::string &surface_fn, const std::string &ref_fn)
A more IMP-like version of the std::vector.
#define IMP_INTERNAL_CHECK(expr, message)
An assertion to check for internal errors in IMP. An IMP::ErrorException will be thrown.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
Common base class for heavy weight IMP objects.
ProteomicsData * read_proteomics_data(const char *proteomics_fn)
Proteomics reader.
IMP::Vector< Ints > IntsList
Standard way to pass a bunch of Ints values.
IMP::Vector< IntPair > IntPairs
Object(std::string name)
Construct an object with the given name.
double Float
Basic floating-point value (could be float, double...)
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
int Int
Basic integer value.
IMP::Vector< Int > Ints
Standard way to pass a bunch of Int values.
int add_protein(const ProteinRecordData &rec)
Sample best solutions using Domino.