Skip to content

Commit

Permalink
Merge pull request #80 from Nozdi/63-choose-skelet-of-mirna
Browse files Browse the repository at this point in the history
[#63] Added function to get mirna by name or all
  • Loading branch information
Michał Rostecki committed Sep 24, 2014
2 parents e07cc13 + 4373a81 commit 6bea781
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/shmir/data/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import (
relationship,
backref,
)
from sqlalchemy.orm import (
scoped_session,
sessionmaker
)

from shmir.designer.errors import NoResultError
from shmir.settings import (
FCONN
)
Expand Down Expand Up @@ -90,6 +90,16 @@ def generate_regexp_all(cls):

db_session.commit()

@classmethod
def get_mirna(cls, name=None):
if name:
mirna = db_session.query(cls).filter(cls.name == name).all()
else:
mirna = db_session.query(cls).all()
if not mirna:
raise NoResultError('Backbone does not exist.')
return mirna


class Immuno(Base):
"""
Expand Down

0 comments on commit 6bea781

Please sign in to comment.