Skip to content

Commit

Permalink
Added unit tests for check_sample_and_mag_validity.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tgurbich committed Nov 19, 2024
1 parent 853a82c commit 6d58692
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GCA_01526150500
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Genome Genome_type Length N_contigs N50 GC_content Completeness Contamination rRNA_5S rRNA_16S rRNA_23S tRNAs Genome_accession Species_rep Lineage Sample_accession Study_accession Country Continent FTP_download
MGYG000298000 MAG 1829829 675 3325 56.91 81.97 3.27 93.28 20.35 5.20 19 GCA_015265315 MGYG000298000 d__Bacteria;p__Firmicutes_C;c__Negativicutes;o__Selenomonadales;f__Selenomonadaceae;g__Centipeda;s__ SAMN14571041 SRP311368 USA North America ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/mgnify_genomes/human-oral/v1.0/all_genomes/MGYG0002992/MGYG000299223/genomes1/MGYG000298000.gff.gz
MGYG000298001 MAG 2546294 85 45191 37.09 96.30 0.00 0.00 0.00 0.00 15 GCA_01526150500 MGYG000298001 d__Bacteria;p__Bacteroidota;c__Bacteroidia;o__Bacteroidales;f__Bacteroidaceae;g__Prevotella;s__Prevotella pallens SAMN14570949 SRP311368 USA North America ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/mgnify_genomes/human-oral/v1.0/all_genomes/MGYG0002981/MGYG000298159/genomes1/MGYG000298001.gff.gz
MGYG000298002 MAG 1481714 84 28959 38.14 95.74 0.71 0.00 0.00 0.00 18 CAJPUF01 MGYG000298013 d__Bacteria;p__Firmicutes_A;c__Clostridia;o__Peptostreptococcales;f__Anaerovoracaceae;g__Eubacterium_M;s__Eubacterium_M brachy ERS6080781 ERP127228 not provided not provided ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/mgnify_genomes/human-oral/v1.0/all_genomes/MGYG0002980/MGYG000298013/genomes1/MGYG000298002.gff.gz
MGYG000298003 MAG 1494829 454 4402 40.13 80.42 0.75 0.00 0.00 0.00 7 GCA_015264635 MGYG000298003 d__Bacteria;p__Firmicutes_C;c__Negativicutes;o__Veillonellales;f__Veillonellaceae;g__Veillonella;s__Veillonella atypica SAMN14571074 SRP311368 USA North America ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/mgnify_genomes/human-oral/v1.0/all_genomes/MGYG0002980/MGYG000298071/genomes1/MGYG000298003.gff.gz
MGYG000298004 MAG 1185879 236 5569 39.69 69.63 1.50 0.00 0.00 0.00 6 CAJPIW01 MGYG000299205 d__Bacteria;p__Firmicutes_C;c__Negativicutes;o__Veillonellales;f__Veillonellaceae;g__Veillonella;s__Veillonella parvula_A ERS6076640 ERP124374 not provided not provided ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/mgnify_genomes/human-oral/v1.0/all_genomes/MGYG0002992/MGYG000299205/genomes1/MGYG000298004.gff.gz
MGYG000298005 MAG 1194299 554 2401 45.56 73.10 2.18 0.00 0.00 0.00 11 GCA_015263975 MGYG000299273 d__Bacteria;p__Firmicutes_C;c__Negativicutes;o__Veillonellales;f__Megasphaeraceae;g__Anaeroglobus;s__Anaeroglobus micronuciformis SAMN14570822 SRP311368 USA North America ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/mgnify_genomes/human-oral/v1.0/all_genomes/MGYG0002992/MGYG000299273/genomes1/MGYG000298005.gff.gz
MGYG000298006 MAG 1160570 36 95371 55.48 68.42 0.00 94.12 21.59 30.05 11 GCA_015259755 MGYG000298453 d__Bacteria;p__Firmicutes_C;c__Negativicutes;o__Selenomonadales;f__Selenomonadaceae;g__Centipeda;s__Centipeda noxia SAMN14571040 SRP311368 USA North America ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/mgnify_genomes/human-oral/v1.0/all_genomes/MGYG0002984/MGYG000298453/genomes1/MGYG000298006.gff.gz
MGYG000298007 MAG 2493662 476 5753 68.18 75.36 2.21 0.00 0.00 0.00 19 CAJZFF01 MGYG000298105 d__Bacteria;p__Actinobacteriota;c__Actinomycetia;o__Actinomycetales;f__Actinomycetaceae;g__Actinomyces;s__Actinomyces oris ERS7599769 ERP108069 China Asia ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/mgnify_genomes/human-oral/v1.0/all_genomes/MGYG0002981/MGYG000298105/genomes1/MGYG000298007.gff.gz
MGYG000298008 MAG 1230350 184 7701 39.43 75.83 0 0.00 0.00 0.00 12 CAJPLM01 MGYG000298156 d__Bacteria;p__Firmicutes_C;c__Negativicutes;o__Veillonellales;f__Veillonellaceae;g__Veillonella;s__Veillonella rogosae ERS6079605 ERP127558 not provided not provided ftp://ftp.ebi.ac.uk/pub/databases/metagenomics/mgnify_genomes/human-oral/v1.0/all_genomes/MGYG0002981/MGYG000298156/genomes1/MGYG000298008.gff.gz
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GCA_01526150500
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
GCA_01526150500
CAJZFF01
GCA_015263975
32 changes: 32 additions & 0 deletions tests/scripts/test_check_sample_and_mag_validity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import filecmp
import importlib
import unittest
import os

from pathlib import Path

script_dir = Path(__file__).resolve().parent

check_validity = importlib.import_module("bin.check_sample_and_mag_validity")
check_validity_main = check_validity.main


class TestMAGValidityScript(unittest.TestCase):
def setUp(self):
self.test_data_dir = os.path.join(script_dir, "fixtures", "check_sample_and_mag_validity")
self.removal_file = os.path.join(self.test_data_dir, "remove_list.txt")
self.outfile1 = os.path.join(self.test_data_dir, "output1.txt")
self.outfile2 = os.path.join(self.test_data_dir, "output2.txt")
self.expected_file_no_remove_list = os.path.join(self.test_data_dir, "expected_result_no_remove_list.txt")

def test_empty_remove_list(self):
check_validity_main(self.test_data_dir, None, self.outfile1)
self.assertTrue(
filecmp.cmp(self.outfile1, self.expected_file_no_remove_list, shallow=False),
"The output file does not match the expected results"
)

def test_with_remove_list(self):
check_validity_main(self.test_data_dir, self.removal_file, self.outfile2)
self.assertFalse(os.path.exists(self.outfile2))

0 comments on commit 6d58692

Please sign in to comment.