def export(): """Create export data file.""" from biomappings.resources import load_mappings, load_predictions, load_false_mappings here = os.path.abspath(os.path.dirname(__file__)) path = os.path.join(here, os.pardir, os.pardir, 'docs', '_data', 'summary.yml') true_mappings = load_mappings() false_mappings = load_false_mappings() rv = { 'positive': _get_counter(true_mappings), 'negative': _get_counter(false_mappings), 'predictions': _get_counter(load_predictions()), 'contributors': _get_contributors(itt.chain(true_mappings, false_mappings)), } rv.update({ f'{k}_mapping_count': sum(e['count'] for e in rv[k]) for k in ('positive', 'negative', 'predictions') }) rv.update({ f'{k}_prefix_count': len(set(itt.chain.from_iterable((e['source'], e['target']) for e in rv[k]))) for k in ('positive', 'negative', 'predictions') }) with open(path, 'w') as file: yaml.safe_dump(rv, file, indent=2)
def export(): """Create export data file.""" from biomappings.resources import load_mappings, load_predictions, load_false_mappings from biomappings.utils import DATA path = os.path.join(DATA, "summary.yml") true_mappings = load_mappings() false_mappings = load_false_mappings() rv = { "positive": _get_counter(true_mappings), "negative": _get_counter(false_mappings), "predictions": _get_counter(load_predictions()), "contributors": _get_contributors(itt.chain(true_mappings, false_mappings)), } rv.update({ f"{k}_mapping_count": sum(e["count"] for e in rv[k]) for k in ("positive", "negative", "predictions") }) rv.update({ f"{k}_prefix_count": len( set( itt.chain.from_iterable( (e["source"], e["target"]) for e in rv[k]))) for k in ("positive", "negative", "predictions") }) with open(path, "w") as file: yaml.safe_dump(rv, file, indent=2)
def get_false_graph() -> nx.Graph: """Get a graph of the false mappings.""" return _graph_from_mappings(load_false_mappings())
def get_predictions_graph() -> nx.Graph: """Get a graph of the predicted mappings.""" return _graph_from_mappings(load_false_mappings())
def get_predictions_graph(include: Optional[Sequence[str]] = None, exclude: Optional[Sequence[str]] = None) -> nx.Graph: """Get a graph of the predicted mappings.""" return _graph_from_mappings(load_false_mappings(), include=include, exclude=exclude)