Molecule I/O
SDFile
MolecularGraph.sdfilereader
— Method.sdfilereader(file::IO)
Read SDFile data from input stream and return a lazy iterator which yields molecule objects.
sdfilereader
does not stop and raise errors when an erroneous or incompatible SDFile block is read but produces an error message and yields an empty molecule. If this behavior is not desirable, you can use the customized supplier function instead of default supplier nohaltsupplier
function customsupplier()
mol = try
parse(SDFile, block)
catch e
throw(ErrorException("incompatible molecule found, aborting..."))
end
return defaultpostprocess(mol)
end
function sdfilereader(file::IO)
return SDFileReader(eachline(file), customsupplier)
end
MolecularGraph.sdfilereader
— Method.sdfilereader(path::AbstractString)
Read a SDFile and return a lazy iterator which yields molecule objects.
MolecularGraph.sdftomol
— Method.sdftomol(file::IO)
Read a SDFile mol block from the input stream and parse it into a molecule object.
MolecularGraph.sdftomol
— Method.sdftomol(path::AbstractString)
Read a SDFile and parse it into a molecule object. Single mol block files without optional information are often provided as a .mol file.
Base.parse
— Method.parse(::Type{SDFile}, lines)
Parse lines of a SDFile mol block data into a molecule object.