Skip to content

Commit

Permalink
fix start position of test gene from 0 to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanMainguy committed Jul 3, 2024
1 parent 86785a5 commit fd495cc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion tests/context/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def simple_contig():
organism = Organism('organism_A')
for i, (gene, family_name) in enumerate(zip(genes, 'ABCDEFGHIJKLMNOP')):
family = GeneFamily(i, family_name)
gene.fill_annotations(start=i, stop=i+1, strand="+", position=i)
gene.fill_annotations(start=i+1, stop=i+2, strand="+", position=i)

gene.fill_parents(organism, contig)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_pangenome.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ def add_element_to_pangenome(self, pangenome):
ctg = Contig(0, "Ctg")
org.add(ctg)
gene = Gene("Gene")
gene.fill_annotations(start=0, stop=100, position=0, strand='+')
gene.fill_annotations(start=1, stop=100, position=0, strand='+')
gene.add_metadata(metadata=metadata)
ctg.add(gene)
pangenome.add_organism(org)
Expand Down
30 changes: 15 additions & 15 deletions tests/test_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def genes(contig) -> Generator[Set[Gene], None, None]:
@pytest.fixture
def gene(contig) -> Gene:
gene = Gene('gene')
gene.fill_annotations(start=0, stop=10, strand='+', position=0)
gene.fill_annotations(start=1, stop=10, strand='+', position=0)
contig = Contig(0, 'contig_name')
contig.length = 10
gene.contig = contig
Expand Down Expand Up @@ -145,7 +145,7 @@ def test_add_genes_at_position_already_taken(self, region, contig):
"""Test that adding genes with same position return a ValueError
"""
gene = Gene('gene')
gene.fill_annotations(start=0, stop=10, strand='+', position=0)
gene.fill_annotations(start=1, stop=10, strand='+', position=0)
gene.contig = contig

region.add(gene)
Expand All @@ -159,7 +159,7 @@ def test_add_genes_from_different_contigs(self, region):
"""Test that adding genes from different contigs return an Exception
"""
gene1, gene2 = Gene('gene_1'), Gene('gene_2')
gene1.fill_annotations(start=0, stop=10, strand='+', position=0)
gene1.fill_annotations(start=1, stop=10, strand='+', position=0)
gene2.fill_annotations(start=11, stop=20, strand='+', position=1)
gene1.fill_parents(None, Contig(1, 'contig_1'))
region.add(gene1)
Expand All @@ -171,7 +171,7 @@ def test_add_genes_from_different_organisms(self, region):
"""Test that adding genes from different organisms return an Exception
"""
gene1, gene2 = Gene('gene_1'), Gene('gene_2')
gene1.fill_annotations(start=0, stop=10, strand='+', position=0)
gene1.fill_annotations(start=1, stop=10, strand='+', position=0)
gene2.fill_annotations(start=11, stop=20, strand='+', position=1)
gene1.fill_parents(Organism("org_1"))
region.add(gene1)
Expand All @@ -183,7 +183,7 @@ def test_get_genes(self, region):
"""Tests that genes can be retrieved from the region
"""
gene = Gene('gene')
gene.fill_annotations(start=0, stop=10, strand='+', position=0)
gene.fill_annotations(start=1, stop=10, strand='+', position=0)
region.add(gene)
assert region.get(0) == gene

Expand All @@ -203,7 +203,7 @@ def test_del_gene(self, region):
"""Tests that genes can be deleted from the region
"""
gene = Gene('gene')
gene.fill_annotations(start=0, stop=10, strand='+', position=0)
gene.fill_annotations(start=1, stop=10, strand='+', position=0)
region.add(gene)
assert region.get(0) == gene
region.remove(0)
Expand Down Expand Up @@ -232,7 +232,7 @@ def test_get_organism(self, region, contig):
"""Tests that the organism linked to the region can be retrieved
"""
gene = Gene('gene')
gene.fill_annotations(start=0, stop=10, strand='+', position=0)
gene.fill_annotations(start=1, stop=10, strand='+', position=0)
gene.fill_parents(Organism("org"), contig)
region.add(gene)
assert region.organism.name == 'org'
Expand All @@ -241,7 +241,7 @@ def test_get_contig(self, region):
"""Tests that the contig linked to the region can be retrieved
"""
gene = Gene('gene')
gene.fill_annotations(start=0, stop=10, strand='+', position=0)
gene.fill_annotations(start=1, stop=10, strand='+', position=0)
gene.fill_parents(contig=Contig(0, "contig"))
region.add(gene)
assert region.contig.name == 'contig'
Expand All @@ -250,7 +250,7 @@ def test_is_whole_contig_true(self, region):
"""Tests that the property is_whole_contig return True if the region has the same length as contig
"""
starter, stopper = Gene('starter'), Gene('stopper')
starter.fill_annotations(start=0, stop=10, strand='+', position=0)
starter.fill_annotations(start=1, stop=10, strand='+', position=0)
stopper.fill_annotations(start=11, stop=20, strand='+', position=1)
contig = Contig(0, "contig")
contig[starter.start], contig[stopper.start] = starter, stopper
Expand All @@ -262,7 +262,7 @@ def test_is_whole_contig_false(self, region):
"""Tests that the property is_whole_contig return False if the region has not the same length as contig
"""
before, starter, stopper, after = Gene('before'), Gene('starter'), Gene('stopper'), Gene('after')
before.fill_annotations(start=0, stop=10, strand='+', position=0)
before.fill_annotations(start=1, stop=10, strand='+', position=0)
starter.fill_annotations(start=11, stop=20, strand='+', position=1)
stopper.fill_annotations(start=21, stop=30, strand='+', position=2)
after.fill_annotations(start=31, stop=40, strand='+', position=3)
Expand All @@ -278,7 +278,7 @@ def test_is_contig_border_true(self, region):
"""Test that property is_contig_border return true if the region is bordering the contig
"""
before, starter, stopper, after = Gene('before'), Gene('starter'), Gene('stopper'), Gene('after')
before.fill_annotations(start=0, stop=10, strand='+', position=0)
before.fill_annotations(start=1, stop=10, strand='+', position=0)
starter.fill_annotations(start=11, stop=20, strand='+', position=1)
stopper.fill_annotations(start=21, stop=30, strand='+', position=2)
after.fill_annotations(start=31, stop=40, strand='+', position=3)
Expand All @@ -299,7 +299,7 @@ def test_is_contig_border_false(self, region):
"""Tests that the property is_contig_border return False if the region is not bordering the contig
"""
before, starter, stopper, after = Gene('before'), Gene('starter'), Gene('stopper'), Gene('after')
before.fill_annotations(start=0, stop=10, strand='+', position=0)
before.fill_annotations(start=1, stop=10, strand='+', position=0)
starter.fill_annotations(start=11, stop=20, strand='+', position=1)
stopper.fill_annotations(start=21, stop=30, strand='+', position=2)
after.fill_annotations(start=31, stop=40, strand='+', position=3)
Expand Down Expand Up @@ -679,8 +679,8 @@ def test_add_different_region_with_same_name(self, spot):
"""
region_1, region_2 = Region("RGP"), Region("RGP")
gene_1, gene_2 = Gene("gene_1"), Gene("gene_2")
gene_1.fill_annotations(start=0, stop=10, strand='+', position=0)
gene_2.fill_annotations(start=0, stop=10, strand='+', position=0)
gene_1.fill_annotations(start=1, stop=10, strand='+', position=0)
gene_2.fill_annotations(start=1, stop=10, strand='+', position=0)
gene_1.family, gene_2.family = GeneFamily(0, "Fam_0"), GeneFamily(1, "Fam_1")
region_1[0], region_2[0] = gene_1, gene_2
spot[region_1.name] = region_1
Expand All @@ -691,7 +691,7 @@ def test_add_two_time_the_same_region(self, spot, region):
"""Test that adding a two time the same region is working as expected
"""
gene = Gene("gene")
gene.fill_annotations(start=0, stop=10, strand='+', position=0)
gene.fill_annotations(start=1, stop=10, strand='+', position=0)
gene.family = GeneFamily(0, "Fam")
region[0] = gene
spot[region.name] = region
Expand Down

0 comments on commit fd495cc

Please sign in to comment.