Skip to content

export DNA sequences from extensions and loopouts #287

@dave-doty

Description

@dave-doty

This code crashes:

design = sc.Design(helices=[sc.Helix(max_offset=100)])
design.draw_strand(0, 0).extension_5p(3).move(5).with_sequence('TTT' + 'AAAAA')
contents = design.to_idt_bulk_input_format()

with this exception:

..\scadnano\scadnano.py:7369: in to_idt_bulk_input_format
    [strand.vendor_export_name(), strand.vendor_dna_sequence(domain_delimiter=domain_delimiter),
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = Strand(domains=[Extension(num_bases=3, display_length=1.0, display_angle=35.0, label=None, name=None, dna_sequence='TT...ields=None, is_scaffold=False, modification_5p=None, modification_3p=None, modifications_int={}, name=None, label=None)
domain_delimiter = ''

    def vendor_dna_sequence(self, domain_delimiter: str = '') -> str:
        """
        :param domain_delimiter:
            string to put in between DNA sequences of each domain, and between 5'/3' modifications and DNA.
            Note that the delimiter is not put between internal modifications and the next base(s)
            in the same domain.
        :return: DNA sequence as it needs to be typed to order from a DNA synthesis vendor, with
            :py:data:`Modification5Prime`'s,
            :py:data:`Modification3Prime`'s,
            and
            :py:data:`ModificationInternal`'s represented with text codes, e.g., for IDT DNA, using
            "/5Biosg/ACGT" for sequence ACGT with a 5' biotin modification.
        """
        self._ensure_modifications_legal(check_offsets_legal=True)
    
        if self.dna_sequence is None:
            raise ValueError('DNA sequence has not been assigned yet')
    
        ret_list: List[str] = []
    
        if self.modification_5p is not None and self.modification_5p.vendor_code is not None:
            ret_list.append(self.modification_5p.vendor_code)
    
        for substrand in self.domains:
>           ret_list.append(substrand.vendor_dna_sequence())
E           AttributeError: 'Extension' object has no attribute 'vendor_dna_sequence'

..\scadnano\scadnano.py:4362: AttributeError

This code also crashes:

design = sc.Design(helices=[sc.Helix(max_offset=100), sc.Helix(max_offset=100)])
design.draw_strand(0, 0).move(5).loopout(1, 3).move(-5).with_sequence('AAAAA' + 'TTT' + 'AAAAA')
contents = design.to_idt_bulk_input_format()

It's not happening in the web interface, yay strongly typed languages.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions