Skip to content

Commit

Permalink
added model of output metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
khoroshevskyi committed Feb 15, 2024
1 parent 835b74e commit 136fccb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions bedboss/bedmaker/bedmaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def make(self) -> dict:
return {
"bed_type": bed_type,
"file_type": file_type,
"genome": self.genome,
}

def make_bed(self) -> None:
Expand Down
3 changes: 3 additions & 0 deletions bedboss/bedstat/bedstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
)
from bedboss.utils import download_file, convert_unit
from bedboss.exceptions import OpenSignalMatrixException
from bedboss.models import BedMetadata


_LOGGER = logging.getLogger("bedboss")
Expand Down Expand Up @@ -56,6 +57,8 @@ def load_to_pephub(
sample_data = {}
sample_data.update({"sample_name": bed_digest, "genome": genome})

metadata = BedMetadata(**metadata).model_dump()

for key, value in metadata.items():
# TODO: Confirm this key is in the schema
# Then update sample_data
Expand Down
29 changes: 29 additions & 0 deletions bedboss/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from pydantic import BaseModel, ConfigDict, Field

from enum import Enum


class BED_TYPE(str, Enum):
BED = "bed"
NARROWPEAK = "narrowpeak"
BROADPEAK = "broadpeak"


class BedMetadata(BaseModel):
sample_name: str
genome: str
file_type: BED_TYPE = BED_TYPE.BED
bed_type: str = Field(
default="bed3", pattern="^bed(?:[3-9]|1[0-2])(?:\+|$)[0-9]?+$"
)
description: str = None
organism: str = None
cell_type: str = None
tissue: str = None
antibody: str = None
sample_library_strategy: str = None

model_config = ConfigDict(
populate_by_name=True,
extra="allow",
)

0 comments on commit 136fccb

Please sign in to comment.