RDKit: RDKit::SDWriter Class Reference

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
RDKit::SDWriter Class Reference

`#include <MolWriters.h>`

Inheritance diagram for RDKit::SDWriter:

## Public Member Functions
| SDWriter (const std::string &fileName)
| SDWriter (std::ostream *outStream, bool takeOwnership=false)
| ~SDWriter () override
void | setProps (const STR_VECT &propNames) override
| set a vector of property names that are need to be written out for each molecule
void | write (const ROMol &mol, int confId=defaultConfId) override
| write a new molecule to the file
void | flush () override
| flush the ostream
void | close () override
| close our stream (the writer cannot be used again)
unsigned int | numMols () const override
| get the number of molecules written so far
void | setForceV3000 (bool val)
bool | getForceV3000 () const
void | setKekulize (bool val)
bool | getKekulize () const
Public Member Functions inherited from RDKit::MolWriter
virtual | ~MolWriter ()

## Static Public Member Functions
static std::string | getText (const ROMol &mol, int confId=defaultConfId, bool kekulize=true, bool force_V3000=false, int molid=-1, STR_VECT *propNames=nullptr)
| return the text that would be written to the file

## Detailed Description

The SDWriter is for writing molecules and properties to SD files

Definition at line 140 of file MolWriters.h.

## Constructor & Destructor Documentation

## ◆ SDWriter() [1/2]

RDKit::SDWriter::SDWriter | ( | const std::string & | fileName | ) |

Parameters

  fileName | : filename to write to ("-" to write to stdout)

## ◆ SDWriter() [2/2]

RDKit::SDWriter::SDWriter | ( | std::ostream * | outStream,
|  | bool | takeOwnership = false )

## ◆ ~SDWriter()

RDKit::SDWriter::~SDWriter | ( |  | ) |
| override

## Member Function Documentation

## ◆ close()

void RDKit::SDWriter::close | ( |  | ) |
| inlineoverridevirtual

close our stream (the writer cannot be used again)

Implements RDKit::MolWriter.

Definition at line 185 of file MolWriters.h.

References flush().

## ◆ flush()

void RDKit::SDWriter::flush | ( |  | ) |
| inlineoverridevirtual

flush the ostream

Implements RDKit::MolWriter.

Definition at line 170 of file MolWriters.h.

References PRECONDITION.

Referenced by close().

## ◆ getForceV3000()

bool RDKit::SDWriter::getForceV3000 | ( |  | ) | const
| inline

Definition at line 200 of file MolWriters.h.

## ◆ getKekulize()

bool RDKit::SDWriter::getKekulize | ( |  | ) | const
| inline

Definition at line 203 of file MolWriters.h.

## ◆ getText()

static std::string RDKit::SDWriter::getText | ( | const ROMol & | mol,
|  | int | confId = defaultConfId,
|  | bool | kekulize = true,
|  | bool | force_V3000 = false,
|  | int | molid = -1,
|  | STR_VECT * | propNames = nullptr )
| static

return the text that would be written to the file

References RDKit::defaultConfId.

## ◆ numMols()

unsigned int RDKit::SDWriter::numMols | ( |  | ) | const
| inlineoverridevirtual

get the number of molecules written so far

Implements RDKit::MolWriter.

Definition at line 197 of file MolWriters.h.

## ◆ setForceV3000()

void RDKit::SDWriter::setForceV3000 | ( | bool | val | ) |
| inline

Definition at line 199 of file MolWriters.h.

## ◆ setKekulize()

void RDKit::SDWriter::setKekulize | ( | bool | val | ) |
| inline

Definition at line 202 of file MolWriters.h.

## ◆ setProps()

void RDKit::SDWriter::setProps | ( | const STR_VECT & | propNames | ) |
| overridevirtual

set a vector of property names that are need to be written out for each molecule

Implements RDKit::MolWriter.

## ◆ write()

void RDKit::SDWriter::write | ( | const ROMol & | mol,
|  | int | confId = defaultConfId )
| overridevirtual

write a new molecule to the file

Implements RDKit::MolWriter.

References RDKit::defaultConfId.

The documentation for this class was generated from the following file:

- MolWriters.h