Skip to content

Commit

Permalink
fix: filter config
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Schubach committed Jan 9, 2023
1 parent 6b5efa1 commit 38ee37e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
44 changes: 42 additions & 2 deletions workflow/rules/common.smk
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,24 @@ def getOutputProjectConditionReplicateType_helper(file, skip={}):
return output


def getOutputProjectConditionConfigType_helper(file):
"""
Inserts {project}, {condition} and {type} from config into given file.
"""
output = []
projects = getProjects()
for project in projects:
conditions = getConditions(project)
for condition in conditions:
output += expand(
file,
project=project,
condition=condition,
config=getConfigs(project),
type=["DNA", "RNA"],
)
return output

def getOutputProjectConditionType_helper(file):
"""
Inserts {project}, {condition} and {type} from config into given file.
Expand All @@ -260,6 +278,27 @@ def getOutputProjectConditionType_helper(file):
)
return output

def getOutputProjectConditionAssignmentConfigType_helper(file):
"""
Inserts {project}, {condition}, {assignment} and {config} (from configs of project) from config into given file.
"""
output = []
projects = getProjects()
for project in projects:
try:
conditions = getConditions(project)
for condition in conditions:
output += expand(
file,
project=project,
condition=condition,
assignment=getProjectAssignments(project),
config=getConfigs(project),
type=["DNA", "RNA"],
)
except MissingAssignmentInConfigException:
continue
return output

def getOutputProjectConditionAssignmentConfig_helper(file):
"""
Expand Down Expand Up @@ -464,10 +503,11 @@ def counts_getFilterConfig(project, conf, dna_or_rna, command):
value = config["experiments"][project]["configs"][conf]["filter"][dna_or_rna][
command
]
filterMap={"min_counts": "minCounts"}
if isinstance(value, int):
return "--%s %d" % (command, value)
return "--%s %d" % (filterMap.get(command, command), value)
else:
return "--%s %f" % (command, value)
return "--%s %f" % (filterMap.get(command, command), value)


def counts_getSamplingConfig(project, conf, dna_or_rna, command):
Expand Down
6 changes: 6 additions & 0 deletions workflow/schemas/config.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ properties:
additionalProperties: false
required:
- min_counts
default:
bc_threshold: 10
DNA:
min_counts: 1
RNA:
min_counts: 1
required:
- bc_threshold
- DNA
Expand Down

0 comments on commit 38ee37e

Please sign in to comment.