##Load graph into memory g = new TinkerGraph() g.loadGraphSON('/Users/lom/Downloads/graph.json')
##Find all activities g.V('concreteType', 'activity').name nActivities = g.V('concreteType', 'activity').count()
from bs4 import BeautifulSoup | |
from urllib.request import urlopen, HTTPError | |
import string | |
import time | |
import random | |
url = 'https://www.mayoclinic.org/diseases-conditions/index?letter=%s' | |
output = 'diseases.txt' | |
fp = open(output,'w') |
import synapseclient | |
import synapsebridgehelpers as sb | |
FILTER_QUERY = "SELECT distinct healthCode FROM syn7841519 where substudyMemberships like '%Cirrhosis_pilot%'" | |
ORIG_PROJECT = 'syn7838471' | |
DESTINATION_PROJECT = 'syn18589808' | |
TABLE_MAPPING = {'syn7841519': 'syn18632063'} | |
syn = synapseclient.login() |
import pandas as pd | |
import bridgeclient | |
import synapseclient | |
from multiprocessing.dummy import Pool | |
from synapseutils.monitor import with_progress_bar | |
mp = Pool(4) | |
bridge = bridgeclient.bridgeConnector(<email>, <password>, study='journey-pro') | |
syn = synapseclient.login() |
import synapseclient | |
import pandas as pd | |
from multiprocessing.dummy import Pool | |
def with_progress_bar(func, totalCalls, prefix = '', postfix='', isBytes=False): | |
"""Adds a progress bar to calls to func | |
:param func: Function being wrapped with progress Bar | |
:param totalCalls: total number of items/bytes when completed | |
:param prefix: String printed before progress bar |
import synapseclient | |
syn=synapseclient.Synapse() | |
syn.login() | |
def determineNewSampleCount(): | |
""" | |
""" | |
table = syn.tableQuery('SELECT * FROM syn3281840') | |
df = table.asDataFrame() |
import sys | |
import synapseclient | |
syn=synapseclient.Synapse() | |
syn.login(silent=True) | |
md5 = sys.argv[1] | |
files = syn.restGET('/entity/md5/%s' % md5) | |
for f in files['results']: |
import pandas as pd | |
import json | |
graph = json.load(open('graph.json')) | |
df = pd.DataFrame(graph['vertices']) | |
df.to_csv('vertices.csv') |
##Load graph into memory g = new TinkerGraph() g.loadGraphSON('/Users/lom/Downloads/graph.json')
##Find all activities g.V('concreteType', 'activity').name nActivities = g.V('concreteType', 'activity').count()
"""Get permalink to git commit for a specific path. | |
""" | |
import os | |
import ConfigParser | |
import github | |
def getToken(cfgfile="~/.pygit"): | |
"""Authenticate using a token. |
ids = [i['file.id'] for i in syn.chunkedQuery('select id from file where parentId=="syn5521815"')] | |
for i in ids: | |
e = syn.get(i, downloadFile=False) | |
e.properties.fileNameOverride = e.name | |
syn.store(e, forceVersion=False) |