shmir package

Submodules

shmir.async module

shmir.async.get_async_result(task, task_id, timeout=1.0, only_status=False)

Gets AsyncResult of task, excepting TimeoutError and handling failures

Args:
task: the task from which want extract result from task_id: id of task timeout(float): timeout of task only_status(bool): boolean if function should return only status (default: False)
Returns:
Task response

shmir.contextmanagers module

shmir.contextmanagers.blast_path(*args, **kwds)

Context manager which changes path for blast executions

shmir.contextmanagers.generic_path(path)

Function which changes current path to given path

Args:
path(str): path where interpreter should be
shmir.contextmanagers.mfold_path(*args, **kwds)

Context manager which changes path for mfold tasks

Args:
task_id: id of mfold task

shmir.decorators module

shmir.decorators.catch_errors(*errors)

Decorator to catch specific errors given

Args:
*errors: All error which should be catched
Returns:
dict with error status and its message or function result
shmir.decorators.send_email(file_handler=None)

Decorator to send email after task

Args:
file_handler: function to handle files

shmir.mfold module

shmir.result_handlers module

shmir.result_handlers.zip_file_mfold(path)

Function which creates zip_msg to send via email

Args:
path: path of zip file
Returns:
tuple of zip message
shmir.result_handlers.zip_files_from_sirna(struct)

Function which generates email msg from siRNA

Args:
struct: sh-miR struct
Returns:
zip message
shmir.result_handlers.zip_files_from_transcript(struct)

Function which generates email msg from transcript

Args:
struct: sh-miR struct
Returns:
zip message

shmir.settings module

shmir.settings.get_bool(section, option, default=None)

Function which gets settings

Args:
section(str): section of settings option(str): option of settings
Returns:
config(bool) or default value
shmir.settings.get_config(section, option, default=None)

Function which gets settings

Args:
section(str): section of settings option(str): option of settings
Returns:
config or default value
shmir.settings.get_db_config(option, default=None)
shmir.settings.get_int(section, option, default=None)

Function which gets settings

Args:
section(str): section of settings option(str): option of settings
Returns:
config(int) or default value

shmir.testing module

class shmir.testing.TestModelBase(methodName='runTest')

Bases: unittest.case.TestCase

get_all(model)
put_to_db(obj)
setUp()
tearDown()
shmir.testing.create_backbone()

Function to create default backbone object

shmir.utils module

shmir.views module

shmir.views.mfold_task_creator(*args, **kwargs)

Handler to create folded structure via mfold for specific sequence.

Args:
data: sequence
Returns:
Task id of this task
shmir.views.mfold_task_result(task_id)

Handler for getting mfold result from just a task id

Args:
task_id: Id of task generated via RESTful API
Returns:
Json object of status or sends zipped file
shmir.views.mfold_task_status(task_id)

Mfold status getter

Args:
task_id: Id of task generated via RESTful API
Returns:
Json object with status of specific id
shmir.views.scaffolds(*args, **kwargs)

Handler to list all possible backbones

Returns:
Json object with names of backbones list
shmir.views.sirna_task_creator(*args, **kwargs)

Handler to initialize task which creates sh-miR(s) from siRNA

Args:
data: one siRNA strand (active) or two siRNA strands separated by space.
First strand is active, both are in 5-3 orientation.
Returns:
Task id
shmir.views.sirna_task_result(task_id)

Handler to give result of sh-miR(s) created from siRNA

Args:
task_id: Id of task generated via RESTful API
Returns:
Json object with sh-miRs created from siRNA: [(score, sh-miR, bacbone name, pdf(id to download pdf via mfold)...]
shmir.views.sirna_task_status(task_id)

Handler to check status of task which creates sh-miR from siRNA

Args:
task_id: Id of task generated via RESTful API
Returns:
Json object with status of given task_id
shmir.views.transcript_task_creator(*args, **kwargs)

Handler to create sh-miR from transcript

Args:
transcript_name: name of transcript
Returns:
Id of task
shmir.views.transcript_task_result(task_id)

Handler to get results of task which creates sh-miR(s) from transcript

Args:
task_id: Id of task generated via RESTful API
Returns:
Json object with list of sh-miRs in structure: [sh-miR, score, pdf(id to download pdf via mfold), sequence and backbone name...]
shmir.views.transcript_task_status(task_id)

Handler to check status of task which creates sh-miR from transcript

Args:
task_id: Id of task generated via RESTful API
Returns:
Json object with status of given task_id

Module contents