def assemble_with(self,
                   other,
                   annotate_homology=False,
                   annotation_type="homology",
                   **qualifiers):
     connector_str = str(self.seq.right_end)
     connector = SeqRecord(Seq(connector_str))
     if len(qualifiers) == 0:
         label = "homology" if (len(connector) > 8) else connector_str
         qualifiers = {"label": label}
     if annotate_homology:
         connector.features = [
             SeqFeature(
                 FeatureLocation(0, len(connector), 1),
                 type=annotation_type,
                 qualifiers=qualifiers,
             )
         ]
     selfc = SeqRecord(
         seq=Seq(str(self.seq)),
         features=self.features,
         annotations=self.annotations,
     )
     new_record = SeqRecord.__add__(selfc, connector).__add__(other)
     new_record.seq = self.seq + other.seq
     new_record.__class__ = StickyEndsSeqRecord
     new_record.seq.alphabet = DNAAlphabet()
     return new_record
Example #2
0
    def assemble_with(self,
                      other,
                      annotate_homology=False,
                      annotation_type="homology"):
        connector_str = str(self.seq.right_end)
        connector = SeqRecord(Seq(connector_str))
        if annotate_homology:
            self.annotate_connector(connector, annotation_type=annotation_type)
        selfc = SeqRecord(
            seq=Seq(str(self.seq)),
            features=self.features,
            annotations=self.annotations,
        )
        new_record = SeqRecord.__add__(selfc, connector).__add__(other)
        new_record.seq = self.seq + other.seq
        new_record.__class__ = StickyEndFragment

        if has_dna_alphabet:  # Biopython <1.78
            new_record.seq.alphabet = DNAAlphabet()
        new_record.annotations["molecule_type"] = "DNA"

        return new_record