parag

parag🎆Interactive visualization of higher-order graphs in Python

https://github.com/rraadd88/parag

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • âś“
    CITATION.cff file
    Found CITATION.cff file
  • âś“
    codemeta.json file
    Found codemeta.json file
  • âś“
    .zenodo.json file
    Found .zenodo.json file
  • âś“
    DOI references
    Found 7 DOI reference(s) in README
  • âś“
    Academic publication links
    Links to: researchgate.net, zenodo.org
  • â—‹
    Committers with academic emails
  • â—‹
    Institutional organization owner
  • â—‹
    JOSS paper metadata
  • â—‹
    Scientific vocabulary similarity
    Low similarity (12.7%) to scientific vocabulary

Keywords

higher-order-networks hyperedge hypergraph network-visualization
Last synced: 4 months ago · JSON representation ·

Repository

parag🎆Interactive visualization of higher-order graphs in Python

Basic Info
Statistics
  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • Open Issues: 1
  • Releases: 0
Topics
higher-order-networks hyperedge hypergraph network-visualization
Created almost 2 years ago · Last pushed over 1 year ago
Metadata Files
Readme License Citation

README.md

parag

Para (beyond pairwise) Graph: interactive visualization of higher-order graphs in Python

build Issues Downloads GNU
License DOI

Install

sh pip install parag

Interpretation as a hypergraph, using proportion of degrees by communities

Proportion of degrees by communities in a pairwise graph helps reveal how nodes are grouped together and connected within different communities. This analysis highlights clusters of nodes with strong internal connections, potentially representing higher-order relationships. By comparing the degree proportions within and between communities, we can distinguish internal cohesion from inter-community interactions. These insights aid in interpreting the graph as a hypergraph, where communities with high intra-community connections may signify higher-order relationships, offering a richer understanding of complex interactions beyond simple pairwise connections.

Inspired by

Vehlow, Corinna, Thomas Reinhardt, and Daniel Weiskopf. “Visualizing fuzzy overlapping communities in networks.” IEEE Transactions on Visualization and Computer Graphics 19.12 (2013): 2486-2495.
Figure 9B

Examples:

Gene interaction networks

python from parag.hypergraph import to_net cfg,df_=to_net( nodes=nodes.sort_values('Essentiality (determined from multiple datasets)'), edges=edges, col_node_id='Gene ID', col_source='# protein1', col_target='protein2', col_subset_id='Essentiality (determined from multiple datasets)', show_node_names=True, defaults=dict( radius=250, innerRadius=280, outerRadius=295, textSize=7, textOffset=3, ), )

    <iframe
        width="100%"
        height="1000"
        src="outputs//interactions.html"
        frameborder="0"
        allowfullscreen
        &#10;        ></iframe>
    &#10;
[![](examples/outputs//interactions.png)](https://rraadd88.github.io/parag#interpretation-as-a-hypergraph-using-proportion-of-degrees-by-communities)

Neighbourhood analysis in latent space e.g. single cell data

python sc.pl.umap(adata, color="bulk_labels",title='Latent space')

python from parag.core import get_net_data nodes,edges=get_net_data(adata) ## generated network data by measuring distances in the latent space and thresholding

python from parag.hypergraph import to_net cfg,df_=to_net( nodes, edges, col_node_id='cell id', col_source='cell id1', col_target='cell id2', col_subset_id='bulk_labels', show_node_names=False, defaults=dict( textSize=8, textOffset=3, ), )

    <iframe
        width="100%"
        height="1000"
        src="outputs//neighbourhoods.html"
        frameborder="0"
        allowfullscreen
        &#10;        ></iframe>
    &#10;
[![](examples/outputs//neighbourhoods.png)](https://rraadd88.github.io/parag#interpretation-as-a-hypergraph-using-proportion-of-degrees-by-communities)

Heterogeneous graph e.g. drug side-effects network

``` python

filter

nodes=(df02 .loc[:,["Individual Side Effect","Side Effect Name"]] .log.dropduplicates() .assign( #Side Effect type subset=lambda df: df['Side Effect Name'].str.split(' ',expand=True)[0],
) .drop(['Side Effect Name'],axis=1) .groupby('subset').filter(lambda df: len(df)>3 and len(df)<10) .head(5) .sort
values('subset') .log('Individual Side Effect') # id .log('Individual Side Effect') # name ) nodes.head(1) ```

| | Individual Side Effect | subset | |-----|------------------------|------------------| | 1 | C0162830 | Photosensitivity |

python edges=( df02 .log.query(expr=f"`Individual Side Effect` == {nodes['Individual Side Effect'].unique().tolist()}") ) edges.head(1)

| | \# STITCH | Individual Side Effect | Side Effect Name | |-----|--------------|------------------------|---------------------------| | 1 | CID003062316 | C0162830 | Photosensitivity reaction |

``` python

append drugs to nodes

nodes=pd.concat( [ edges.loc[:,['# STITCH']].drop_duplicates().rename(columns={'# STITCH':'node id'},errors='raise').assign(subset='drug'), nodes.rename(columns={'Individual Side Effect':'node id'},errors='raise'), ], axis=0, ) nodes.head(1) ```

| | node id | subset | |-----|--------------|--------| | 1 | CID003062316 | drug |

python from parag.hypergraph import to_net cfg,df_=to_net( nodes, edges, col_node_id='node id', col_source='# STITCH', col_target='Individual Side Effect', col_subset_id='subset', show_node_names=False, defaults=dict( radius=200, innerRadius=205, outerRadius=235, textSize=9, textOffset=3, cornerRadius=3.5, ), )

    <iframe
        width="100%"
        height="1000"
        src="outputs//heterogeneous.html"
        frameborder="0"
        allowfullscreen
        &#10;        ></iframe>
    &#10;
[![](examples/outputs//heterogeneous.png)](https://rraadd88.github.io/parag#interpretation-as-a-hypergraph-using-proportion-of-degrees-by-communities)

Network communities

``` python

Plot graph with colouring based on communities

fig, ax = plt.subplots(1,1, figsize=(5, 3)) visualize_communities(G, communities[3], 2) ```

python nodes=pd.Series({i:list(t) for i,t in enumerate(communities[3])}).explode().to_frame('node id').reset_index().rename(columns={'index':'community id'}).sort_values('community id') nodes.head(1)

| | community id | node id | |-----|--------------|---------| | 0 | 0 | 0 |

python edges=pd.DataFrame(G.edges,columns=['source','target']) edges.head(1)

| | source | target | |-----|--------|--------| | 0 | 0 | 1 |

python from parag.hypergraph import to_net cfg,df_=to_net( nodes.applymap(str), edges.applymap(str), col_node_id='node id', col_source='source', col_target='target', col_subset_id='community id', show_node_names=True, defaults=dict( radius=180, innerRadius=205, outerRadius=235, textSize=17, textOffset=4, cornerRadius=3.5, ), )

    <iframe
        width="100%"
        height="1000"
        src="outputs//communities.html"
        frameborder="0"
        allowfullscreen
        &#10;        ></iframe>
    &#10;
[![](examples/outputs//communities.png)](https://rraadd88.github.io/parag#interpretation-as-a-hypergraph-using-proportion-of-degrees-by-communities)

How to cite?

  1. Using BibTeX:
@software{Dandage_parag,
  title   = {parag: interactive visualization of higher-order graphs in Python},
  author  = {Dandage, Rohan},
  year    = {2024},
  url     = {https://doi.org/10.5281/zenodo.10703097},
  version = {v0.0.1},
  note    = {The URL is a DOI link to the permanent archive of the software.},
}
  1. DOI link: DOI, or

  2. Using citation information from CITATION.CFF file.

Future directions, for which contributions are welcome

  • [ ] Showing degree counts in addition to the percentages
  • [ ] Inferring the defaults e.g. radii from the input data.
  • [ ] Bind rotate signal to the hypergraph and start/endAngle to graph.
  • [ ] Set up tidy layout.
  • [ ] Edge coloring by source and target nodes and setting interactions.
  • [ ] CI for quicker testing use lighter example.
  • [ ] More examples

Owner

  • Login: rraadd88
  • Kind: user

Citation (CITATION.cff)

cff-version: 1.2.0
title: 'parag: interactive visualization of higher-order graphs in Python'
message: If you use this software, please cite it using the metadata from this file.
type: software
authors:
- given-names: Rohan
  family-names: Dandage
  orcid: https://orcid.org/0000-0002-6421-2067
identifiers:
- type: doi
  value: 10.5281/zenodo.10703097
repository-code: https://github.com/rraadd88/parag
version: v0.0.1
date-released: '2024-02-25'

GitHub Events

Total
  • Issues event: 1
  • Watch event: 1
  • Issue comment event: 1
Last Year
  • Issues event: 1
  • Watch event: 1
  • Issue comment event: 1

Committers

Last synced: 6 months ago

All Time
  • Total Commits: 7
  • Total Committers: 2
  • Avg Commits per committer: 3.5
  • Development Distribution Score (DDS): 0.143
Past Year
  • Commits: 2
  • Committers: 2
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.5
Top Committers
Name Email Commits
rraadd88 r****e@g****m 6
prad8 r****8@g****m 1

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • colltoaction (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 9 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
  • Total maintainers: 1
pypi.org: parag

parag: interactive visualization of higher-order graphs in Python

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 9 Last month
Rankings
Dependent packages count: 9.8%
Average: 37.2%
Dependent repos count: 64.7%
Maintainers (1)
Last synced: 4 months ago