From e7365d6a7e843d532de24577b54adb4350daf1d9 Mon Sep 17 00:00:00 2001 From: zaynab butt Date: Wed, 24 Jan 2024 10:54:07 +0000 Subject: [PATCH] make seqsubset optional argument --- src/npg_irods/illumina.py | 2 +- src/npg_irods/metadata/lims.py | 17 ++++++++--------- src/npg_irods/ont.py | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/npg_irods/illumina.py b/src/npg_irods/illumina.py index 4cf1a59..1f42adc 100644 --- a/src/npg_irods/illumina.py +++ b/src/npg_irods/illumina.py @@ -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)) diff --git a/src/npg_irods/metadata/lims.py b/src/npg_irods/metadata/lims.py index f8a67d2..9961ca8 100644 --- a/src/npg_irods/metadata/lims.py +++ b/src/npg_irods/metadata/lims.py @@ -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, ) @@ -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. @@ -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. @@ -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)] diff --git a/src/npg_irods/ont.py b/src/npg_irods/ont.py index bbe8895..3ebfb82 100644 --- a/src/npg_irods/ont.py +++ b/src/npg_irods/ont.py @@ -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