Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Unsupported NDEx utilities

Project description

Warning: This repository is for development and features may change. Please use this at your own risk.

Compatibility

  • Python 3.3+

Installation

git clone https://github.com/ndexbio/ndexutils
cd ndexutils
make dist
pip install dist/ndexutil*whl

OR via PyPI

pip install ndexutil

TSV Loader

This module contains the Tab Separated Variable Loader (TSV Loader) which generates an NDEx CX file from a tab separated text file of edge data and attributes.

To load data a load plan must be created. This plan tells the loader how to map the columns in the file to nodes, and edges. This load plan needs to validate against this load plan JSON schema

Example TSV file

SOURCE  TARGET  WEIGHT
ABCD    AAA1    0.555
GGGG    BBBB    0.305

SOURCE is the source node, TARGET is target node

A schema that could be:

{
"source_plan":
    {
        "node_name_column": "SOURCE"
    },
    "target_plan":
    {
        "node_name_column": "TARGET"
    },
    "edge_plan":
    {
        "default_predicate": "unknown",
        "property_columns": [
          {
            "column_name": "WEIGHT",
            "attribute_name": "weight",
            "data_type": "double"
          }
        ]
    }
}

Example below assumes the following:

  • ./loadplan.json is the load plan in JSON format
  • ./style.cx is a NDEx CX with a style.
import ndex2
from ndexutil.tsv.streamtsvloader import StreamTSVLoader

# using ndex2 client library read CX file as NiceCXNetwork object
style_network = ndex2.create_nice_cx_from_file('./style.cx')

loader = StreamTSVLoader('./loadplan.json', style_network)
with open('./input.tsv', 'r') as tsvfile:
    with open('./output.cx', 'w') as outfile:
        loader.write_cx_network(tsvfile, outfile)

Credits

History

0.4.0 2019-05-23

  • Added loaderutils.py module with two new classes, NetworkIssueReport and an abstract class NetworkUpdator

0.3.0 2019-05-14

  • tsv2nicecx2.convert_pandas_to_nice_cx_with_load_plan now loads @context data into a @context network attribute instead of a separate aspect

0.2.0 2019-04-01

  • StreamTSVLoader class added which enables loading of TSV data into in streaming format to handle loading of large networks

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
ndexutil-0.4.0-py3-none-any.whl (35.2 kB) Copy SHA256 hash SHA256 Wheel py3
ndexutil-0.4.0.tar.gz (30.6 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page