Home · Quickstart · Documentation · Citation · NiPy

# interfaces.cmtk.nx

## AverageNetworks

Link to code

Calculates and outputs the average network given a set of input NetworkX gpickle files

This interface will only keep an edge in the averaged network if that edge is present in at least half of the input networks.

### Example

    >>> import nipype.interfaces.cmtk as cmtk
    >>> avg = cmtk.AverageNetworks()
    >>> avg.inputs.in_files = ['subj1.pck', 'subj2.pck']
    >>> avg.run()

Inputs:

    [Mandatory]
    in_files: (an existing file name)
            Networks for a group of subjects

    [Optional]
    group_id: (a string, nipype default value: group1)
            ID for group
    ignore_exception: (a boolean, nipype default value: False)
            Print an error message instead of throwing an exception in case the
            interface fails to run
    out_gexf_groupavg: (a file name)
            Average network saved as a .gexf file
    out_gpickled_groupavg: (a file name)
            Average network saved as a NetworkX .pck
    resolution_network_file: (an existing file name)
            Parcellation files from Connectome Mapping Toolkit. This is not
            necessary, but if included, the interface will output the
            statistical maps as networkx graphs.

Outputs:

    gexf_groupavg: (a file name)
            Average network saved as a .gexf file
    gpickled_groupavg: (a file name)
            Average network saved as a NetworkX .pck
    matlab_groupavgs: (a file name)

## NetworkXMetrics

Link to code

Calculates and outputs NetworkX-based measures for an input network

### Example

    >>> import nipype.interfaces.cmtk as cmtk
    >>> nxmetrics = cmtk.NetworkXMetrics()
    >>> nxmetrics.inputs.in_file = 'subj1.pck'
    >>> nxmetrics.run()

Inputs:

    [Mandatory]
    in_file: (an existing file name)
            Input network

    [Optional]
    compute_clique_related_measures: (a boolean, nipype default value:
             False)
            Computing clique-related measures (e.g. node clique number) can be
            very time consuming
    ignore_exception: (a boolean, nipype default value: False)
            Print an error message instead of throwing an exception in case the
            interface fails to run
    out_edge_metrics_matlab: (a file name)
            Output edge metrics in MATLAB .mat format
    out_global_metrics_matlab: (a file name)
            Output node metrics in MATLAB .mat format
    out_k_core: (a file name, nipype default value: k_core)
            Computed k-core network stored as a NetworkX pickle.
    out_k_crust: (a file name, nipype default value: k_crust)
            Computed k-crust network stored as a NetworkX pickle.
    out_k_shell: (a file name, nipype default value: k_shell)
            Computed k-shell network stored as a NetworkX pickle.
    out_node_metrics_matlab: (a file name)
            Output node metrics in MATLAB .mat format
    out_pickled_extra_measures: (a file name, nipype default value:
             extra_measures)
            Network measures for group 1 that return dictionaries stored as a
            Pickle.
    treat_as_weighted_graph: (a boolean, nipype default value: True)
            Some network metrics can be calculated while considering only a
            binarized version of the graph

Outputs:

    edge_measure_networks: (a file name)
    edge_measures_matlab: (a file name)
            Output edge metrics in MATLAB .mat format
    global_measures_matlab: (a file name)
            Output global metrics in MATLAB .mat format
    gpickled_network_files: (a file name)
    k_core: (a file name)
            Computed k-core network stored as a NetworkX pickle.
    k_crust: (a file name)
            Computed k-crust network stored as a NetworkX pickle.
    k_networks: (a file name)
    k_shell: (a file name)
            Computed k-shell network stored as a NetworkX pickle.
    matlab_dict_measures: (a file name)
    matlab_matrix_files: (a file name)
    node_measure_networks: (a file name)
    node_measures_matlab: (a file name)
            Output node metrics in MATLAB .mat format
    pickled_extra_measures: (a file name)
            Network measures for the group that return dictionaries, stored as a
            Pickle.

## `add_dicts_by_key()`

Link to code

Combines two dictionaries and adds the values for those keys that are shared

## `add_edge_data()`

Link to code

## `add_node_data()`

Link to code

## `average_networks()`

Link to code

Sums the edges of input networks and divides by the number of networks Writes the average network as .pck and .gexf and returns the name of the written networks

## `compute_dict_measures()`

Link to code

Returns a dictionary

## `compute_edge_measures()`

Link to code

These return edge-based measures

## `compute_network_measures()`

Link to code

## `compute_node_measures()`

Link to code

These return node-based measures

## `compute_singlevalued_measures()`

Link to code

Returns a single value per network

## `fix_keys_for_gexf()`

Link to code

GEXF Networks can be read in Gephi, however, the keys for the node and edge IDs must be converted to strings

## `read_unknown_ntwk()`

Link to code

## `remove_all_edges()`

Link to code