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 {
29 ProteinRecordData() {reset_all();
31 ProteinRecordData(
const std::string &name){
35 ProteinRecordData(
const std::string &name,
const std::string fn){
37 name_=name;filename_=fn;
39 ProteinRecordData(
const std::string &name,
40 int start_res,
int end_res,
const std::string fn){
47 ProteinRecordData(
const std::string &name,
48 int start_res,
int end_res,
const std::string &fn,
49 const std::string &surface_fn,
50 const std::string &ref_fn){
56 surface_filename_=surface_fn;
63 int start_res_,end_res_;
64 std::string filename_;
65 std::string surface_filename_;
66 std::string ref_filename_;
71 class IMPMULTIFITEXPORT ProteomicsData :
public base::Object {
74 ProteomicsData() : Object(
"ProteomicsData%1%") {}
77 int add_protein(std::string name,
int start_res,
78 int end_res,
const std::string &mol_fn,
79 const std::string &surface_fn,
80 const std::string &ref_fn){
81 prot_data_.push_back(ProteinRecordData(name,start_res,end_res,mol_fn,
83 prot_map_[name]=prot_data_.size()-1;
84 return prot_map_[name];
88 int add_protein(
const ProteinRecordData &rec) {
90 "protein with name"<<rec.name_<<
" 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,
102 interactions_.push_back(ii);
103 interaction_in_filter_.push_back(used_for_filter);
104 interaction_linker_len_.push_back(linker_len);
106 void add_cross_link_interaction(
Int prot1,
Int res1,
Int prot2,
Int res2,
107 bool used_in_filter,
Float linker_len){
108 xlinks_.push_back(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];}
121 bool get_interaction_part_of_filter(
int interaction_ind)
const {
123 "index out of range\n");
124 return interaction_in_filter_[interaction_ind];
126 int get_interaction_linker_length(
int interaction_ind)
const {
128 "index out of range\n");
129 return interaction_linker_len_[interaction_ind];
131 int get_number_of_cross_links()
const {
return xlinks_.size();}
132 std::pair<IntPair,IntPair> get_cross_link(
int xlink_ind)
const {
134 "index out of range\n");
135 return xlinks_[xlink_ind];
137 bool get_cross_link_part_of_filter(
int xlink_ind)
const {
139 "index out of range\n");
140 return xlink_in_filter_[xlink_ind];
142 float get_cross_link_length(
int xlink_ind)
const {
144 "index out of range\n");
145 return xlink_len_[xlink_ind];
149 int get_number_of_ev_pairs()
const {
return ev_.size();}
150 IntPair get_ev_pair(
int ev_ind)
const {
152 "index out of range\n");
157 std::string get_protein_name(
int protein_ind)
const {
159 "index out of range\n");
160 return prot_data_[protein_ind].name_;
162 int get_end_res(
int protein_ind)
const {
164 "index out of range\n");
165 return prot_data_[protein_ind].end_res_;
167 int get_start_res(
int protein_ind)
const {
169 "index out of range\n");
170 return prot_data_[protein_ind].start_res_;
172 std::string get_protein_filename(
int protein_ind)
const {
174 "index out of range\n");
175 return prot_data_[protein_ind].filename_;
177 std::string get_reference_filename(
int protein_ind)
const {
179 "index out of range\n");
180 return prot_data_[protein_ind].ref_filename_;
182 std::string get_surface_filename(
int protein_ind)
const {
184 "index out of range\n");
185 return prot_data_[protein_ind].surface_filename_;
187 ProteinRecordData get_protein_data(
int protein_ind)
const {
188 IMP_USAGE_CHECK(protein_ind<(
int)prot_data_.size(),
"index out of range\n");
189 return prot_data_[protein_ind];}
193 for(std::vector<ProteinRecordData>::const_iterator
194 it = prot_data_.begin(); it != prot_data_.end();it++){
198 out<<
"Interactions:"<<std::endl;
199 for(IntsList::const_iterator
200 it = interactions_.begin();it != interactions_.end();it++){
201 for(Ints::const_iterator it1 = it->begin();
202 it1 != it->end();it1++){
203 out<<prot_data_[*it1].name_<<
",";
207 int get_num_allowed_violated_interactions()
const {
208 return num_allowed_violated_interactions_;}
209 void set_num_allowed_violated_interactions(
int n) {
210 num_allowed_violated_interactions_=n;}
211 int get_num_allowed_violated_cross_links()
const {
212 return num_allowed_violated_xlinks_;}
213 void set_num_allowed_violated_cross_links(
int n) {
214 num_allowed_violated_xlinks_=n;}
215 int get_num_allowed_violated_ev()
const {
216 return num_allowed_violated_ev_;}
217 void set_num_allowed_violated_ev(
int n) {
218 num_allowed_violated_ev_=n;}
221 std::vector<ProteinRecordData> prot_data_;
222 std::map<std::string,int> prot_map_;
224 std::vector<bool> interaction_in_filter_;
225 Floats interaction_linker_len_;
226 int num_allowed_violated_interactions_;
229 std::vector<std::pair<IntPair,IntPair> > xlinks_;
230 std::vector<bool> xlink_in_filter_;
232 int num_allowed_violated_xlinks_;
235 int num_allowed_violated_ev_;
243 const char *proteomics_fn);
245 ProteomicsData *get_partial_proteomics_data(
246 const ProteomicsData *pd,
248 IMPMULTIFIT_END_NAMESPACE