GRP, GMT (set_io)

set_io contains simple scripts for parsing two other common file types used by the Connectivity Map: GRP and GMT files. The GRP file is used for storing a single set of things (e.g. a single gene set), while the GMT file is used for storing multiple sets of things (e.g. several gene sets).

Further details on GRP and GMT files can be found here.

Reading GRP files

cmapPy.set_io.grp.read(in_path)[source]

Read a grp file at the path specified by in_path.

Args:
in_path (string): path to GRP file
Returns:
grp (list)

Writing GRP files

cmapPy.set_io.grp.write(grp, out_path)[source]

Write a GRP to a text file.

Args:
grp (list): GRP object to write to new-line delimited text file out_path (string): output path
Returns:
None

Reading GMT files

cmapPy.set_io.gmt.read(file_path)[source]

Read a gmt file at the path specified by file_path.

Args:
file_path (string): path to gmt file
Returns:
gmt (GMT object): list of dicts, where each dict corresponds to one
line of the GMT file

Verifying GMT integrity

cmapPy.set_io.gmt.verify_gmt_integrity(gmt)[source]

Make sure that set ids are unique.

Args:
gmt (GMT object): list of dicts
Returns:
None

Writing GMT files

cmapPy.set_io.gmt.write(gmt, out_path)[source]

Write a GMT to a text file.

Args:
gmt (GMT object): list of dicts out_path (string): output path
Returns:
None