RiboKit : RDATKit

RNA Dataset ToolKit

RDAT File Handling

To read an RDAT file into session:

import rdatkit

# create RDATFile instance
rdat = rdatkit.RDATFile()
# load RDAT file
rdat.load(open('myRDATFile.rdat'))

The RDATFile object has a dictionary constructs that contains all of the expected information for each construct in the file. For convenience, data are saved as dictionaries of matrices (indexed by the construct names): values, xsels, errors, and traces, respectively. You can use the save() method of the RDATFile to write back the changes you have made to the data.

To validate the data contained in a RDAT file (e.g. checking that the sequence positions specified in seqpos are the same length as the peak values called), simply call:

# validate RDAT file
rdat.validate()

This will produce a bunch of warnings if the file suffers inconsistencies.

Finally, RDATFile objects can be converted to ISATABFile objects for format convertions:

# convert RDAT to ISATAB
isatab = rdat.toISATAB()

ISATAB File Handling

ISATAB files are handled in a similar way in Python, but under ISATABFile class instead of RDATFile class. Here is a summary script of ISATAB file handling similar to what has been previously demonstrated with RDAT file:

import rdatkit

# create ISATABFile instance
isatab = rdatkit.ISATABFile()
# load ISATAB file
filename = 'myISATABfile.xls'
isatab.load(filename, type='xls')
# load ISATAB files from directory
dirname = 'isatab_files/'
isatab.load(dirname, type='dir')
# validate ISATAB file
isatab.validate()
# write to ISATAB file
isatab.save('test.xls', type='xls')

The type option in the save() and load() methods specifies whether to save/load from/to an excel .xls file or a directory of .csv files (one for each sheet).

For more information about the ISATAB file specification, specifically used in the RNA mapping field, visit SNRNASM.

Built with Jekyll using a RiboKit Theme . Hosted on GitHub Pages.