sbol_utilities.sbol3_genbank_conversion
Module Contents
Classes
Main Converter class handling offline, direction conversion of files SBOL3 files to and from GenBank files |
- class GenBankSBOL3Converter
Main Converter class handling offline, direction conversion of files SBOL3 files to and from GenBank files
While instantiating an instance of the converter, required builders must be registered in order to accurately parse modified or new SBOL3 class objects
- class ComponentGenBankExtension(identity: str, types: Optional[Union[str, Sequence[str]]], **kwargs)
Bases:
sbol3.ComponentOverrides the sbol3 Component class to include fields to directly read and write extraneous properties of GenBank not storable in any SBOL3 data field. :extends: sbol3.Component class
- GENBANK_EXTRA_PROPERTY_NS = http://www.ncbi.nlm.nih.gov/genbank
- class CustomReferenceProperty(type_uri=CUSTOM_REFERENCE_NS, identity=None)
Bases:
sbol3.CustomIdentifiedServes to store information and annotations for ‘Reference’ objects in GenBank file to SBOL3 while parsing so that it may be retrieved back in a round trip :extends: sbol3.CustomIdentified class
- CUSTOM_REFERENCE_NS = http://www.ncbi.nlm.nih.gov/genbank#GenbankReference
- class CustomStructuredCommentProperty(type_uri=CUSTOM_STRUCTURED_COMMENT_NS, identity=None)
Bases:
sbol3.CustomIdentifiedServes to store information and annotations for ‘Structured_Comment’ objects in GenBank file to SBOL3 while parsing so that it may be retrieved back in a round trip Complete reference available at: https://www.ncbi.nlm.nih.gov/genbank/structuredcomment/ :extends: sbol3.CustomIdentified class
- CUSTOM_STRUCTURED_COMMENT_NS = http://www.ncbi.nlm.nih.gov/genbank#GenbankStructuredComment
- class FeatureGenBankExtension(locations: List[sbol3.Location] = None, **kwargs)
Bases:
sbol3.SequenceFeatureOverrides the sbol3 SequenceFeature class to include fields to directly read and write qualifiers of GenBank features not storable in any SBOL3 data field. :extends: sbol3.SequenceFeature class
- GENBANK_FEATURE_QUALIFIER_NS = http://www.ncbi.nlm.nih.gov/genbank#featureQualifier
- class LocationGenBankExtension(sequence: sbol3.Sequence = sbol3.Sequence('autoCreatedSequence'), *, identity: str = None, type_uri: str = GENBANK_RANGE_NS, **kwargs)
Bases:
sbol3.LocationOverrides the sbol3 Location class to include fields to store the start and end position types (AfterPosition / BeforePosition / ExactPosition). :extends: sbol3.Location class
- GENBANK_RANGE_NS = http://www.ncbi.nlm.nih.gov/genbank#locationPosition
- BIO_STRAND_FORWARD = 1
- BIO_STRAND_REVERSE
- COMP_ROLES
- COMP_TYPES
- DEFAULT_GB_SEQ_VERSION = 1
- DEFAULT_GB_TERM = misc_feature
- DEFAULT_SO_TERM = SO:0000110
- GB2SO_MAPPINGS_CSV
- GENBANK_LOCATION_POSITION
- SBOL_LOCATION_POSITION
- SEQUENCE_ENCODING
- SO2GB_MAPPINGS_CSV
- TEST_NAMESPACE = https://test.sbol3.genbank/
- gb2so_map
- so2gb_map
- convert_genbank_to_sbol3(self, gb_file: str, sbol3_file: str = 'sbol3.nt', namespace: str = TEST_NAMESPACE, write: bool = False) sbol3.Document
Convert a GenBank document on disk into an SBOL3 document The GenBank document is parsed using BioPython, and corresponding objects of SBOL3 document are created
- Parameters
gb_file – path to read GenBank file from
sbol3_file – path to write SBOL3 file to, if write set to true
namespace – URIs of Components will be set to {namespace}/{genbank_id}, defaults to “https://test.sbol3.genbank/”
write – writes the generated sbol3 document in SORTED_NTRIPLES format to provided sbol3_file path
- Returns
SBOL3 document containing converted materials
- convert_sbol3_to_genbank(self, sbol3_file: str, doc: sbol3.Document = None, gb_file: str = 'genbank.out', write: bool = False) Dict
Convert a SBOL3 document on disk into a GenBank document The GenBank document is made using an array of SeqRecords using BioPython, by parsing SBOL3 objects
- Parameters
sbol3_file – path to read SBOL3 file from
gb_file – path to write GenBank file to, if write set to true
write – writes the generated genbank document to provided path
- Returns
Array of SeqRecord objects which comprise the generated GenBank document
- create_gb2so_role_mappings(self, gb2so_csv: str = GB2SO_MAPPINGS_CSV, so2gb_csv: str = SO2GB_MAPPINGS_CSV, convert_gb2so: bool = True, convert_so2gb: bool = True) int
Reads 2 CSV Files containing mappings for converting between GenBank and SequenceOntology (SO) roles :param gb2so_csv: path to read genbank to so conversion csv file :param so2gb_csv: path to read so to genbank conversion csv file :param convert_gb2so: bool stating whether to read csv for genbank to SO mappings :param convert_so2gb: bool stating whether to read csv for SO to genbank mappings :return: int 1 / 0 denoting the status of whether the mappings were created and stored in dictionaries