Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copies Target proposals to new (RHS) Compounds #629

Merged
merged 6 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/build-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,11 @@ jobs:
with:
context: .
tags: ${{ steps.vars.outputs.BE_NAMESPACE }}/fragalysis-backend:${{ env.GITHUB_REF_SLUG }}
- name: Test
run: >
docker-compose -f docker-compose.test.yml up
--build
--exit-code-from tests
--abort-on-container-exit
- name: Test (docker compose)
uses: hoverkraft-tech/compose-action@v2.0.1
with:
compose-file: ./docker-compose.test.yml
up-flags: --build --exit-code-from tests --abort-on-container-exit
env:
BE_NAMESPACE: ${{ steps.vars.outputs.BE_NAMESPACE }}
BE_IMAGE_TAG: ${{ env.GITHUB_REF_SLUG }}
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/build-production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,11 @@ jobs:
tags: |
${{ steps.vars.outputs.BE_NAMESPACE }}/fragalysis-backend:${{ steps.vars.outputs.tag }}
${{ steps.vars.outputs.BE_NAMESPACE }}/fragalysis-backend:stable
- name: Test
run: >
docker-compose -f docker-compose.test.yml up
--build
--exit-code-from tests
--abort-on-container-exit
- name: Test (docker compose)
uses: hoverkraft-tech/compose-action@v2.0.1
with:
compose-file: ./docker-compose.test.yml
up-flags: --build --exit-code-from tests --abort-on-container-exit
env:
BE_NAMESPACE: ${{ steps.vars.outputs.BE_NAMESPACE }}
BE_IMAGE_TAG: ${{ steps.vars.outputs.tag }}
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/build-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,11 @@ jobs:
with:
context: .
tags: ${{ steps.vars.outputs.BE_NAMESPACE }}/fragalysis-backend:${{ steps.vars.outputs.tag }}
- name: Test
run: >
docker-compose -f docker-compose.test.yml up
--build
--exit-code-from tests
--abort-on-container-exit
- name: Test (docker compose)
uses: hoverkraft-tech/compose-action@v2.0.1
with:
compose-file: ./docker-compose.test.yml
up-flags: --build --exit-code-from tests --abort-on-container-exit
env:
BE_NAMESPACE: ${{ steps.vars.outputs.BE_NAMESPACE }}
BE_IMAGE_TAG: ${{ steps.vars.outputs.tag }}
Expand Down
13 changes: 13 additions & 0 deletions viewer/cset_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,19 @@ def create_mol(self, inchi, target, name=None) -> Compound:
current_identifier=name,
)
cpd.save()
# This is a new compound.
# We must now set relationships to the Proposal that it applies to.
# We do this by copying the relationships from the Target.
num_target_proposals = len(target.project_id.all())
assert num_target_proposals > 0
if num_target_proposals > 1:
logger.warning(
'Compound Target %s has more than one Proposal (%d)',
target.title,
num_target_proposals,
)
for project in target.project_set.all():
cpd.project_id.add(project)
except MultipleObjectsReturned as exc:
# NB! when processing new uploads, Compound is always
# fetched by inchi_key, so this shouldn't ever create
Expand Down