IMP  2.0.1
The Integrative Modeling Platform
protein_anchors_mapping_reader.h
Go to the documentation of this file.
1 /**
2  * \file protein_anchors_mapping_reader.h
3  * \brief handles reading matches between a protein and its anchors
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPMULTIFIT_PROTEIN_ANCHORS_MAPPING_READER_H
10 #define IMPMULTIFIT_PROTEIN_ANCHORS_MAPPING_READER_H
11 
12 #include <IMP/multifit/multifit_config.h>
17 
18 IMPMULTIFIT_BEGIN_NAMESPACE
19 
20 //! stores the anchors sampling space for each protein
21 class IMPMULTIFITEXPORT ProteinsAnchorsSamplingSpace {
22  public:
23  ProteinsAnchorsSamplingSpace(multifit::ProteomicsData *prots = 0)
24  : prots_(prots) {
25  }
26  void set_anchors(const multifit::AnchorsData &data) {
27  anchors_data_=data;}
28  multifit::AnchorsData get_anchors()const {return anchors_data_;}
29  inline std::string get_anchors_filename() const {return anchors_fn_;}
30  void set_anchors_filename(const std::string &fn) {anchors_fn_=fn;}
31  multifit::ProteomicsData *get_proteomics_data() const {return prots_;}
32  void add_protein(const multifit::ProteinRecordData &rec) {
33  prots_->add_protein(rec);
34  }
35  IntsList get_paths_for_protein(const std::string &prot_name) const {
36  IMP_USAGE_CHECK(paths_map_.find(prot_name)!=paths_map_.end(),"Protein:"
37  <<prot_name<<" is not found");
38  return paths_map_.find(prot_name)->second;}
39  void set_paths_filename_for_protein(const std::string &prot_name,
40  const std::string &paths_filename){
41  IMP_USAGE_CHECK(paths_filename_.find(prot_name)==paths_filename_.end(),
42  "Protein:"<<prot_name<<" is already set");
43  paths_filename_[prot_name]=paths_filename;
44  }
45  std::string get_paths_filename_for_protein(const std::string &prot_name)
46  const {
47  IMP_USAGE_CHECK(paths_filename_.find(prot_name)!=paths_filename_.end(),
48  "Protein:"<<prot_name<<" is not found");
49  return paths_filename_.find(prot_name)->second;}
50  void set_paths_for_protein(const std::string &prot_name, IntsList paths){
51  IMP_USAGE_CHECK(paths_map_.find(prot_name)==paths_map_.end(),"Protein:"
52  <<prot_name<<" is already set");
53  paths_map_[prot_name]=paths;
54  }
55 
56  void show(std::ostream &s=std::cout) const;
57 
58  protected:
59  std::map<std::string, IntsList> paths_map_;
60  std::map<std::string,std::string> paths_filename_;
61  multifit::AnchorsData anchors_data_;
63  std::string anchors_fn_;
64 };
66 
67 IMPMULTIFITEXPORT
68 ProteinsAnchorsSamplingSpace read_protein_anchors_mapping(
69  multifit::ProteomicsData *prots,
70  const std::string &anchors_prot_map_fn,
71  int max_paths=INT_MAX);
72 IMPMULTIFITEXPORT
73 void write_protein_anchors_mapping(
74  const std::string &anchors_prot_map_fn,
75  const std::string &anchors_fn,
76  const std::vector<std::pair<String,String> > &prot_paths);
77 
78 //write the protein anchors mapping
79 IMPMULTIFITEXPORT
80 void write_protein_anchors_mapping(
81  const std::string &anchors_prot_map_fn,
83  const Strings &prot_names);
84 
85 //! Get the sampling space of few of the proteins
86 IMPMULTIFITEXPORT
88  const ProteinsAnchorsSamplingSpace &prots_ss,
89  const Strings &prot_names);
90 //! Get the assembly data for a few of the proteins
91 IMPMULTIFITEXPORT
93  multifit::SettingsData *prots_sd,
94  const Strings &prot_names);
95 
96 IMPMULTIFIT_END_NAMESPACE
97 
98 #endif /* IMPMULTIFIT_PROTEIN_ANCHORS_MAPPING_READER_H */