Skip to content

Commit

Permalink
added better variant type search
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinDo committed Jul 22, 2024
1 parent 1dacb33 commit 69ef6be
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
17 changes: 12 additions & 5 deletions src/common/db_IO.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,13 +766,20 @@ def get_variants_page_merged(self, page, page_size, sort_by, include_hidden, use
new_constraints = functions.enbrace(new_constraints)
postfix = self.add_constraints_to_command(postfix, new_constraints)
if variant_types is not None and len(variant_types) > 0:
new_constraints = []
for variant_type in variant_types:
if 'small' in variant_type:
actual_information += ('small', )
if 'insert' in variant_type:
new_constraints.append("(LENGTH(ref) = 1 AND LENGTH(alt) > 1 AND variant_type = 'small')")
elif 'delet' in variant_type:
new_constraints.append("(LENGTH(ref) > 1 AND LENGTH(alt) = 1 AND variant_type = 'small')")
elif 'delins' in variant_type:
new_constraints.append("(LENGTH(ref) > 1 AND LENGTH(alt) > 1 AND variant_type = 'small')")
elif 'small' in variant_type:
new_constraints.append("(LENGTH(ref) = 1 AND LENGTH(alt) = 1 AND variant_type = 'small')")
elif 'struct' in variant_type:
actual_information += ('sv',)
placeholders = self.get_placeholders(len(variant_types))
postfix = self.add_constraints_to_command(postfix, "variant_type IN " + placeholders)
new_constraints.append("(variant_type = 'sv')")
new_constraints = ' OR '.join(new_constraints)
postfix = self.add_constraints_to_command(postfix, new_constraints)
if cdna_ranges is not None and len(cdna_ranges) > 0:
new_constraints = []
for cdna_range in cdna_ranges:
Expand Down
1 change: 1 addition & 0 deletions src/frontend_celery/webapp/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ <h4>Changelog</h4>
<ul>
<li>Added retry import button for single failed HerediCaRe VIDs</li>
<li>Improved HerediCaRe VID information page</li>
<li>Added more fine grained variant type search: added insertion, deletion and delins. Small variants are now single nucleotide variants.</li>
</ul>
Bugfixes:
<ul>
Expand Down
2 changes: 1 addition & 1 deletion src/frontend_celery/webapp/utils/search_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def get_static_search_information(user_id, conn: Connection):
allowed_user_classes = functions.order_classes(conn.get_enumtypes('user_classification', 'classification'))
allowed_consensus_classes = functions.order_classes(conn.get_enumtypes('consensus_classification', 'classification'))
allowed_automatic_classes = functions.order_classes(conn.get_enumtypes('automatic_classification', 'classification_splicing'))
allowed_variant_types = ['small_variants', 'structural_variant']
allowed_variant_types = ['small_variants', 'insertions', 'deletions', 'delins', 'structural_variant']
annotation_types = conn.get_annotation_types(exclude_groups = ['ID'])
annotation_types = preprocess_annotation_types_for_search(annotation_types)
lists = conn.get_lists_for_user(user_id)
Expand Down

0 comments on commit 69ef6be

Please sign in to comment.