-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from EBI-Metagenomics/feature/cazy-annotations
CAZyme annotations on MAGs
- Loading branch information
Showing
22 changed files
with
323 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
[run] | ||
omit = | ||
*tests* | ||
*migrations* | ||
*/tests/* | ||
*/migrations/* | ||
*settings* | ||
*asgi.py | ||
*wsgi.py | ||
*wsgi.py | ||
*generate_dev_data.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
from django import forms | ||
from django.forms.widgets import SelectMultiple | ||
from django.utils.html import format_html | ||
from django.utils.encoding import force_str | ||
|
||
|
||
class CazyCheckboxesWidget(SelectMultiple): | ||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
self.choices = ( | ||
[ | ||
("GH", "Glycoside Hydrolase"), | ||
("CB", "Carbohydrate-Binding"), | ||
("PL", "Polysaccharide Lyases"), | ||
("CE", "Carbohydrate Esterases"), | ||
("AA", "Auxiliary Activities"), | ||
("GT", "GlycosylTransferases"), | ||
], | ||
) | ||
|
||
def render(self, name, value, attrs=None, renderer=None): | ||
output = [] | ||
if not isinstance(value, list): | ||
value = [value] | ||
for option_value, option_label in self.choices: | ||
final_attrs = self.build_attrs(self.attrs, attrs) | ||
final_attrs["type"] = "checkbox" | ||
final_attrs["name"] = name | ||
final_attrs["value"] = option_value | ||
final_attrs["id"] = "id_%s_%s" % (name, option_value) | ||
|
||
if value and force_str(option_value) in value: | ||
final_attrs["checked"] = "checked" | ||
else: | ||
final_attrs.pop("checked", None) | ||
|
||
output.append( | ||
format_html( | ||
'<div class="hf-checkbox">' | ||
'<input{} /> <label for="{}">{}</label>' | ||
"</div>", | ||
format_html( | ||
"".join( | ||
f' {key}="{value}"' for key, value in final_attrs.items() | ||
) | ||
), | ||
final_attrs["id"], | ||
option_label, | ||
) | ||
) | ||
|
||
return format_html("".join(output)) | ||
|
||
|
||
class CazyAnnotationsFilterForm(forms.Form): | ||
field_order = [ | ||
"accession__icontains", | ||
"cluster_representative__icontains", | ||
"taxonomy__icontains", | ||
"cazy_annotations", | ||
] | ||
cazy_annotations = forms.MultipleChoiceField( | ||
choices=[ | ||
("GH", "Glycoside Hydrolase"), | ||
("CB", "Carbohydrate-Binding"), | ||
("PL", "Polysaccharide Lyases"), | ||
("CE", "Carbohydrate Esterases"), | ||
("AA", "Auxiliary Activities"), | ||
("GT", "GlycosylTransferases"), | ||
], | ||
widget=CazyCheckboxesWidget, | ||
required=False, | ||
label="CAZy Annotations present", | ||
help_text="Annotated on species rep.", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.2 on 2024-07-02 16:01 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("holofood", "0037_genomesamplecontainment"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="genome", | ||
name="annotations", | ||
field=models.JSONField(blank=True, default=dict), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Genome CAZy_category Counts | ||
0 MGYG000290000 GH 6 | ||
1 MGYG000290000 PL 5 | ||
2 MGYG000290000 CE 4 | ||
3 MGYG000290000 AA 3 | ||
4 MGYG000290000 CB 2 | ||
5 MGYG000290000 GT 1 | ||
6 MGYG000290000 CL 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
jupyterlab==3.4.8 | ||
pandas==1.5.1 | ||
matplotlib==3.6.1 | ||
jupyterlab==4.2.3 | ||
pandas==2.2.2 | ||
matplotlib==3.9.1 |
Oops, something went wrong.