From 3d8330a2f60d3ab6e9c613128124aa4b461c0f35 Mon Sep 17 00:00:00 2001 From: Cunliang Geng Date: Mon, 20 Nov 2023 11:46:01 +0100 Subject: [PATCH] remove function `filter_mibig_only_gcf` This function is needed anymore. GCF loader already has the functionality to filter mibig only GCF during loading. --- src/nplinker/genomics/__init__.py | 2 -- src/nplinker/genomics/genomics.py | 9 --------- src/nplinker/loader.py | 3 +-- tests/genomics/test_genomics.py | 8 -------- 4 files changed, 1 insertion(+), 21 deletions(-) diff --git a/src/nplinker/genomics/__init__.py b/src/nplinker/genomics/__init__.py index 7710f337..cffff7c5 100644 --- a/src/nplinker/genomics/__init__.py +++ b/src/nplinker/genomics/__init__.py @@ -2,7 +2,6 @@ from .abc import BGCLoaderBase from .bgc import BGC from .gcf import GCF -from .genomics import filter_mibig_only_gcf from .genomics import generate_mappings_genome_id_bgc_id from .genomics import get_bgcs_from_gcfs from .genomics import get_strains_from_bgcs @@ -16,7 +15,6 @@ "BGCLoaderBase", "BGC", "GCF", - "filter_mibig_only_gcf", "generate_mappings_genome_id_bgc_id", "get_bgcs_from_gcfs", "get_strains_from_bgcs", diff --git a/src/nplinker/genomics/genomics.py b/src/nplinker/genomics/genomics.py index 53676be1..babadfe7 100644 --- a/src/nplinker/genomics/genomics.py +++ b/src/nplinker/genomics/genomics.py @@ -116,15 +116,6 @@ def map_bgc_to_gcf(bgcs: list[BGC], gcfs: list[GCF]): gcf.add_bgc(bgc) -def filter_mibig_only_gcf(gcfs: list[GCF]) -> list[GCF]: - """Filter out GCFs that contain only MIBiG BGC objects. - - This method returns a new list of GCFs that have at least one non-MIBiG - BGC object as its child. - """ - return [gcf for gcf in gcfs if gcf.has_mibig_only() is False] - - def get_bgcs_from_gcfs(gcfs: list[GCF]) -> list[BGC]: """Get all BGC objects from given GCF objects.""" s = set() diff --git a/src/nplinker/loader.py b/src/nplinker/loader.py index b6391c00..5155b723 100644 --- a/src/nplinker/loader.py +++ b/src/nplinker/loader.py @@ -8,7 +8,6 @@ from nplinker.genomics import generate_mappings_genome_id_bgc_id from nplinker.genomics.antismash import AntismashBGCLoader from nplinker.genomics.bigscape import BigscapeGCFLoader -from nplinker.genomics.genomics import filter_mibig_only_gcf from nplinker.genomics.genomics import get_bgcs_from_gcfs from nplinker.genomics.genomics import get_strains_from_bgcs from nplinker.genomics.genomics import map_bgc_to_gcf @@ -453,7 +452,7 @@ def _load_genomics(self): map_bgc_to_gcf(raw_bgcs, raw_gcfs) # Step 5: get clean GCF objects, BGC objects and Strain objects - self.gcfs = filter_mibig_only_gcf(raw_gcfs) + self.gcfs = raw_gcfs self.bgcs = get_bgcs_from_gcfs(self.gcfs) self.strains = get_strains_from_bgcs(self.bgcs) diff --git a/tests/genomics/test_genomics.py b/tests/genomics/test_genomics.py index f691d561..394f5a36 100644 --- a/tests/genomics/test_genomics.py +++ b/tests/genomics/test_genomics.py @@ -3,7 +3,6 @@ import pytest from nplinker.genomics import BGC from nplinker.genomics import GCF -from nplinker.genomics import filter_mibig_only_gcf from nplinker.genomics import generate_mappings_genome_id_bgc_id from nplinker.genomics import get_bgcs_from_gcfs from nplinker.genomics import get_strains_from_bgcs @@ -149,13 +148,6 @@ def test_map_bgc_to_gcf_error(bgc_list, gcf_list_error): assert "BGC id 'BGC_04' from GCF object '1' not found" in e.value.args[0] -def test_filter_mibig_only_gcf(bgc_list, gcf_list): - map_bgc_to_gcf(bgc_list, gcf_list) - gcfs = filter_mibig_only_gcf(gcf_list) - assert len(gcfs) == 1 - assert gcfs[0].gcf_id == "2" - - def test_get_bgcs_from_gcfs(bgc_list, gcf_list): map_bgc_to_gcf(bgc_list, gcf_list) bgcs = get_bgcs_from_gcfs(gcf_list)