Пример #1
0
#from matplotlib_venn import venn3
import networkx as nx
import itertools
import matplotlib.pyplot as plt
from export_downloads import ComppiInterface

# filter to species: -1: disabled, 0 (human), 1 (drosi), 2 (c.elegans), 3 (yeast)
species_filter = -1

# group of custom sources, currently set to protein-protein interaction databases
custom_source_group = ['MINT', 'IntAct', 'MIPS', 'DroID', 'MatrixDB', 'BioGRID', 'HPRD', 'DIP', 'CCSB']
# all proteins from ANY source DB (not intersection, but union!!)
# SELECT COUNT(DISTINCT id) FROM Protein WHERE id IN ( SELECT proteinId FROM ProteinToDatabase WHERE sourceDb IN ('MINT', 'IntAct', 'MIPS', 'MatrixDB', 'DroID', 'BioGRID', 'HPRD', 'HomoMINT', 'DIP', 'CCSB') );

c = ComppiInterface()
comppi_graph = c.buildGlobalComppi()

# filter to species if needed
if species_filter >= 0:
	print("Filtering to species: {}".format(species_filter))
	comppi_graph = c.filterGraph(comppi_graph, None, species_filter)

comppi_number_of_all_nodes = comppi_graph.number_of_nodes()
print("Number of all nodes: {}".format(comppi_number_of_all_nodes))
print()

# collect the proteins per source databases and localizations per source databases
loc_sources = {
	'No Loc Source': []
}
prot_sources = {
Пример #2
0
	required=True,
	help="The radius as an integer, a.k.a. the number of steps into the shady neighborhood.")
main_parser.add_argument(
	'-l',
	'--loc',
	required=True,
	help="The name of the major localization.")
args = main_parser.parse_args()

c = ComppiInterface()

if args.loc not in c.locs:
	raise ValueError("Unknown localization!")

print("Building ComPPI, see the log for details...")
comppi = c.buildGlobalComppi()

print("Building the egograph...")
egograph = c.buildEgoGraph(comppi, args.node_id, args.radius)
print("Egograph: {} nodes, {} edges".format(egograph.number_of_nodes(), egograph.number_of_edges()))

print("Exporting to CSV...")
with open("egograph-n_{}-r_{}.csv".format(args.node_id, args.radius), "w") as fp:
	csvw = csv.writer(fp, delimiter="\t", quoting=csv.QUOTE_MINIMAL)
	
	# header
	csvw.writerow([
		'node_a_id',
		'node_a_name',
		'node_b_id',
		'node_b_name',