Skip to content

Commit

Permalink
Refactor DesignIP class to handle different types of designs
Browse files Browse the repository at this point in the history
  • Loading branch information
alsmith151 committed Apr 16, 2024
1 parent a87e523 commit 795d87c
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions seqnado/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,11 +717,19 @@ def from_design(
subset_column: Optional[str] = "scale_group",
subset_value: Optional[List[str]] = None,
):
df = (
design.to_dataframe()
.assign(sample_fullname=lambda df: df.sample_name + "_" + df.ip)
.set_index("sample_fullname")
)

if isinstance(design, Design):
df = (
design.to_dataframe()
.assign(sample_fullname=lambda df: df.sample_name)
.set_index("sample_fullname")
)
else:
df = (
design.to_dataframe()
.assign(sample_fullname=lambda df: df.sample_name + "_" + df.ip)
.set_index("sample_fullname")
)

if subset_value:
df = df.query(f"{subset_column} in {subset_value}")
Expand Down

0 comments on commit 795d87c

Please sign in to comment.