Skip to content

Commit

Permalink
bugfixes on analysis-run dumper
Browse files Browse the repository at this point in the history
  • Loading branch information
SandyRogers committed Jan 5, 2024
1 parent d185d4e commit f36021e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
14 changes: 7 additions & 7 deletions emgapi/management/commands/ebi_search_analysis_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ def get_analysis_context(self, analysis: AnalysisJob):

try:
go_annotation: Optional[AnalysisJobGoTerm] = AnalysisJobGoTerm.objects.get(
pk=analysis.job_id
pk=str(analysis.job_id)
)
except AnalysisJobGoTerm.DoesNotExist:
logger.debug(f"Could not find go terms for {analysis.job_id}")
go_annotation = None

try:
ips_annotation: Optional[AnalysisJobInterproIdentifier] = AnalysisJobInterproIdentifier.objects.get(
pk=analysis.job_id
pk=str(analysis.job_id)
)
except AnalysisJobInterproIdentifier.DoesNotExist:
logger.debug(f"Could not find IPS terms for {analysis.job_id}")
Expand Down Expand Up @@ -203,10 +203,10 @@ def handle(self, *args, **options):
)
)

nowish = timezone.now() + timedelta(minutes=1)
# Small buffer into the future so that the indexing time remains ahead of auto-now updated times.
nowish = timezone.now() + timedelta(minutes=1)
# Small buffer into the future so that the indexing time remains ahead of auto-now updated times.

for analysis in analyses:
analysis.last_indexed = nowish
for analysis in page:
analysis.last_indexed = nowish

AnalysisJob.objects.bulk_update(analyses, fields=["last_indexed"])
AnalysisJob.objects.bulk_update(page, fields=["last_indexed"])
19 changes: 15 additions & 4 deletions emgapi/templates/ebi_search/analysis.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
<date type="sample_collection_date" value="{{ analysis.sample.collection_date|date:'Y-m-d' }}"/>
</dates>
<additional_fields>
<field name="experiment_type">assembly</field>
<field name="experiment_type">{{ analysis.experiment_type.experiment_type }}</field>
<field name="pipeline_version">{{ analysis.pipeline.release_version }}</field>
<field name="sample_name">{{ analysis.sample.sample_name | escape }}</field>
<field name="sample_description">{{ analysis.sample.sample_desc | escape }}</field>
<field name="project_name">{{ analysis.study.study_name | escape }}</field>
<field name="biome_name">{{ analysis.study.biome.biome_name | escape }}</field>

Expand Down Expand Up @@ -66,16 +67,26 @@
<ref dbkey="{{ analysis.study.accession }}" dbname="metagenomics_projects"/>
<ref dbkey="{{ analysis.study.project_id }}" dbname="ena_project"/>

{# biosample #}
{% if analysis.sample.primary_accession %}
<ref dbkey="{{ analysis.sample.primary_accession }}" dbname="biosamples"/>
{% endif %}

{# INSDC sample like DRSxx, ERSxx, SRSxx #}
{% if analysis.sample.accession and analysis.sample.accession|slice:"1:3" == "RS"%}
<ref dbkey="{{ analysis.sample.accession }}" dbname="sra-sample"/>
{% endif %}

{# Assembly analysis #}
{% if analysis.assembly and analysis.assembly.accession|slice:":4" == "GCA_" %}
<ref dbkey="{{ analysis.assembly.legacy_accession }}" dbname="ena_wgs_sequence_set"/>
<ref dbkey="{{ analysis.assembly.accession }}" dbname="assembly"/>
{% if analysis.assembly %}
<ref dbkey="{{ analysis.assembly.accession }}" dbname="analysis"/>
{% endif %}

{# WGS/Amplicon analysis #}
{% if analysis.run %}
<ref dbkey="{{ analysis.run.accession }}" dbname="ena_run"/>
{% endif %}

{% for go in analysis_go_entries %}
<ref dbkey="{{ go.accession }}" dbname="go"/>
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion emgcli/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__: str = "2.4.40"
__version__: str = "2.4.41"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ max-line-length = 119
"""

[tool.bumpversion]
current_version = "2.4.40"
current_version = "2.4.41"

[[tool.bumpversion.files]]
filename = "emgcli/__init__.py"

0 comments on commit f36021e

Please sign in to comment.