ProteinsAnchorsSamplingSpace read_protein_anchors_mapping(
    multifit::ProteomicsData *prots, const std::string &anchors_prot_map_fn,
    int max_paths) {
  ProteinsAnchorsSamplingSpace ret(prots);
  std::fstream in;
  IMP_LOG_TERSE("FN:" << anchors_prot_map_fn << std::endl);
  in.open(anchors_prot_map_fn.c_str(), std::fstream::in);
  if (!in.good()) {
    IMP_WARN(
        "Problem opening file " << anchors_prot_map_fn
                                << " for reading; returning empty mapping data"
                                << std::endl);
    in.close();
    return ret;
  }
  std::string line;
  // first line should be the anchors line
  getline(in, line);
  std::string anchors_fn =
      get_relative_path(anchors_prot_map_fn, parse_anchors_line(line));
  IMP_LOG_TERSE("FN:" << anchors_fn << std::endl);
  multifit::AnchorsData anchors_data =
      multifit::read_anchors_data(anchors_fn.c_str());
  ret.set_anchors(anchors_data);
  ret.set_anchors_filename(anchors_fn);
  while (!in.eof()) {
    if (!getline(in, line)) break;
    IMP_LOG_VERBOSE("working on line:" << line);
    IMP_USAGE_CHECK(is_protein_line(line), "the line should be a protein line");
    boost::tuple<std::string, std::string, IntsList> prot_data =
        parse_protein_line(anchors_prot_map_fn, line, max_paths);
    ret.set_paths_for_protein(boost::get<0>(prot_data),
                              boost::get<2>(prot_data));
    ret.set_paths_filename_for_protein(boost::get<0>(prot_data),
                                       boost::get<1>(prot_data));
  }
  return ret;
}
Пример #2
0
ProteomicsData *read_proteomics_data(const char *prot_fn) {
  std::fstream in;
  IMP_NEW(ProteomicsData, data, ());
  in.open(prot_fn, std::fstream::in);
  if (! in.good()) {
    IMP_WARN("Problem opening file " << prot_fn <<
                  " for reading; returning empty proteomics data" << std::endl);
    in.close();
    return data.release();
  }
  std::string line;
  getline(in, line); //skip proteins header line
  getline(in, line); //skip proteins header line
  while ((!in.eof()) && (!is_interaction_header_line(line, data))){
    parse_protein_line(line,data);
    if (!getline(in, line)) break;
  }
  getline(in, line);
  while ((!in.eof()) && (!is_xlink_header_line(line,data))){
    parse_interaction_line(line,data);
    if (!getline(in, line)) break;
  }
  getline(in, line);
  while (!in.eof() && (!is_ev_header_line(line,data))){
    parse_xlink_line(line,data);
    if (!getline(in, line)) break;
  }
  getline(in, line);
  while (!in.eof()) { //ev lines
    parse_ev_line(line,data);
    if (!getline(in, line)) break;
    if (line.size()==0) break;
  }
  in.close();
  return data.release();
}