Пример #1
0
def load_data(path, file_dict):
	all_dbs = os.listdir(path)
	assert(set(all_filenames.values()).issubset(set(all_dbs)))
	db = LiteDB()
	all_keynames = {}
	read_keynames = set()
	for read_tracename, read_filename in all_filenames.iteritems():
		db.load(os.path.join(path, read_filename))
		read_keyname = set(db.keys()).difference(read_keynames).pop()
		all_keynames.__setitem__(read_tracename, read_keyname)
		read_keynames.add(read_keyname)
	return(db, all_keynames)
		print ("outputFile: %s" % outputFile)
		print ("dataName: %s" % dataName)
		print ("enableVerbose: %s" % enableVerbose)
		print ("heteNames: %s" % heteNames)
		print ("asDirected: %s" % asDirected)

	if outputFile is not None:
		outputDir = os.path.dirname(outputFile)
		if outputDir and not (os.path.exists(outputDir)):
			os.makedirs(outputDir)
	else:
		print ("There is no output")

	db = LiteDB()
	if os.path.exists(outputFile) and enable_appendant:
		db.load(outputFile)
	
	for f in inputFile: 
		print ("processing %s" % f)
		if not os.path.exists(f): next

		if inputFileType == 'gpickle':		# a graph
			g = nx.read_gpickle(file(f, "r"))
		elif inputFileType == 'edgelist':	# edgelist
			g = nx.read_edgelist(f, nodetype = int, create_using = nx.DiGraph()) if asDirected else nx.read_edgelist(f, nodetype = int, create_using = nx.Graph())
		elif inputFileType == 'cpickle':	# a list of graphs
			g = cPickle.load(file(f, "r"))

		graphs = list()

		if heteNames: