Example #1
0
    def test_extend(self):
        p1 = Pipeline.from_functions(['infer_central_dogma'])
        self.assertEqual(1, len(p1))

        p2 = Pipeline.from_functions(['remove_pathologies'])
        p1.extend(p2)

        self.assertEqual(2, len(p1))
Example #2
0
    def test_extend(self):
        p1 = Pipeline.from_functions(['enrich_protein_and_rna_origins'])
        self.assertEqual(1, len(p1))

        p2 = Pipeline.from_functions(['remove_pathologies'])
        p1.extend(p2)

        self.assertEqual(2, len(p1))
Example #3
0
 def test_serialize_file(self):
     p = Pipeline.from_functions(['enrich_protein_and_rna_origins'])
     sio = StringIO()
     p.dump(sio)
     sio.seek(0)
     p_reconstituted = Pipeline.load(sio)
     self.assertEqual(p.protocol, p_reconstituted.protocol)
Example #4
0
 def test_serialize_file(self):
     p = Pipeline.from_functions(['infer_central_dogma'])
     sio = StringIO()
     p.dump(sio)
     sio.seek(0)
     p_reconstituted = Pipeline.load(sio)
     self.assertEqual(p.protocol, p_reconstituted.protocol)
Example #5
0
    def test_pipeline_by_function(self):
        pipeline = Pipeline.from_functions([
            enrich_protein_and_rna_origins,
        ])
        result = pipeline(self.graph)

        self.assertEqual(32, result.number_of_nodes())

        for node in self.graph:
            self.assertIn(node, result)

        self.check_original_unchanged()
Example #6
0
    def test_pipeline_by_string(self):
        pipeline = Pipeline.from_functions([
            'infer_central_dogma',
        ])
        result = pipeline(self.graph)

        self.assertEqual(32, result.number_of_nodes())

        for node in self.graph:
            self.assertIn(node, result)

        self.check_original_unchanged()
Example #7
0
 def test_serialize_string(self):
     p = Pipeline.from_functions(['enrich_protein_and_rna_origins'])
     s = p.dumps()
     p_reconstituted = Pipeline.loads(s)
     self.assertEqual(p.protocol, p_reconstituted.protocol)
Example #8
0
from .tools_compat import calculate_error_by_annotation, get_tools_version, summarize_completeness
from .utils import SecurityConfigurableBlueprint as Blueprint, calculate_overlap_info
from .version import get_version as get_bel_commons_version

__all__ = [
    'ui_blueprint',
]

logger = logging.getLogger(__name__)

ui_blueprint = Blueprint('ui', __name__)

time_instantiated = str(datetime.datetime.now())
extract_useful_subgraph = Pipeline.from_functions([
    remove_pathologies,
    remove_associations,
    collapse_to_genes,
    remove_isolated_nodes,
])


def _format_big_number(n: int) -> str:
    if n > 1000000:
        return '{}M'.format(int(round(n / 1000000)))
    elif n > 1000:
        return '{}K'.format(int(round(n / 1000)))
    else:
        return str(n)


def redirect_to_view_explorer_query(query: Query) -> flask.Response:
    """Return the response for the biological network explorer in a given query to :func:`view_explorer_query`."""
Example #9
0
 def test_serialize_string(self):
     p = Pipeline.from_functions(['infer_central_dogma'])
     s = p.dumps()
     p_reconstituted = Pipeline.loads(s)
     self.assertEqual(p.protocol, p_reconstituted.protocol)