Skip to content

Commit

Permalink
peak calling design sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
CChahrour committed Apr 26, 2024
1 parent e231f83 commit 5ec9fa8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
18 changes: 11 additions & 7 deletions seqnado/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ def from_design(
subset_value: Optional[List[str]] = None,
include_controls: bool = False,
):

if isinstance(design, Design):
df = (
design.to_dataframe()
Expand All @@ -745,13 +745,11 @@ def from_design(
)
df = pd.concat([df_ip, df_control])


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

samples = df.index.tolist()


reference_sample = reference_sample or df.index[0]

return cls(
Expand Down Expand Up @@ -875,7 +873,9 @@ def model_post_init(self, __context: Any) -> None:
self.pileup_method = [self.pileup_method]

if self.include_unscaled and not self.scale_method:
self.scale_method = ["unscaled",]
self.scale_method = [
"unscaled",
]
elif self.include_unscaled and self.scale_method:
self.scale_method = ["unscaled", self.scale_method]
else:
Expand Down Expand Up @@ -941,6 +941,7 @@ def files(self) -> List[str]:

class HeatmapFiles(BaseModel):
assay: Literal["ChIP", "ATAC", "RNA", "SNP"]
make_heatmaps: bool = False

@property
def heatmap_files(self) -> List[str]:
Expand All @@ -952,7 +953,10 @@ def heatmap_files(self) -> List[str]:
@computed_field
@property
def files(self) -> List[str]:
return self.heatmap_files
if self.make_heatmaps:
return self.heatmap_files
else:
return []


class HubFiles(BaseModel):
Expand Down Expand Up @@ -1170,7 +1174,6 @@ def peaks(self) -> List[str]:
files = pcf_samples.files + pcf_merged.files
else:
files = pcf_samples.files

return files or []

@computed_field
Expand Down Expand Up @@ -1221,8 +1224,9 @@ def peaks(self):
ip_sample_names = [
s
for s in self.sample_names
if any([c not in s for c in self.control_names])
if not any([c in s for c in self.control_names])
]

pcf_samples = PeakCallingFiles(
assay=self.assay,
names=ip_sample_names,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ retries: 3


default-resources:
slurm_partition: "short"
slurm_partition: "gpu"
runtime: "1h"
mem: "3G"

Expand Down
2 changes: 1 addition & 1 deletion seqnado/workflow/rules/peak_call_chip.smk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def format_macs_options(wildcards, options):
options = check_options(options)

if not is_paired:
options = re.sub(r"-f BAMPE", "", options)
options = re.sub(r"-f BAMPE", "-f BAM", options)
if not options:
return ""
else:
Expand Down

0 comments on commit 5ec9fa8

Please sign in to comment.