Beispiel #1
0
class ModelDB(object):
    pass


bigg = ModelDB()
try:
    model_ids = index_models_bigg().bigg_id
except requests.ConnectionError:
    bigg.no_models_available = "Cameo couldn't reach http://bigg.ucsd.edu at initialization time. Are you connected to the internet?"
except Exception as e:
    bigg.no_models_available = "Cameo could reach http://bigg.ucsd.edu at initialization time but something went wrong while decoding the server response."
    logger.debug(e)
else:
    for id in model_ids:
        setattr(bigg, str_to_valid_variable_name(id), lazy_object_proxy.Proxy(partial(get_model_from_bigg, id)))

minho = ModelDB()
try:
    minho_models = index_models_minho()
except requests.ConnectionError as e:
    minho.no_models_available = "Cameo couldn't reach http://darwin.di.uminho.pt/models at initialization time. Are you connected to the internet?"
    logger.debug(e)
except Exception as e:
    minho.no_models_available = "Cameo could reach http://darwin.di.uminho.pt/models at initialization time but something went wrong while decoding the server response."
    logger.debug(e)
else:
    model_indices = minho_models.id
    model_ids = minho_models.name
    for index, id in zip(model_indices, model_ids):
        setattr(minho, str_to_valid_variable_name(id), lazy_object_proxy.Proxy(partial(get_model_from_uminho, index)))
Beispiel #2
0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import

__all__ = ['universal']

import os
import glob
import cameo
from cameo.io import load_model
from cameo import util

from functools import partial
from lazy_object_proxy import Proxy


class ModelDB(object):
    pass


universal = ModelDB()

for file_path in glob.glob(os.path.join(os.path.dirname(cameo.__file__), 'models', 'universal_models', '*.json')):
    model_id = os.path.splitext(os.path.basename(file_path))[0]
    setattr(universal, util.str_to_valid_variable_name(model_id), Proxy(partial(load_model, file_path)))
Beispiel #3
0
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import

__all__ = ['universal']

import os
import glob
import cameo
from cameo.io import load_model
from cameo import util

from functools import partial
from lazy_object_proxy import Proxy


class ModelDB(object):
    pass


universal = ModelDB()

for file_path in glob.glob(
        os.path.join(os.path.dirname(cameo.__file__), 'models',
                     'universal_models', '*.json')):
    model_id = os.path.splitext(os.path.basename(file_path))[0]
    setattr(universal, util.str_to_valid_variable_name(model_id),
            Proxy(partial(load_model, file_path)))
Beispiel #4
0
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import

import sys
import os
import glob
import cameo
from cameo.io import load_model
from cameo import util

from functools import partial
from lazy_object_proxy import Proxy

__all__ = ['universal']


class ModelDB(object):
    pass


universal = ModelDB()

for file_path in glob.glob(os.path.join(os.path.dirname(cameo.__file__), 'models', 'universal_models', '*.json')):
    model_id = os.path.splitext(os.path.basename(file_path))[0]
    setattr(universal, util.str_to_valid_variable_name(model_id), Proxy(partial(load_model, file_path)))

sys.modules[__name__] = universal