Skip to content

Commit

Permalink
fixinig predefined algorithms constant
Browse files Browse the repository at this point in the history
  • Loading branch information
marifergun committed Apr 10, 2024
1 parent 7ad55d9 commit b898d68
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cosapweb/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class VCFHeaders(Enum):
SAMPLE = "SAMPLE"

class ProjectTypeAlgorithms(Enum):
ProjectTypes.SOMATIC.value = {
SOMATIC = {
ProjectAlgorithmKeys.ALIGNER: [
"BWA2"
],
Expand All @@ -106,7 +106,7 @@ class ProjectTypeAlgorithms(Enum):
],
ProjectAlgorithmKeys.VARIANT_ANNOTATOR: []
}
ProjectTypes.GERMLINE.value = {
GERMLINE = {
ProjectAlgorithmKeys.ALIGNER: [
"BWA2"
],
Expand Down
14 changes: 14 additions & 0 deletions cosapweb/api/helpers/project_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,17 @@ def get_or_create_project_summary(project_id):
project_summary = ProjectSummary.objects.get_or_create(project=project)[0]

return project_summary

def remove_project_data_and_snvs(project_id):
"""
Removes project data and snvs.
"""

project = Project.objects.get(id=project_id)
project_snvs = ProjectSNVs.objects.get(project=project)
project_summary = ProjectSummary.objects.get(project=project)
project_snv_data = ProjectSNVData.objects.get(project=project)

project_snvs.delete()
project_summary.delete()
project_snv_data.delete()
5 changes: 4 additions & 1 deletion cosapweb/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

from ..common.utils import (convert_file_relative_path_to_absolute_path,
create_chonky_filemap)
from .helpers.project_helpers import get_project_dir
from .helpers.project_helpers import get_project_dir, remove_project_data_and_snvs
from .constants import ProjectStatus, ProjectTypeAlgorithms, ProjectTypes

USER = get_user_model()
Expand Down Expand Up @@ -258,6 +258,9 @@ def rerun_project(self, request, pk=None):
project.status = ProjectStatus.PENDING.value
project.save()

# Remove project data and snvs
remove_project_data_and_snvs(pk)

return HttpResponse(status=status.HTTP_200_OK)

@action(detail=True, methods=["post"])
Expand Down
2 changes: 2 additions & 0 deletions cosapweb/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,5 @@
# },
# },
# }

DATA_UPLOAD_MAX_NUMBER_FIELDS = 100000
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
db:
image: postgres
volumes:
- postgres-data:/var/lib/postgresql/data
- ./data/db:/var/lib/postgresql/data
environment:
- POSTGRES_NAME=${COSAP_POSTGRES_NAME}
- POSTGRES_USER=${COSAP_POSTGRES_USER}
Expand Down

0 comments on commit b898d68

Please sign in to comment.