def getCommandLineArgs(): if len(sys.argv) < 2: print( "Usage: python3 deform.py [/absolute/path/to/input_file.txt (containing paths edge files)] \nExiting..\n" ) sys.exit() return util.cleanPaths(realp(sys.argv[1]))
def getCommandLineArgs(): if len(sys.argv) < 2: myprint( "Usage: python3 extract_nodes.py [/absolute/path/to/input.txt containing paths to edge files]\nExiting..\n" ) sys.exit() assert os.path.isfile(str(sys.argv[1])) return util.cleanPaths(str(sys.argv[1]))
def getCommandLineArgs(): if len(sys.argv) < 2: print( "Usage: python3 max_degree.py [/absolute/path/to/configs/edge_fil.txt]\nExiting..\n" ) sys.exit() assert os.path.isfile(str(sys.argv[1])) return util.cleanPaths(str(sys.argv[1]))
def getCommandLineArgs(): if len(sys.argv) < 2: print( "Usage: python3 extract_largest_component.py [/absolute/path/to/input_file.txt]\nEach line in input file should be [True/False] [/path/to/edge/file] where True/False means to randomize edges or not (if the network is undirected, set it to True)\nExiting..\n" ) sys.exit() assert os.path.isfile(str(sys.argv[1])) return util.cleanPaths(str(sys.argv[1]))
def getCommandLineArgs(): if len(sys.argv) < 2: print( "Usage: python3 in_pairs_scaling.py [/absolute/path/to/network/file.txt]\nExiting..\n" ) sys.exit() clean_lines = util.cleanPaths(sys.argv[1]) TITLES = [L.split()[0].strip() for L in clean_lines] NETS = [L.split()[1].strip() for L in clean_lines] return TITLES, NETS
def getCommandLineArgs(): paths = None try: assert len(sys.argv) == 2 except: print( "Usage: python3 NH_NL_analogs.py [/absolute/path/to/configs/input.txt] (containing paths to edge files)\nExiting..\n" ) sys.exit(1) paths = util.cleanPaths(sys.argv[1]) try: for p in paths: assert os.path.isfile(p) return paths except: print("Encountered invalid files, check your input \nExiting..\n") sys.exit(1)
likely_interactors, colors, sizes = get_likely_interactors(M) ax = fig.add_subplot(rows, cols, pos) xlabel, ylabel = "Degree of source node", "Degree of target node" if pos==1: xlabel ="" ax = scatter_v1(likely_interactors, colors, sizes, ax, "", fig, xlabel, ylabel, log) pos+=1 save_figure(output_file_name) print ('Done') sys.exit(1) ################################################################## if __name__ == "__main__": update_rcParams() output_file_name, clean_titles = [], [] input_lines = util.cleanPaths (getCommandLineArgs()) network_files = [] for line in input_lines: clean_titles.append( line.split()[:-1][0] ) network_files.append(line.split()[-1]) output_file_name.append(line.split('/')[-1].split('.')[0]) output_file_name = '_'.join(output_file_name) #v1(network_files, clean_titles, output_file_name) # call this if you wanna plot the old way, using add_plots instead of add_axes fig_inch_dims = ((10*len(network_files), 10*len(network_files))) cols = 1 rows = len(network_files) w2h_ratio=0.7
'Spectral':[(0.88535179460749902, 0.31903114388970766, 0.29042677143040824), (0.98731257284388818, 0.64736641446749377, 0.36424452942960406), (0.99715494057711429, 0.91180315789054422, 0.60107653281267948), (0.92887351442785826, 0.97154940577114335, 0.63806230531019326), (0.6334486913447287, 0.85213380350786094, 0.64367553065804872), (0.28004614044638243, 0.6269896416103139, 0.70242216306574201)], } return colors ###################################################### def getCommandLineArgs(): if len(sys.argv) < 2: print ("Usage: python3 degree.py [/absolute/path/to/input_file.txt]\nExiting..\n") sys.exit() return str(sys.argv[1]) ###################################################### if __name__ == "__main__": update_rcParams() H, i,maxd = [], 0,0 INPUT = getCommandLineArgs() input_files = util.cleanPaths (INPUT) colors = ['#fc0000', '#fc8900', '#fcfc00', '#76fc00', '#01911b', '#00d9dc', '#3d4cff', '#b119fd', '#fc099c','black','orange'] #colors = ['#4000ff','#00bfff','#ff0080', '#ffb3d9'] watermark = [] xoffset, yoffset = [],0 for line in input_files: title = ' '.join(line.split()[:-1]).replace('-',' ').replace('Human ENCODE','ENCODE') network_file = line.split()[-1] watermark.append( network_file.split('/')[-1].split('_')[0]) #M = init.load_network ({'network_file':network_file.strip(), 'biased':False}, undirected=False, quite=False) #M = init.load_network ({'network_file':network_file.strip(), 'biased':False}, undirected=True, quite=False) #nx.write_gpickle(M,'dumps/'+network_file.split('/')[-1].split('.')[0]+'.dump') M = nx.read_gpickle(network_file) #with open (network_file,'' print (title.ljust(20,' ')+"nodes "+str(len(M.nodes())).ljust(6,' ')+" edges "+str(len(M.edges())))
'06BD_criteria': ['source'], #,'both','target'], '07KP_solver_source': ['$lib/kp_solvers/DPsolver.c' ], #[slash(os.getenv('SOLVERS_DIRECTORY'))+'DPsolver.c'], #'07KP_solver_source' : [slash(os.getenv('SOLVERS_DIRECTORY'))+'minknap.c'], '08KP_solver_binary': ['$SCRATCH/DPsolver.so'], #[slash(os.getenv('SCRATCH'))+'DPsolver.so'], #'08KP_solver_binary' : [slash(os.getenv('SCRATCH'))+'minknap.so'], '09output_directory': ['$SCRATCH'], #[slash(os.getenv('SCRATCH'))], '10advice_upon': ['nodes', 'edges'], #['nodes','edges'], '11biased': [True, False], #[False,True], '12alpha': [0.2] } edge_files = [] try: edge_files = util.cleanPaths( sys.argv[1]) #open (sys.argv[1], 'r').readlines() except: print( "Usage: python generator_v4.py [absolute path to input file (containing paths to edge files)]" ) for f in edge_files: if f.strip()[0] == '#': continue tmp = settings['09output_directory'] settings['13network_file'] = [ f.split('\n')[0].replace(slash(os.getenv('data')), '$data/') ] settings['14network_name'] = [f.split('/')[-1].split('.')[0]] settings['09output_directory'] = [ slash(settings['09output_directory'][0]) +