rdkit.ML.files module

Generic file manipulation stuff

class rdkit.ML.files.ReFile(fileName, mode='r', comment='#', trailer='\n')

Bases: object

convenience class for dealing with files with comments

blank (all whitespace) lines, and lines beginning with comment
characters are skipped.

anything following a comment character on a line is stripped off

readline()

read the next line and return it.

return ‘’ on EOF

readlines()

return a list of all the lines left in the file

return [] if there are none

rewind()

rewinds the file (seeks to the beginning)

rdkit.ML.files.ReadDataFile(fileName, comment='#', depVarCol=0, dataType=<class 'float'>)

read in the data file and return a tuple of two Numeric arrays: (independant variables, dependant variables).

ARGUMENTS:

  • fileName: the fileName
  • comment: the comment character for the file
  • depVarcol: the column number containing the dependant variable
  • dataType: the Numeric short-hand for the data type

RETURNS:

a tuple of two Numeric arrays:

(independant variables, dependant variables).