Skip to content

Cohort creation does not validate that member SGs belong to the cohort's project #1287

Description

@joshuamschmidt

Summary

createCohortFromCriteria lets you create a cohort in project-test comprised of sequencing groups belonging to project (main). This results in broken cohorts, unusable because the sequencing groups and their associated assays etc are unusable within the scope of project-test. This is an easy error to make: pass a list of main/prod sg id's when creating a cohort in the dataset's -test project.

I would say this is unexpected behaviour.

what is expected

sequencing groups passed in sg_ids_internal are checked against the destination project for membership.
trying to create a cohort in a project containing one ore more sequencing groups not belonging to that project should result in an error.

what is observed

cohort creation proceeds without error, but with broken scope (note project is {dataset}-test, but cram path is gs://cpg-{dataset}-main/exome/cram/CPGXXXXX.cram:

"data": {
    "cohorts": [
      {
        "name": "{dataset}-test-exome-twist-20260528-dragen",
        "project": {
          "dataset": "{dataset}",
          "name": "{dataset}-test"
        },
        "sequencingGroups": [
          {
            "id": "CPGXXXXX",
            "sample": {
              "project": {
                "name": "{dataset}"
              }
            },
            "analyses": [
              {
                "outputs": {
                  "id": XXXXX,
                  "parent_id": null,
                  "path": "gs://cpg-{dataset}-main/exome/cram/CPGXXXXX.cram",
                  "basename": "CPGXXXXX.cram",
                  "dirname": "gs://cpg-{dataset}-main/exome/cram",
                  "nameroot": "CPGXXXXX",
                  "nameext": ".cram",
                  "file_checksum": "pziOag==",
                  "size": 921791013,
                  "meta": null,
                  "valid": true,
                  "secondary_files": {}
                }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions