Skip to content

Commit

Permalink
86 wrong attribute type in msa (#87)
Browse files Browse the repository at this point in the history
* API update

* added type annotation for MSA

* bump version

* API update

* removed api generation

---------

Co-authored-by: sdRDM Bot <[email protected]>
  • Loading branch information
haeussma and sdRDM Bot authored Jun 21, 2024
1 parent 86069d9 commit 429557e
Show file tree
Hide file tree
Showing 18 changed files with 37 additions and 36 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/generate_api.yaml

This file was deleted.

27 changes: 21 additions & 6 deletions pyeed/align/msa.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
from typing import List

from Bio.Align import MultipleSeqAlignment
from pydantic import BaseModel, Field
from rich.console import Console
from rich.status import Status

from pyeed.core.alignmentresult import AlignmentResult
from pyeed.core.proteinrecord import ProteinRecord
from pyeed.core.sequence import Sequence
from pyeed.tools.clustalo import ClustalOmega


class MSA(BaseModel):
sequences: List[Sequence] = Field(
sequences: list[Sequence | ProteinRecord] = Field(
...,
description="List of sequences to be aligned.",
min_length=2,
Expand Down Expand Up @@ -47,14 +46,25 @@ def _map_alignment(self, alignment: MultipleSeqAlignment) -> AlignmentResult:
"""

result = AlignmentResult()
[result.add_to_sequences(id=seq.id, sequence=seq.sequence, sequence_id=seq.id) for seq in self.sequences]
[result.add_to_aligned_sequences(id=seq.id, sequence=str(seq.seq), sequence_id=seq.id) for seq in alignment]
[
result.add_to_sequences(
id=seq.id, sequence=seq.sequence, sequence_id=seq.id
)
for seq in self.sequences
]
[
result.add_to_aligned_sequences(
id=seq.id, sequence=str(seq.seq), sequence_id=seq.id
)
for seq in alignment
]

return result


if __name__ == "__main__":
from pyeed.core.proteinrecord import ProteinRecord
from pyeed.core.sequence import Sequence

protein1 = ProteinRecord(
id="seq1",
Expand All @@ -68,7 +78,12 @@ def _map_alignment(self, alignment: MultipleSeqAlignment) -> AlignmentResult:
id="seq3",
sequence="MTHKILLLTLLFTLLFSSCYSRG",
)
sequences = [protein1, protein2, protein3]
protein4 = Sequence(
id="seq4",
sequence="AAAAAAA",
)

sequences = [protein1, protein2, protein3, protein4]

msa = MSA(sequences=sequences)
alignment = msa.clustalo()
Expand Down
2 changes: 1 addition & 1 deletion pyeed/core/abstractannotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class AbstractAnnotation(

_repo: Optional[str] = PrivateAttr(default="https://github.com/PyEED/pyeed")
_commit: Optional[str] = PrivateAttr(
default="ad73396d3a347dd8d413a3cbe77883edb2777380"
default="72d2203f2e3ce4b319b29fa0d2f146b5eead7b00"
)

_raw_xml_data: Dict = PrivateAttr(default_factory=dict)
Expand Down
2 changes: 1 addition & 1 deletion pyeed/core/alignmentresult.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class AlignmentResult(

_repo: Optional[str] = PrivateAttr(default="https://github.com/PyEED/pyeed")
_commit: Optional[str] = PrivateAttr(
default="ad73396d3a347dd8d413a3cbe77883edb2777380"
default="72d2203f2e3ce4b319b29fa0d2f146b5eead7b00"
)

_raw_xml_data: Dict = PrivateAttr(default_factory=dict)
Expand Down
2 changes: 1 addition & 1 deletion pyeed/core/blastdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class BlastData(

_repo: Optional[str] = PrivateAttr(default="https://github.com/PyEED/pyeed")
_commit: Optional[str] = PrivateAttr(
default="ad73396d3a347dd8d413a3cbe77883edb2777380"
default="72d2203f2e3ce4b319b29fa0d2f146b5eead7b00"
)

_raw_xml_data: Dict = PrivateAttr(default_factory=dict)
Expand Down
2 changes: 1 addition & 1 deletion pyeed/core/clustalomegaresult.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ClustalOmegaResult(

_repo: Optional[str] = PrivateAttr(default="https://github.com/PyEED/pyeed")
_commit: Optional[str] = PrivateAttr(
default="ad73396d3a347dd8d413a3cbe77883edb2777380"
default="72d2203f2e3ce4b319b29fa0d2f146b5eead7b00"
)

_raw_xml_data: Dict = PrivateAttr(default_factory=dict)
Expand Down
2 changes: 1 addition & 1 deletion pyeed/core/dnarecord.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class DNARecord(

_repo: Optional[str] = PrivateAttr(default="https://github.com/PyEED/pyeed")
_commit: Optional[str] = PrivateAttr(
default="ad73396d3a347dd8d413a3cbe77883edb2777380"
default="72d2203f2e3ce4b319b29fa0d2f146b5eead7b00"
)

_raw_xml_data: Dict = PrivateAttr(default_factory=dict)
Expand Down
2 changes: 1 addition & 1 deletion pyeed/core/numberedsequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class NumberedSequence(

_repo: Optional[str] = PrivateAttr(default="https://github.com/PyEED/pyeed")
_commit: Optional[str] = PrivateAttr(
default="ad73396d3a347dd8d413a3cbe77883edb2777380"
default="72d2203f2e3ce4b319b29fa0d2f146b5eead7b00"
)

_raw_xml_data: Dict = PrivateAttr(default_factory=dict)
Expand Down
2 changes: 1 addition & 1 deletion pyeed/core/organism.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class Organism(

_repo: Optional[str] = PrivateAttr(default="https://github.com/PyEED/pyeed")
_commit: Optional[str] = PrivateAttr(
default="ad73396d3a347dd8d413a3cbe77883edb2777380"
default="72d2203f2e3ce4b319b29fa0d2f146b5eead7b00"
)

_raw_xml_data: Dict = PrivateAttr(default_factory=dict)
Expand Down
2 changes: 1 addition & 1 deletion pyeed/core/pairwisealignmentresult.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class PairwiseAlignmentResult(

_repo: Optional[str] = PrivateAttr(default="https://github.com/PyEED/pyeed")
_commit: Optional[str] = PrivateAttr(
default="ad73396d3a347dd8d413a3cbe77883edb2777380"
default="72d2203f2e3ce4b319b29fa0d2f146b5eead7b00"
)

_raw_xml_data: Dict = PrivateAttr(default_factory=dict)
Expand Down
2 changes: 1 addition & 1 deletion pyeed/core/proteinrecord.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class ProteinRecord(

_repo: Optional[str] = PrivateAttr(default="https://github.com/PyEED/pyeed")
_commit: Optional[str] = PrivateAttr(
default="ad73396d3a347dd8d413a3cbe77883edb2777380"
default="72d2203f2e3ce4b319b29fa0d2f146b5eead7b00"
)

_raw_xml_data: Dict = PrivateAttr(default_factory=dict)
Expand Down
2 changes: 1 addition & 1 deletion pyeed/core/region.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Region(

_repo: Optional[str] = PrivateAttr(default="https://github.com/PyEED/pyeed")
_commit: Optional[str] = PrivateAttr(
default="ad73396d3a347dd8d413a3cbe77883edb2777380"
default="72d2203f2e3ce4b319b29fa0d2f146b5eead7b00"
)

_raw_xml_data: Dict = PrivateAttr(default_factory=dict)
Expand Down
2 changes: 1 addition & 1 deletion pyeed/core/regionset.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class RegionSet(

_repo: Optional[str] = PrivateAttr(default="https://github.com/PyEED/pyeed")
_commit: Optional[str] = PrivateAttr(
default="ad73396d3a347dd8d413a3cbe77883edb2777380"
default="72d2203f2e3ce4b319b29fa0d2f146b5eead7b00"
)

_object_terms: Set[str] = PrivateAttr(
Expand Down
2 changes: 1 addition & 1 deletion pyeed/core/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Sequence(

_repo: Optional[str] = PrivateAttr(default="https://github.com/PyEED/pyeed")
_commit: Optional[str] = PrivateAttr(
default="ad73396d3a347dd8d413a3cbe77883edb2777380"
default="72d2203f2e3ce4b319b29fa0d2f146b5eead7b00"
)

_raw_xml_data: Dict = PrivateAttr(default_factory=dict)
Expand Down
2 changes: 1 addition & 1 deletion pyeed/core/sequencerecord.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class SequenceRecord(

_repo: Optional[str] = PrivateAttr(default="https://github.com/PyEED/pyeed")
_commit: Optional[str] = PrivateAttr(
default="ad73396d3a347dd8d413a3cbe77883edb2777380"
default="72d2203f2e3ce4b319b29fa0d2f146b5eead7b00"
)

_raw_xml_data: Dict = PrivateAttr(default_factory=dict)
Expand Down
2 changes: 1 addition & 1 deletion pyeed/core/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Site(

_repo: Optional[str] = PrivateAttr(default="https://github.com/PyEED/pyeed")
_commit: Optional[str] = PrivateAttr(
default="ad73396d3a347dd8d413a3cbe77883edb2777380"
default="72d2203f2e3ce4b319b29fa0d2f146b5eead7b00"
)

_raw_xml_data: Dict = PrivateAttr(default_factory=dict)
Expand Down
2 changes: 1 addition & 1 deletion pyeed/core/standardnumbering.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class StandardNumbering(

_repo: Optional[str] = PrivateAttr(default="https://github.com/PyEED/pyeed")
_commit: Optional[str] = PrivateAttr(
default="ad73396d3a347dd8d413a3cbe77883edb2777380"
default="72d2203f2e3ce4b319b29fa0d2f146b5eead7b00"
)

_raw_xml_data: Dict = PrivateAttr(default_factory=dict)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pyeed"
version = "0.3.5"
version = "0.3.6"
description = "Toolkit to create, annotate, and analyze sequence data"
authors = ["haeussma <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 429557e

Please sign in to comment.