This file is indexed.

/usr/include/rdkit/GraphMol/FileParsers/MolWriters.h is in librdkit-dev 201503-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
//
//  Copyright (C) 2002-2013 Greg Landrum, Rational Discovery LLC
//
//   @@ All Rights Reserved @@
//  This file is part of the RDKit.
//  The contents are covered by the terms of the BSD license
//  which is included in the file license.txt, found at the root
//  of the RDKit source tree.
//

#ifndef _RD_MOLWRITERS_H_
#define _RD_MOLWRITERS_H_

#include <RDGeneral/types.h>

#include <string>
#include <iostream>
#include <GraphMol/ROMol.h>

namespace RDKit {

  static int defaultConfId=-1;
  class MolWriter {
  public:
    virtual ~MolWriter() {}
    virtual void write(const ROMol &mol,int confId=defaultConfId) = 0;
    virtual void flush() = 0;
    virtual void close() = 0;
    virtual void setProps(const STR_VECT &propNames)=0;
    virtual unsigned int numMols() const =0;
  };

  //! The SmilesWriter is for writing molecules and properties to
  //! delimited text files.
  class SmilesWriter : public MolWriter {
    /******************************************************************************
     * A Smiles Table writer - this is how it is used
     *  - create a SmilesWriter with a output file name (or a ostream), a delimiter,
     *     and a list of properties that need to be written out
     *  - then a call is made to the write function for each molecule that needs to
     *     be written out
     ******************************************************************************/
  public:
    /*!
      \param fileName       : filename to write to ("-" to write to stdout)
      \param delimiter      : delimiter to use in the text file
      \param nameHeader     : used to label the name column in the output. If this
                              is provided as the empty string, no names will be written.
      \param includeHeader  : toggles inclusion of a header line in the output
      \param isomericSmiles : toggles generation of isomeric SMILES
      \param kekuleSmiles   : toggles the generation of kekule SMILES

     */
    SmilesWriter(std::string fileName, 
		 std::string delimiter=" ",
		 std::string nameHeader="Name",
		 bool includeHeader=true,
                 bool isomericSmiles=false,
                 bool kekuleSmiles=false);
    //! \overload
    SmilesWriter(std::ostream *outStream, 
		 std::string delimiter=" ",
		 std::string nameHeader="Name",
		 bool includeHeader=true,
		 bool takeOwnership=false,
                 bool isomericSmiles=false,
                 bool kekuleSmiles=false);
		 
    ~SmilesWriter();

    //! \brief set a vector of property names that are need to be
    //! written out for each molecule
    void setProps(const STR_VECT &propNames);

    //! \brief write a new molecule to the file
    void write(const ROMol &mol,int confId=defaultConfId);

    //! \brief flush the ostream
    void flush() {
      PRECONDITION(dp_ostream,"no output stream");
      dp_ostream->flush();
    };

    //! \brief close our stream (the writer cannot be used again)
    void close() {
      PRECONDITION(dp_ostream,"no output stream");
      dp_ostream->flush();
      if(df_owner) {
        delete dp_ostream;
        df_owner=false;
      }
      dp_ostream=NULL;
    };

    //! \brief get the number of molecules written so far
    unsigned int numMols() const { return d_molid;} ;

  private:
    // local initialization
    void init(std::string delimiter,std::string nameHeader,
              bool includeHeader,
              bool isomericSmiles,
              bool kekuleSmiles);


    // dumps a header line to the output stream
    void dumpHeader() const;


    std::ostream *dp_ostream;
    bool df_owner;
    bool df_includeHeader; // whether or not to include a title line
    unsigned int d_molid; // the number of the molecules we wrote so far
    std::string d_delim; // delimiter string between various records
    std::string d_nameHeader; // header for the name column in the output file
    STR_VECT d_props; // list of property name that need to be written out
    bool df_isomericSmiles; // whether or not to do isomeric smiles
    bool df_kekuleSmiles; // whether or not to do kekule smiles
  };


  //! The SDWriter is for writing molecules and properties to
  //! SD files 
  class SDWriter : public MolWriter {
    /**************************************************************************************
     * A SD file ( or stream) writer - this is how it is used
     *  - create a SDMolWriter with a output file name (or a ostream),
     *     and a list of properties that need to be written out
     *  - then a call is made to the write function for each molecule that needs to be written out
     **********************************************************************************************/
  public:
    /*!
      \param fileName       : filename to write to ("-" to write to stdout)
     */
    SDWriter(std::string fileName);
    SDWriter(std::ostream *outStream,bool takeOwnership=false);

    ~SDWriter();

    //! \brief set a vector of property names that are need to be
    //! written out for each molecule
    void setProps(const STR_VECT &propNames);

    //! \brief write a new molecule to the file
    void write(const ROMol &mol, int confId=defaultConfId);

    //! \brief flush the ostream
    void flush() { 
      PRECONDITION(dp_ostream,"no output stream");
      dp_ostream->flush();
    } ;

    //! \brief close our stream (the writer cannot be used again)
    void close() {
      PRECONDITION(dp_ostream,"no output stream");
      dp_ostream->flush();
      if(df_owner) {
        delete dp_ostream;
        df_owner=false;
      }
      dp_ostream=NULL;
    };

    //! \brief get the number of molecules written so far
    unsigned int numMols() const { return d_molid; };

    void setForceV3000(bool val) { df_forceV3000=val; };
    bool getForceV3000() const { return df_forceV3000; };    
    
    void setKekulize(bool val) { df_kekulize=val; };
    bool getKekulize() const { return df_kekulize; };    
    
  private:
    void writeProperty(const ROMol &mol, std::string name);

    std::ostream *dp_ostream;
    bool df_owner;
    unsigned int d_molid; // the number of the molecules we wrote so far
    STR_VECT d_props; // list of property name that need to be written out
    bool df_forceV3000; // force writing the mol blocks as V3000
    bool df_kekulize; // toggle kekulization of molecules on writing
  };

  //! The TDTWriter is for writing molecules and properties to
  //! TDT files 
  class TDTWriter : public MolWriter {
    /**************************************************************************************
     * A TDT file ( or stream) writer - this is how it is used
     *  - create a TDTWriter with a output file name (or a ostream),
     *     and a list of properties that need to be written out
     *  - then a call is made to the write function for each molecule that needs to be written out
     **********************************************************************************************/
  public:
    /*!
      \param fileName       : filename to write to ("-" to write to stdout)
     */
    TDTWriter(std::string fileName);
    TDTWriter(std::ostream *outStream,bool takeOwnership=false);

    ~TDTWriter();

    //! \brief set a vector of property names that are need to be
    //! written out for each molecule
    void setProps(const STR_VECT &propNames);

    //! \brief write a new molecule to the file
    void write(const ROMol &mol, int confId=defaultConfId);

    //! \brief flush the ostream
    void flush() { 
      PRECONDITION(dp_ostream,"no output stream");
      dp_ostream->flush();
    };

    //! \brief close our stream (the writer cannot be used again)
    void close() {
      PRECONDITION(dp_ostream,"no output stream");
      dp_ostream->flush();
      if(df_owner) {
        delete dp_ostream;
        df_owner=false;
      }
      dp_ostream=NULL;
    };

    //! \brief get the number of molecules written so far
    unsigned int numMols() const { return d_molid; };

    void setWrite2D(bool state=true) { df_write2D=state; };
    bool getWrite2D() const { return df_write2D; };

    void setWriteNames(bool state=true) { df_writeNames=state; };
    bool getWriteNames() const { return df_writeNames; };

    void setNumDigits(unsigned int numDigits) { d_numDigits=numDigits; };
    unsigned int getNumDigits() const { return d_numDigits;};
    
  private:
    void writeProperty(const ROMol &mol, std::string name);

    std::ostream *dp_ostream;
    bool df_owner;
    unsigned int d_molid; // the number of molecules we wrote so far
    STR_VECT d_props; // list of property name that need to be written out
    bool df_write2D; // write 2D coordinates instead of 3D
    bool df_writeNames; // write a name record for each molecule
    unsigned int d_numDigits; // number of digits to use in our output of coordinates;
  };

  //! The PDBWriter is for writing molecules to Brookhaven Protein
  //! DataBank format files.
  class PDBWriter : public MolWriter {
  public:
    PDBWriter(std::string fileName, unsigned int flavor = 0);
    PDBWriter(std::ostream *outStream, bool takeOwnership=false,
              unsigned int flavor = 0);
    ~PDBWriter();

    //! \brief write a new molecule to the file
    void write(const ROMol &mol, int confId=defaultConfId);

    void setProps(const STR_VECT&) {};

    //! \brief flush the ostream
    void flush() { 
      PRECONDITION(dp_ostream,"no output stream");
      dp_ostream->flush();
    } ;

    //! \brief close our stream (the writer cannot be used again)
    void close() {
      PRECONDITION(dp_ostream,"no output stream");
      dp_ostream->flush();
      if(df_owner) {
        delete dp_ostream;
        df_owner=false;
      }
      dp_ostream=NULL;
    };

    //! \brief get the number of molecules written so far
    unsigned int numMols() const { return d_count;} ;

  private:
    std::ostream *dp_ostream;
    unsigned int d_flavor;
    unsigned int d_count;
    bool df_owner;
  };
 

}

#endif