Snippets

Dénes Türei Searching 2 step feedback loops in OmniPath web service data

Created by Dénes Türei
#!/usr/bin/env python

# Denes Turei 2019
# turei.denes@gmail.com

# searching 2 step feedback loop motives in OmniPath
# using the web service data

import urllib.request

# note, this is the core PPI network
# the fully literature curated "OmniPath sensu stricto"
# it is possible to query the enzyme-substrate or the
# transcriptional regulation datasets too:
# url = (
#     'http://omnipathdb.org/interactions?
#     'datasets=omnipath,kinaseextra,tfregulons,mirnatarget'
# )
url = 'http://omnipathdb.org/interactions'

records = [
    tuple(l.decode('ascii').strip().split('\t'))
    for l in
    urllib.request.urlopen(url).readlines()
][1:]

stimulation = {
    (rec[0], rec[1])
    for rec in records
    if rec[3] == '1'
}

inhibition = {
    (rec[0], rec[1])
    for rec in records
    if rec[4] == '1'
}

stimulation_rev = {tuple(reversed(s)) for s in stimulation}
inhibition_rev = {tuple(reversed(i)) for i in inhibition}

dual_negative = (
    (stimulation & inhibition_rev) |
    (inhibition & stimulation_rev)
)

dual_positive_1 = stimulation & stimulation_rev
dual_positive_2 = inhibition & inhibition_rev


len(dual_negative) # 426
len(dual_positive_1) # 818
len(dual_positive_2) # 154

Comments (1)

  1. Linda Melson
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.