Skip to content

Commit

Permalink
older type hint
Browse files Browse the repository at this point in the history
  • Loading branch information
BjornFJohansson committed Mar 27, 2024
1 parent 3a30a53 commit a805598
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 122 deletions.
120 changes: 0 additions & 120 deletions src/pydna/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,123 +207,3 @@ def parse_assembly_xml(data):

doctest.testmod(verbose=True, optionflags=doctest.ELLIPSIS)
_os.environ["pydna_cached_funcs"] = cached

data = """\
<assembly topology="circular">
<amplicon>
>f50 14-mer
CCCGTACAAAGGGA
>r50 12-mer
CTGATGCCGCGC
>a
CCCGTACAAAGGGAACATCCACACTTTGGTGAATCGAAGCGCGGCATCAG
</amplicon>
<amplicon>
>f49 19-mer
GATTTCCTTTTGGATACCT
>r49 16-mer
AAGTCTAAGGACCACG
>b
GATTTCCTTTTGGATACCTGAAACAAAGCCCATCGTGGTCCTTAGACTT
</amplicon>
<amplicon>
>f48 13-mer
TCCCTACACCGAC
>r48 16-mer
ATGAAGCTCGTCACAT
>c
TCCCTACACCGACGTACGATGCAACTGTGTGGATGTGACGAGCTTCAT
</amplicon>
</assembly>
"""

data = """\
<assembly topology="circular">
<amplicon>
>f50 14-mer
CCCGTACAAAGGGA
>r50 12-mer
CTGATGCCGCGC
>a
CCCGTACAAAGGGAACATCCACACTTTGGTGAATCGAAGCGCGGCATCAG
</amplicon>
<fragment>
>b
GATTTCCTTTTGGATACCTGAAACAAAGCCCATCGTGGTCCTTAGACTT
</fragment>
<amplicon>
>f48 13-mer
TCCCTACACCGAC
>r48 16-mer
ATGAAGCTCGTCACAT
>c
TCCCTACACCGACGTACGATGCAACTGTGTGGATGTGACGAGCTTCAT
</amplicon>
</assembly>
"""

example = parse_assembly_xml(data)

# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-
# """
# Created on Sat Apr 22 07:39:14 2023

# @author: bjorn
# """

# import xml.dom.minidom as minidom

# from lxml import etree

# ng = """\
# <element name="assembly" xmlns="http://relaxng.org/ns/structure/1.0">
# <zeroOrMore>
# <interleave>
# <element name="amplicon">
# <text/>
# </element>
# <element name="fragment">
# <text/>
# </element>
# </interleave>
# </zeroOrMore>
# </element>
# """

# from io import StringIO

# f = StringIO(ng)
# relaxng_doc = etree.parse(f)
# relaxng = etree.RelaxNG(relaxng_doc)

# xml = StringIO("""\
# <assembly topology="circular">
# <amplicon>1</amplicon>
# <fragment>2</fragment>
# <amplicon>3</amplicon>
# </assembly>
# """)

# doc = etree.parse(xml)
# relaxng.validate(doc)

# doc = minidom.parseString(xml) # or minidom.parse(filename)
# assert doc.documentElement.tagName == "assembly"
# root = doc.getElementsByTagName('assembly')[0] # or doc.documentElement
# items = [n for n in root.childNodes if n.nodeType == doc.ELEMENT_NODE]

# for item in items:
# print(item.childNodes[0].data)

# import xml.etree.ElementTree as ET
# xml = """\
# <assembly topology="circular">
# <amplicon>1</amplicon>
# <fragment>2</fragment>
# <amplicon>3</amplicon>
# </assembly>
# """
# root = ET.fromstring(xml)
# for child in root:
# print(child.tag, child.attrib, child.text)
6 changes: 4 additions & 2 deletions src/pydna/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@
def three_frame_orfs(
dna: str,
limit: int = 100,
startcodons: tuple[str, ...] = ("ATG",),
stopcodons: tuple[str, ...] = ("TAG", "TAA", "TGA"),
startcodons: tuple = ("ATG",),
stopcodons: tuple = ("TAG", "TAA", "TGA"),
# startcodons: tuple[str, ...] = ("ATG",),
# stopcodons: tuple[str, ...] = ("TAG", "TAA", "TGA"),
):
"""Overlapping orfs in three frames."""
# breakpoint()
Expand Down

0 comments on commit a805598

Please sign in to comment.