Skip to content

Commit 6c460b8

Browse files
authored
Merge pull request #12 from galaxy-genome-annotation/tripal_reflect
Fix data loading in Tripal database
2 parents 1698dc4 + b10fa63 commit 6c460b8

11 files changed

Lines changed: 77 additions & 24 deletions

File tree

.travis.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ jobs:
3636
- sleep 300 # Wait for the container to be ready
3737
script:
3838
- python setup.py nosetests
39+
- stage: test
40+
python: '3.5'
41+
env:
42+
- TRIPAL=1
43+
install:
44+
- pip install -U pip setuptools nose
45+
- python setup.py install
46+
- export CHAKIN_GLOBAL_CONFIG_PATH=`pwd`/test-data/compose/chakin-compose.yml
47+
- sudo service postgresql stop
48+
- cd test-data/compose && docker-compose up -d && cd ../../
49+
- sleep 300 # Wait for the container to be ready
50+
script:
51+
- python setup.py nosetests
3952
- stage: deploy
4053
install: skip
4154
script: echo "Deploying to Pypi"

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ $ chakin feature load_fasta \
8787
8888
## History
8989
90+
- 2.3.1
91+
- Fix data loading in Tripal database
92+
9093
- 2.3.0
9194
- Fix non working --re_parent option in fasta loader
9295
- allow connection using a preformatted url (needed by galaxy tools using pgutil)

chado/__init__.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,20 +136,21 @@ class Tripal_analysis_blast(Base):
136136
Base.prepare(self._engine, reflect=True, schema=self.dbschema)
137137
if reflect_tripal_tables and self.dbschema != "public":
138138
Base.prepare(self._engine, reflect=True, schema='public')
139+
139140
# Check for schema name instead of hardcoding?
140141
self.model = Base.classes
141142
self.model.blast_hit_data = Blast_hit_data
142143
self.model.tripal_analysis_blast = Tripal_analysis_blast
143144

144145
# ambiguous relationships to same table
145-
self.model.feature_relationship.subject = relationship("feature", foreign_keys=[self.model.feature_relationship.subject_id], back_populates="subject_in_relationships")
146-
self.model.feature.subject_in_relationships = relationship("feature_relationship", foreign_keys=[self.model.feature_relationship.subject_id])
147-
self.model.feature_relationship.object = relationship("feature", foreign_keys=[self.model.feature_relationship.object_id], back_populates="object_in_relationships")
148-
self.model.feature.object_in_relationships = relationship("feature_relationship", foreign_keys=[self.model.feature_relationship.object_id])
149-
150-
self.model.featureloc.feature = relationship("feature", foreign_keys=[self.model.featureloc.feature_id], back_populates="featureloc_collection")
151-
self.model.feature.featureloc_collection = relationship("featureloc", foreign_keys=[self.model.featureloc.feature_id], back_populates="feature")
152-
self.model.featureloc.srcfeature = relationship("feature", foreign_keys=[self.model.featureloc.srcfeature_id])
146+
self.model.feature_relationship.subject = relationship(self.model.feature, foreign_keys=[self.model.feature_relationship.subject_id], back_populates="subject_in_relationships")
147+
self.model.feature.subject_in_relationships = relationship(self.model.feature_relationship, foreign_keys=[self.model.feature_relationship.subject_id])
148+
self.model.feature_relationship.object = relationship(self.model.feature, foreign_keys=[self.model.feature_relationship.object_id], back_populates="object_in_relationships")
149+
self.model.feature.object_in_relationships = relationship(self.model.feature_relationship, foreign_keys=[self.model.feature_relationship.object_id])
150+
151+
self.model.featureloc.feature = relationship(self.model.feature, foreign_keys=[self.model.featureloc.feature_id], back_populates="featureloc_collection")
152+
self.model.feature.featureloc_collection = relationship(self.model.featureloc, foreign_keys=[self.model.featureloc.feature_id], back_populates="feature")
153+
self.model.featureloc.srcfeature = relationship(self.model.feature, foreign_keys=[self.model.featureloc.srcfeature_id])
153154

154155
def _reflect_tables_subset(self):
155156

chado/util/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def launch_docker_image(self, background=False, no_yeast=False):
7070

7171
cmd += [
7272
'-p', '5432:5432',
73-
'quay.io/galaxy-genome-annotation/chado:1.31-jenkins23-pg9.5'
73+
'quay.io/galaxy-genome-annotation/chado:1.31-jenkins26-pg9.5'
7474
]
7575

7676
subprocess.call(cmd)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setup(
88
name="chado",
9-
version='2.3.0',
9+
version='2.3.1',
1010
description="Chado library",
1111
author="Anthony Bretaudeau",
1212
author_email="anthony.bretaudeau@inra.fr",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## Chado's chakin: Global Configuration File.
2+
# Each stanza should contain a single chado server to control.
3+
#
4+
# You can set the key __default to the name of a default instance
5+
__default: local
6+
7+
local:
8+
dbhost: "localhost"
9+
dbname: "postgres"
10+
dbuser: "postgres"
11+
dbpass: "postgres"
12+
dbport: "5433"
13+
dbschema: "chado"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: '2'
2+
services:
3+
4+
tripal:
5+
image: quay.io/galaxy-genome-annotation/tripal
6+
links:
7+
- tripaldb:postgres
8+
environment:
9+
MEMORY_LIMIT: 512M
10+
TRIPAL_GIT_CLONE_MODULES: ""
11+
TRIPAL_DOWNLOAD_MODULES: ""
12+
TRIPAL_ENABLE_MODULES: ""
13+
14+
tripaldb:
15+
image: quay.io/galaxy-genome-annotation/chado:1.31-jenkins26-pg9.5
16+
ports:
17+
- "5433:5432"
18+
environment:
19+
- POSTGRES_PASSWORD=postgres
20+
- INSTALL_CHADO_SCHEMA=0

test/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@
66

77
ci_no_reflect = get_instance('local', no_reflect=True)
88

9+
ci_reflect_tripal = get_instance('local', reflect_tripal_tables=True)
10+
911

1012
def setup_package():
1113
global ci
1214
global ci_no_reflect
15+
global ci_reflect_tripal
1316

1417

1518
class ChadoTestCase(unittest.TestCase):

test/cvterm_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_get_id_by_synonym(self):
2121
term = self.ci.get_cvterm_id(name='lives inside of', cv='relationship', allow_synonyms=True)
2222

2323
# The id is hard coded with value from current chado dump
24-
assert term == 432, "Got cvterm id by synonym"
24+
assert term >= 400, "Got cvterm id by synonym"
2525

2626
def test_get_id_by_name_synmultiple(self):
2727

@@ -34,7 +34,7 @@ def test_get_name(self):
3434
# The id is hard coded with value from current chado dump
3535
term = self.ci.get_cvterm_name(432)
3636

37-
assert term == 'endoparasite_of', "Got cvterm name"
37+
assert 'endoparasite' in term, "Got cvterm name"
3838

3939
@raises(Exception)
4040
def test_get_name_fail(self):

test/go_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from nose.tools import raises
22

3-
from . import ChadoTestCase, ci
3+
from . import ChadoTestCase, ci_reflect_tripal
44

55

66
class GoTest(ChadoTestCase):
@@ -120,7 +120,7 @@ def test_load_go_bad_query(self):
120120
self.ci.load.go(input="./test-data/go.gaf", analysis_id=an_go['analysis_id'], organism_id=org['organism_id'], query_type='foobar')
121121

122122
def setUp(self):
123-
self.ci = ci
123+
self.ci = ci_reflect_tripal
124124
self.ci.organism.delete_organisms()
125125
self.ci.analysis.delete_analyses()
126126
self.ci.feature.delete_features()

0 commit comments

Comments
 (0)