Skip to content

Commit

Permalink
feat(templates): added support for GAF 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
valearna committed Dec 11, 2020
1 parent 79760e1 commit 7db8e06
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions genedescriptions/precanned_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,29 @@ def set_gene_ontology_module(dm: DataManager, conf_parser: GenedescConfigParser,
aspect='F', qualifier='contributes_to', merge_groups_with_same_prefix=True,
keep_only_best_group=True)
if contributes_to_module_sentences.contains_sentences():
func_module_sentences_noq = go_sent_generator_exp.get_module_sentences(
aspect='F', qualifier='', merge_groups_with_same_prefix=True, keep_only_best_group=True)
gene_desc.set_or_extend_module_description_and_final_stats(module_sentences=func_module_sentences_noq,
module=Module.GO_FUNCTION)
func_module_sentences = go_sent_generator_exp.get_module_sentences(
aspect='F', qualifier='enables', merge_groups_with_same_prefix=True, keep_only_best_group=True)
gene_desc.set_or_extend_module_description_and_final_stats(module_sentences=func_module_sentences,
module=Module.GO_FUNCTION)
else:
func_module_sentences_noq = go_sent_generator.get_module_sentences(
aspect='F', qualifier='', merge_groups_with_same_prefix=True, keep_only_best_group=True)
gene_desc.set_or_extend_module_description_and_final_stats(
module_sentences=func_module_sentences_noq, module=Module.GO_FUNCTION)
func_module_sentences = go_sent_generator.get_module_sentences(
aspect='F', qualifier='enables', merge_groups_with_same_prefix=True, keep_only_best_group=True)
gene_desc.set_or_extend_module_description_and_final_stats(
module_sentences=func_module_sentences, module=Module.GO_FUNCTION)
gene_desc.set_or_extend_module_description_and_final_stats(
module_sentences=contributes_to_module_sentences, module=Module.GO_FUNCTION)
proc_module_sentences_noq = go_sent_generator.get_module_sentences(
aspect='P', qualifier='', merge_groups_with_same_prefix=True, keep_only_best_group=True)
gene_desc.set_or_extend_module_description_and_final_stats(
module_sentences=proc_module_sentences_noq, module=Module.GO_PROCESS)
proc_module_sentences = go_sent_generator.get_module_sentences(
aspect='P', qualifier='involved_in', merge_groups_with_same_prefix=True, keep_only_best_group=True)
gene_desc.set_or_extend_module_description_and_final_stats(
Expand Down Expand Up @@ -64,6 +76,10 @@ def set_gene_ontology_module(dm: DataManager, conf_parser: GenedescConfigParser,
aspect='C', qualifier='colocalizes_with', merge_groups_with_same_prefix=True,
keep_only_best_group=True)
if colocalizes_with_module_sentences.contains_sentences():
comp_module_sentences_noq = go_sent_generator_exp.get_module_sentences(
aspect='C', qualifier='', merge_groups_with_same_prefix=True, keep_only_best_group=True)
gene_desc.set_or_extend_module_description_and_final_stats(
module_sentences=comp_module_sentences_noq, module=Module.GO_COMPONENT)
comp_module_sentences = go_sent_generator_exp.get_module_sentences(
aspect='C', qualifier='located_in', merge_groups_with_same_prefix=True, keep_only_best_group=True)
gene_desc.set_or_extend_module_description_and_final_stats(
Expand All @@ -73,6 +89,10 @@ def set_gene_ontology_module(dm: DataManager, conf_parser: GenedescConfigParser,
gene_desc.set_or_extend_module_description_and_final_stats(
module_sentences=comp_module_sentences2, module=Module.GO_COMPONENT)
else:
comp_module_sentences_noq = go_sent_generator.get_module_sentences(
aspect='C', qualifier='', merge_groups_with_same_prefix=True, keep_only_best_group=True)
gene_desc.set_or_extend_module_description_and_final_stats(
module_sentences=comp_module_sentences_noq, module=Module.GO_COMPONENT)
comp_module_sentences = go_sent_generator.get_module_sentences(
aspect='C', qualifier='located_in', merge_groups_with_same_prefix=True, keep_only_best_group=True)
gene_desc.set_or_extend_module_description_and_final_stats(
Expand All @@ -85,8 +105,12 @@ def set_gene_ontology_module(dm: DataManager, conf_parser: GenedescConfigParser,
module=Module.GO_COMPONENT)
gene_desc.set_or_update_initial_stats(module=Module.GO_FUNCTION, sent_generator=go_sent_generator,
module_sentences=contributes_to_module_sentences)
gene_desc.set_or_update_initial_stats(module=Module.GO_FUNCTION, sent_generator=go_sent_generator,
module_sentences=func_module_sentences_noq)
gene_desc.set_or_update_initial_stats(module=Module.GO_FUNCTION, sent_generator=go_sent_generator,
module_sentences=func_module_sentences)
gene_desc.set_or_update_initial_stats(module=Module.GO_PROCESS, sent_generator=go_sent_generator,
module_sentences=proc_module_sentences_noq)
gene_desc.set_or_update_initial_stats(module=Module.GO_PROCESS, sent_generator=go_sent_generator,
module_sentences=proc_module_sentences)
gene_desc.set_or_update_initial_stats(module=Module.GO_PROCESS, sent_generator=go_sent_generator,
Expand All @@ -101,6 +125,8 @@ def set_gene_ontology_module(dm: DataManager, conf_parser: GenedescConfigParser,
module_sentences=proc_module_sentences_a5)
gene_desc.set_or_update_initial_stats(module=Module.GO_COMPONENT, sent_generator=go_sent_generator,
module_sentences=colocalizes_with_module_sentences)
gene_desc.set_or_update_initial_stats(module=Module.GO_COMPONENT, sent_generator=go_sent_generator,
module_sentences=comp_module_sentences_noq)
gene_desc.set_or_update_initial_stats(module=Module.GO_COMPONENT, sent_generator=go_sent_generator,
module_sentences=comp_module_sentences)
gene_desc.set_or_update_initial_stats(module=Module.GO_COMPONENT, sent_generator=go_sent_generator,
Expand Down

0 comments on commit 7db8e06

Please sign in to comment.