diff options
-rw-r--r-- | gn3/computations/datasets.py | 20 | ||||
-rw-r--r-- | gn3/settings.py | 3 | ||||
-rw-r--r-- | guix.scm | 2 |
3 files changed, 24 insertions, 1 deletions
diff --git a/gn3/computations/datasets.py b/gn3/computations/datasets.py index 8e9d743..28d40a1 100644 --- a/gn3/computations/datasets.py +++ b/gn3/computations/datasets.py @@ -204,3 +204,23 @@ def create_dataset(dataset_type=None, dataset_name: str = None): results = dataset_creator( dataset_name=dataset_name, dataset_type=dataset_type) return results + + +def fetch_dataset_sample_id(samplelist: List, database, species: str) -> dict: + """fetch the strain ids from the db only if\ + it is in the samplelist""" + # xtodo create an in clause for samplelist + + strain_query = """ + SELECT Strain.Name, Strain.Id FROM Strain, Species + WHERE Strain.Name IN {} + and Strain.SpeciesId=Species.Id + and Species.name = '{}' + """ + + database_cursor = database.cursor() + database_cursor.execute(strain_query.format(samplelist, species)) + + results = database_cursor.fetchall() + + return dict(results) diff --git a/gn3/settings.py b/gn3/settings.py index 2836581..d9d4f90 100644 --- a/gn3/settings.py +++ b/gn3/settings.py @@ -15,3 +15,6 @@ TMPDIR = os.environ.get("TMPDIR", tempfile.gettempdir()) SQLALCHEMY_DATABASE_URI = "mysql://kabui:1234@localhost/test" SECRET_KEY = "password" SQLALCHEMY_TRACK_MODIFICATIONS = False +# gn2 results only used in fetching dataset info + +GN2_BASE_URL = "http://www.genenetwork.org/" @@ -78,7 +78,7 @@ ("python-pylint" python-pylint) ("python-redis" ,python-redis) ("python-scipy" ,python-scipy) - ("python-scipy" ,python-scipy) + ("python-mysqlclient" ,python-mysqlclient) ("python-sqlalchemy-stubs" ,python-sqlalchemy-stubs))) (build-system python-build-system) (home-page "https://github.com/genenetwork/genenetwork3") |