Skip to content

Commit

Permalink
make seqsubset optional argument
Browse files Browse the repository at this point in the history
  • Loading branch information
zb32 committed Jan 24, 2024
1 parent 0179b83 commit e7365d6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/npg_irods/illumina.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def empty_acl(*args):
for fc in flowcells:
secondary_metadata.extend(sample_fn(fc.sample))
secondary_metadata.extend(study_fn(fc.study))
acl.extend(acl_fn(c.subset, fc.sample, fc.study, zone=zone))
acl.extend(acl_fn(fc.sample, fc.study, c.subset, zone=zone))

# Remove duplicates
secondary_metadata = sorted(set(secondary_metadata))
Expand Down
17 changes: 8 additions & 9 deletions src/npg_irods/metadata/lims.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

from npg_irods.db.mlwh import Sample, Study
from npg_irods.metadata.common import (
SeqConcept,
SeqSubset,
ensure_avus_present,
avu_if_value,
)
Expand Down Expand Up @@ -169,7 +169,7 @@ def make_reduced_study_metadata(study: Study) -> list[AVU]:


def make_sample_acl(
seq: SeqConcept, sample: Sample, study: Study, zone=None
sample: Sample, study: Study, subset: SeqSubset=None, zone=None
) -> list[AC]:
"""Returns an ACL for a given Sample in a Study.
Expand All @@ -186,7 +186,7 @@ def make_sample_acl(
Note that this function does not check that the sample is in the study.
Args:
seq: Platform-independent concepts
subset: Subset of sequence reads
sample: A sample, which will be used to confirm consent, which modifies the
ACL.
study: A study, which will provide permissions for the ACL.
Expand All @@ -195,15 +195,14 @@ def make_sample_acl(
Returns:
An ACL
"""
if seq is not None and seq.value == "human":
if subset is not None and subset is subset.XAHUMAN:
return []

if subset is not None and subset is subset.HUMAN:
irods_group = f"{STUDY_IDENTIFIER_PREFIX}{study.id_study_lims}_human"
else:
irods_group = f"{STUDY_IDENTIFIER_PREFIX}{study.id_study_lims}"
perm = (
Permission.NULL
if sample.consent_withdrawn or (seq is not None and seq.value == "xahuman")
else Permission.READ
)
perm = Permission.NULL if sample.consent_withdrawn else Permission.READ

return [AC(irods_group, perm, zone=zone)]

Expand Down
2 changes: 1 addition & 1 deletion src/npg_irods/ont.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ def _do_secondary_metadata_and_perms_update(

acl = []
for fc in flowcells:
acl.extend(make_sample_acl(None, fc.sample, fc.study, zone=zone))
acl.extend(make_sample_acl(fc.sample, fc.study, zone=zone))

recurse = item.rods_type == Collection
cons_update = perm_update = False
Expand Down

0 comments on commit e7365d6

Please sign in to comment.