Skip to content

Commit

Permalink
removed delimiters between internal modifications and rest of sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-doty committed Aug 25, 2023
1 parent 5d8b61d commit 96b5e0d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
14 changes: 6 additions & 8 deletions scadnano/scadnano.py
Original file line number Diff line number Diff line change
Expand Up @@ -2128,12 +2128,8 @@ def strand(self) -> Strand:
raise ValueError('_parent_strand has not yet been set')
return self._parent_strand

def idt_dna_sequence(self, domain_delimiter: str = '') -> Optional[str]:
def idt_dna_sequence(self) -> Optional[str]:
"""
:param domain_delimiter:
delimiter to put between domains (and modifications) in the IDT DNA sequence;
if specified then any internal modifications will be separated from the rest of the sequence
by this value.
:return:
IDT DNA sequence of this :any:`Domain`, or ``None`` if no DNA sequence has been assigned.
The difference between this and the field :data:`Domain.dna_sequence` is that this
Expand All @@ -2156,7 +2152,7 @@ def idt_dna_sequence(self, domain_delimiter: str = '') -> Optional[str]:
if strand_pos in strand.modifications_int: # if internal mod attached to base, replace base
mod = strand.modifications_int[strand_pos]
if mod.idt_text is not None:
idt_text_with_delim = domain_delimiter + mod.idt_text
idt_text_with_delim = mod.idt_text
if mod.allowed_bases is not None:
if base not in mod.allowed_bases:
msg = (f'internal modification {mod} can only replace one of these bases: '
Expand Down Expand Up @@ -4261,7 +4257,9 @@ def _ensure_domains_nonoverlapping(self) -> None:
def idt_dna_sequence(self, domain_delimiter: str = '') -> str:
"""
:param domain_delimiter:
string to put in between DNA sequences of each domain, and between modifications and DNA
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 IDT, with
:py:data:`Modification5Prime`'s,
:py:data:`Modification3Prime`'s,
Expand All @@ -4280,7 +4278,7 @@ def idt_dna_sequence(self, domain_delimiter: str = '') -> str:
ret_list.append(self.modification_5p.idt_text)

for substrand in self.domains:
ret_list.append(substrand.idt_dna_sequence(domain_delimiter=domain_delimiter))
ret_list.append(substrand.idt_dna_sequence())

if self.modification_3p is not None and self.modification_3p.idt_text is not None:
ret_list.append(self.modification_3p.idt_text)
Expand Down
4 changes: 2 additions & 2 deletions tests/scadnano_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,10 +1130,10 @@ def test_domain_delimiters_modifications(self) -> None:

strand = design.strands[0]
strand_idt_dna_sequence = strand.idt_dna_sequence(domain_delimiter=' ')
self.assertEqual('/5Biosg/ AAAAA CCCC /iBiodT/ GGGGG /3Cy3Sp/', strand_idt_dna_sequence)
self.assertEqual('/5Biosg/ AAAAA CCCC/iBiodT/ GGGGG /3Cy3Sp/', strand_idt_dna_sequence)

idt_content = design.to_idt_bulk_input_format(delimiter=';', domain_delimiter=' ')
self.assertEqual(f'{strand_name};/5Biosg/ AAAAA CCCC /iBiodT/ GGGGG /3Cy3Sp/;25nm;STD',
self.assertEqual(f'{strand_name};/5Biosg/ AAAAA CCCC/iBiodT/ GGGGG /3Cy3Sp/;25nm;STD',
idt_content)

def test_to_idt_bulk_input_format__row_major_5p(self) -> None:
Expand Down

0 comments on commit 96b5e0d

Please sign in to comment.