sugar._io.sjson module¶
SJson IO, custom lossless sugar format
- sugar._io.sjson.read_fts_sjson(f)[source]¶
Read features from SJson file
Warning
This function should NOT be called directly, it registers via
read_fts(), call this instead.
- sugar._io.sjson.read_sjson(f)[source]¶
Read SJson file
Note
You can use this function directly to load arbitrary objects containing sugar objects. Just ignore the warning and use a file descriptor ;)
- sugar._io.sjson.write_fts_sjson(fts, f, *, private=False, indent=None)[source]¶
Write features into SJson file
- Parameters:
Warning
This function should NOT be called directly, it registers via
FeatureList.write(), call this instead.
- sugar._io.sjson.write_sjson(seqs, f, *, private=False, indent=None)[source]¶
Write sequences into SJson file
- Parameters:
Note
You can use this function directly to write arbitrary objects containing sugar objects. Just ignore the warning and use a file descriptor ;)
The following example writes an object to JSON and reads it again.
from sugar import read from sugar._io.sjson import read_sjson, write_sjson seqs = read() with open('test.json', 'w') as f: write_sjson([1, seqs], f) with open('test.json') as f: obj2 = read_sjson(f)
Warning
This function should NOT be called directly, it registers via
BioBasket.write(), call this instead.