def deepcopy(self, id_modifier): copy_ptr = libsbol.copyDNAComponent(self.ptr, id_modifier) copy_uri = self.uri + id_modifier copy = DNAComponent(self.doc, copy_uri, copy_ptr) seq_copy_ptr = libsbol.getDNAComponentSequence(copy_ptr) if seq_copy_ptr: seq_copy_uri = libsbol.getDNASequenceURI(seq_copy_ptr) seq_copy = DNASequence(self.doc, seq_copy_uri, ptr=seq_copy_ptr) for i_ann in range(libsbol.getNumSequenceAnnotationsFor(copy.ptr)): SA_copy_ptr = libsbol.getNthSequenceAnnotationFor(copy.ptr, i_ann) SA_copy_uri = libsbol.getSequenceAnnotationURI(SA_copy_ptr) SA_copy = SequenceAnnotation(self.doc, SA_copy_uri, ptr=SA_copy_ptr) return copy
def read(self, filename): libsbol.readDocument(self.ptr, filename) # Instantiate python proxy objects for each C object in file for i in range(0, libsbol.getNumDNASequences(self.ptr)): ptr = libsbol.getNthDNASequence(self.ptr, i) uri = libsbol.getDNASequenceURI(ptr) seq = DNASequence(self, uri, ptr) for i in range(0, libsbol.getNumSequenceAnnotations(self.ptr)): ptr = libsbol.getNthSequenceAnnotation(self.ptr, i) uri = libsbol.getSequenceAnnotationURI(ptr) seq_annotation = SequenceAnnotation(self, uri, ptr) for i in range(0, libsbol.getNumDNAComponents(self.ptr)): ptr = libsbol.getNthDNAComponent(self.ptr, i) uri = libsbol.getDNAComponentURI(ptr) component = DNAComponent(self, uri, ptr) for i in range(0, libsbol.getNumCollections(self.ptr)): ptr = libsbol.getNthCollection(self.ptr, i) uri = libsbol.getCollectionURI(ptr) collection = SequenceAnnotation(self, uri, ptr)
def uri(self): return libsbol.getDNASequenceURI(self.ptr)