I/O package¶
I/O interface for file reading, writing and conversions
-
convert
(fname_in, format_in, fname_out, format_out, kwargs_in=None, kwargs_out=None)[source]¶ Convert a file in format x to file in format y
Parameters: Examples
- Convert a sequence file from A3M format to FASTA format:
>>> from conkit import io >>> with open('example.a3m', 'r') as f_in, open('example.fas', 'w') as f_out: ... io.convert(f_in, 'a3m', f_out, 'fasta')
Note
A3M format comes by default WITHOUT insert states, these are removed. To obtain an alignment WITH insert states, use format
a3m-inserts
.- Convert a PconsC3 contact prediction file to the standard Casp RR format:
>>> from conkit import io >>> with open('example.out', 'r') as f_in, open('example.rr', 'w') as f_out: ... io.convert(f_in, 'pconsc3', f_out, 'casprr'))
-
read
(fname, format, f_id='conkit', **kwargs)[source]¶ Parse a file handle to read into structure
Parameters: Returns: The hierarchy instance of the requested file
Return type: hierarchy
Examples
- Read a Multiple Sequence Alignment file into a ConKit hierarchy:
>>> from conkit import io >>> with open('example.a3m', 'r') as f_in: ... hierarchy = io.read(f_in, 'a3m')
- Read a contact prediction file into a conkit hierarchy:
>>> from conkit import io >>> with open('example.mat', 'r') as f_in: ... hierarchy = io.read(f_in, 'ccmpred')
-
write
(fname, format, hierarchy, **kwargs)[source]¶ Parse a file handle to read into structure
Parameters: - fname (filehandle, filename) – A file path or open file handle
- format (str) – File format of handle
- hierarchy – ConKit hierarchy to write
Examples
- Write a ConKit hierarchy into a Multiple Sequence Alignment file:
>>> from conkit import io >>> with open('example.fas', 'r') as f_in, open('example.a3m', 'w') as f_out: ... hierarchy = io.read(f_in, 'fasta') ... io.write(f_out, 'a3m', hierarchy)
- Write a ConKit hierarchy into a contact prediction file:
>>> from conkit import io >>> with open('example.txt', 'r') as f_in, open('example.rr', 'w') as f_out: ... hierarchy = io.read(f_in, 'psicov') ... io.write(f_out, 'casprr', hierarchy)
- conkit.io.a2m module
- conkit.io.a3m module
- conkit.io.aleigen module
- conkit.io.alphafold module
- conkit.io.bbcontacts module
- conkit.io.bclcontact module
- conkit.io.casp module
- conkit.io.caspmode2 module
- conkit.io.ccmpred module
- conkit.io.clustal module
- conkit.io.comsat module
- conkit.io.epcmap module
- conkit.io.evfold module
- conkit.io.fasta module
- conkit.io.freecontact module
- conkit.io.gremlin module
- conkit.io.mapalign module
- conkit.io.mappred module
- conkit.io.membrain module
- conkit.io.ncont module
- conkit.io.pcons module
- conkit.io.pdb module
- conkit.io.plmdca module
- conkit.io.psicov module
- conkit.io.rosetta module
- conkit.io.rosetta_npz module
- conkit.io.stockholm module
- conkit.io.tests package
- Submodules
- conkit.io.tests.helpers module
- conkit.io.tests.test__cache module
- conkit.io.tests.test__iotools module
- conkit.io.tests.test__parser module
- conkit.io.tests.test_a2m module
- conkit.io.tests.test_a3m module
- conkit.io.tests.test_aleigen module
- conkit.io.tests.test_alphafold module
- conkit.io.tests.test_bbcontacts module
- conkit.io.tests.test_bclcontact module
- conkit.io.tests.test_casp module
- conkit.io.tests.test_caspmode2 module
- conkit.io.tests.test_ccmpred module
- conkit.io.tests.test_clustal module
- conkit.io.tests.test_comsat module
- conkit.io.tests.test_epcmap module
- conkit.io.tests.test_evfold module
- conkit.io.tests.test_fasta module
- conkit.io.tests.test_freecontact module
- conkit.io.tests.test_gremlin module
- conkit.io.tests.test_mapalign module
- conkit.io.tests.test_mappred module
- conkit.io.tests.test_membrain module
- conkit.io.tests.test_ncont module
- conkit.io.tests.test_pcons module
- conkit.io.tests.test_pdb module
- conkit.io.tests.test_plmdca module
- conkit.io.tests.test_psicov module
- conkit.io.tests.test_rosetta_npz module
- conkit.io.tests.test_stockholm module
- Submodules
- conkit.io.tests.helpers module
- conkit.io.tests.test__cache module
- conkit.io.tests.test__iotools module
- conkit.io.tests.test__parser module
- conkit.io.tests.test_a2m module
- conkit.io.tests.test_a3m module
- conkit.io.tests.test_aleigen module
- conkit.io.tests.test_alphafold module
- conkit.io.tests.test_bbcontacts module
- conkit.io.tests.test_bclcontact module
- conkit.io.tests.test_casp module
- conkit.io.tests.test_caspmode2 module
- conkit.io.tests.test_ccmpred module
- conkit.io.tests.test_clustal module
- conkit.io.tests.test_comsat module
- conkit.io.tests.test_epcmap module
- conkit.io.tests.test_evfold module
- conkit.io.tests.test_fasta module
- conkit.io.tests.test_freecontact module
- conkit.io.tests.test_gremlin module
- conkit.io.tests.test_mapalign module
- conkit.io.tests.test_mappred module
- conkit.io.tests.test_membrain module
- conkit.io.tests.test_ncont module
- conkit.io.tests.test_pcons module
- conkit.io.tests.test_pdb module
- conkit.io.tests.test_plmdca module
- conkit.io.tests.test_psicov module
- conkit.io.tests.test_rosetta_npz module
- conkit.io.tests.test_stockholm module