Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DisulfideFile.hh
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
10 // vi: set ts=2 noet:
11 
12 /// @file core/io/raw_data/DisulfideFile.hh
13 /// @brief A simple wrapper for a Disulfide File suitable for the -fix_disulf option.
14 /// @author Spencer Bliven <blivens@u.washington.edu>
15 
16 #ifndef INCLUDED_core_io_raw_data_DisulfideFile_hh
17 #define INCLUDED_core_io_raw_data_DisulfideFile_hh
18 
19 #include <core/pose/Pose.fwd.hh>
20 #include <core/types.hh>
21 // AUTO-REMOVED #include <utility/vector1.hh>
22 
23 #include <string>
24 // AUTO-REMOVED #include <utility>
25 
26 #include <utility/vector1.hh>
27 
28 
29 namespace core {
30 namespace io {
31 namespace raw_data {
32 
33 /// @brief Parses and stores a disulfide file.
34 /// @details Initiallizing a DisulfideFile is a lightweight operation.
35 /// The heavy lifting occurs the first time disulfides() is called. This parses
36 /// the file and caches the resulting pairs of residues.
37 /// Subsequent calls to disulfides() are fast since they don't reparse the file
38 /// but merely reinterpret the results in terms of the specified.
39 ///
40 /// @section format File Format
41 /// The disulfide file format is pretty flexible. It looks for three kinds of lines:
42 /// - '12 42' Lines with two integers are interpreted as a disulfide
43 /// bond, indexed by internal rosetta residue number, i.e. the 12th and 42nd
44 /// residues from the start of the pose.
45 /// - '12A 42A' If a single character is appended to the numbers, DisulfideFile
46 /// assumes that these refer to the pdb number and chain, i.e. the residues
47 /// of chain A numbered 12 and 42 in the pdb.
48 /// - 'SSBOND 1 CYS A 12 CYS A 42' The
49 /// <a href="http://www.wwpdb.org/documentation/format32/sect6.html#SSBOND">
50 /// PDB format</a> for disulfide bond annotations.
51 ///
52 /// All lines not matching these criteria are silently ignored. This implies
53 /// that whole pdb files can usually be used unaltered as disulfide files, since
54 /// the SSBOND entries are extracted and all else is ignored.
56 private:
57  /// @brief distinguish between PDB numbering and internal Rosetta numbering
58  /// @details unknown_num should be avoided, as one of the other types can
59  /// generally be infered from the existance of a chain specifier.
64  };
65  /// @brief represents a residue of either pdb or rosetta numbering.
66  /// @details pdb numbers should include a chain character; rosetta numbers
67  /// have chain==0
68  typedef struct {
70  char chain;
72  } ResNum;
73 
74 public:
76  filename_(filename),
77  up_to_date_(false),
78  disulfides_() { }
79 
80  /// @brief Accessor for the filename
81  inline std::string const& filename() const { return filename_; }
82 
83  /// @brief Get a list of disulfide bonds declared in the file
84  void disulfides(
85  utility::vector1< std::pair<core::Size,core::Size> > & disulfides ) const;
86 
87  /// @brief Get a list of disulfide bonds declared in the file
88  /// (renumbered to rosetta numbering if necessary)
89  void disulfides(
90  utility::vector1< std::pair<core::Size,core::Size> > & disulfides,
91  core::pose::Pose const& pose ) const;
92 
93  /// @brief Get a list of disulfide bonds declared in the file
94  /// (renumbered to rosetta numbering if necessary)
95  /// also manually set the disulfides in the conformation of the provided pose
96  /// (this is a necessary workaround for dealing with multiple disulfide specification
97  /// files in PyRosetta
99  core::pose::Pose &pose );
100 private:
101  /// @brief helper function to read in the file
102  void parse_disulf_file() const;
103  /// @brief convert a ResNum struct into a normal rosetta residue num
104  core::Size resnum_to_rosetta_num(core::pose::Pose const& pose, ResNum const& resnum) const;
105 private:
107 
108  //Read from the file once, then cache data in disulfides_
109  mutable bool up_to_date_; //flag that disulfides_ has read the file
111 
112 }; //DisulfideFile
113 
114 } //raw_data
115 } //io
116 } //core
117 
118 #endif