File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -484,17 +484,29 @@ def __iter__(self):
484484 )
485485 )
486486
487+ def __getitem__ (self , index : int ) -> str :
488+ """
489+ Allow indexing DseqParts instances.
490+ >>> from pydna.alphabet import get_parts
491+ >>> parts = get_parts("eeATCGuggCCGgg")
492+ >>> parts[0]
493+ 'ee'
494+ >>> parts[2]
495+ 'ATCGuggCCGgg'
496+ """
497+ return tuple (self )[index ]
498+
487499
488500def get_parts (datastring : str ) -> DseqParts :
489501 """
490- A namedtuple containing the parts of a dsDNA sequence.
502+ Returns a DseqParts instance containing the parts of a dsDNA sequence.
491503
492504 The datastring should contain a string with dscode symbols.
493505 A regex is used to capture the single stranded regions at the ends as
494506 well as the regiond in the middle.
495507
496508 The figure below numbers the regex capture groups and what they capture
497- as well as the namedtuple field name.
509+ as well as the DseqParts instance field name.
498510
499511 ::
500512
You can’t perform that action at this time.
0 commit comments