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

Feature/905 #913

Merged
merged 2 commits into from
Sep 29, 2023
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
36 changes: 21 additions & 15 deletions seqauto/grids/sequencing_data_grids.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from library.jqgrid.jqgrid_user_row_config import JqGridUserRowConfig
from seqauto.models import SequencingRun, BamFile, UnalignedReads, VCFFile, QC, Experiment, EnrichmentKit
from snpdb.models import UserGridConfig, DataState
from snpdb.views.datatable_view import DatatableConfig, RichColumn
from snpdb.views.datatable_view import DatatableConfig, RichColumn, SortOrder


class ExperimentColumns(DatatableConfig[Experiment]):
Expand Down Expand Up @@ -184,18 +184,24 @@ def __init__(self, user, **kwargs):
'sortorder': 'desc'})


class EnrichmentKitListGrid(JqGridUserRowConfig):
model = EnrichmentKit
caption = 'EnrichmentKit'
fields = ["id", "name", "version", "enrichment_kit_type", "obsolete"]
colmodel_overrides = {'id': {'width': 20, 'formatter': 'viewEnrichmentKit'}}
# class EnrichmentKitListGrid(JqGridUserRowConfig):
class EnrichmentKitColumns(DatatableConfig[EnrichmentKit]):
def __init__(self, request, **kwargs):
super().__init__(request)
self.user = request.user

# manufacturer__name causes join cast error?
# ProgrammingError: operator does not exist: text = integer
# LINE 1: ...urer" ON ("snpdb_enrichmentkit"."manufacturer_id" = "snpdb_m...
def __init__(self, user, **kwargs):
super().__init__(user)
queryset = self.model.objects.all()
self.queryset = queryset.values(*self.get_field_names())
self.extra_config.update({'sortname': 'id',
'sortorder': 'desc'})
self.rich_columns = [
RichColumn(key="id", orderable=True, default_sort=SortOrder.DESC),
RichColumn(key="name", label="Name", orderable=True,
renderer=self.view_primary_key,
client_renderer='TableFormat.linkUrl'),
RichColumn(key="version", label="Version", orderable=True),
RichColumn(key="enrichment_kit_type",
label="Enrichment Kit Type", orderable=True),
RichColumn(key="obsolete",
label="Obsolete", orderable=True)
]

def get_initial_queryset(self) -> QuerySet[EnrichmentKit]:
queryset = EnrichmentKit.objects.all()
return queryset # not sure if this is the most appropriate translation
5 changes: 1 addition & 4 deletions seqauto/templates/seqauto/enrichment_kits_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
<div class="container">
<h3>Enrichment Kits</h3>

{% load jqgrid_tags %}
<table id="enrichment-kit-datatable" data-datatable-url="{% url 'enrichment_kit_datatable' %}" class="sticky-header responsive"></table>

<div class='grid-container'>
{% jqgrid 'enrichment_kit_list_grid' 'EnrichmentKits' False None 'seqauto/grids/enrichment_kits_list_grid.html' delete=False %}
</div>
</div>
{% endblock %}
4 changes: 2 additions & 2 deletions seqauto/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
GoldCoverageSummaryGrid, SequencingSamplesGrid, SequencingSamplesHistoricalGrid
from seqauto.grids.sequencing_data_grids import SequencingRunListGrid, \
UnalignedReadsListGrid, BamFileListGrid, VCFFileListGrid, QCFileListGrid, \
EnrichmentKitListGrid, ExperimentColumns
EnrichmentKitColumns, ExperimentColumns
from seqauto.grids.sequencing_software_versions_grids import LibraryGrid, SequencerGrid, \
AssayGrid, AlignerGrid, VariantCallerGrid, VariantCallingPipelineGrid
from seqauto.views import SequencerUpdate, LibraryUpdate, AssayUpdate, VariantCallerUpdate, \
Expand Down Expand Up @@ -72,7 +72,7 @@
perm_path('bam_file/grid/<slug:op>/', JQGridView.as_view(grid=BamFileListGrid), name='bam_file_grid'),
perm_path('vcf_file/grid/<slug:op>/', JQGridView.as_view(grid=VCFFileListGrid), name='vcf_file_grid'),
perm_path('qc/grid/<slug:op>/', JQGridView.as_view(grid=QCFileListGrid), name='qc_grid'),
perm_path('enrichment_kit/grid/<slug:op>/', JQGridView.as_view(grid=EnrichmentKitListGrid), name='enrichment_kit_list_grid'),
perm_path('enrichment_kit/grid/', DatabaseTableView.as_view(column_class=EnrichmentKitColumns), name='enrichment_kit_datatable'),
perm_path('enrichment_kit/gene/grid/<int:enrichment_kit_id>/<genome_build_name>/<gene_symbol>/<slug:op>/', JQGridView.as_view(grid=EnrichmentKitGeneCoverageGrid), name='enrichment_kit_gene_coverage_grid'),
perm_path('gold_coverage_summary/grid/<pk>/<slug:op>/', JQGridView.as_view(grid=GoldCoverageSummaryGrid), name='gold_coverage_summary_grid'),
perm_path('sequencing_stats/sequencing_samples/grid/<slug:op>/', JQGridView.as_view(grid=SequencingSamplesGrid, csv_download=True), name='sequencing_samples_grid'),
Expand Down
Loading