Git Product home page Git Product logo

network-motif's Introduction

This is the documentation for the FinalMotif.py module:

FinalMotif.py Functions:

Overview: FinalMotif.py is essentially a wrapper for a simple C++ program (Kavosh) for calculating the total number of motifs in a given graph. Kavosh takes in an edge list of the graph and ouputs a txt file with the number of each motif found. We used cPickle to store the raw data as a python dictionary. Since the runtime of this code increases exponentially with motif size, I created a cache directory that stores the motif results in the json format.

MotifData:
	This class contains the motif data for a set of graphs. It is the returned value for the findMotifs() function. It is basically a wrapper for a list of dictionaries. Each element in the list is represents 1 patient and the dictionary maps motif ID to the number of that motif found in the graph. It contains various access functions to iterate through or retrieve various motif data.

makeSwapData(degree=10):
	This crates a pkl file that contains the graphs of the original data after undergoing edge swapping
	"degree" is the average degree you want to threshold the graph with.
	
buildCache(motifSize, degree):
	This function builds the cache of both original graphs and edge-swapped ones for faster processing in future runs of findMotifs
	"motifSize" is the size of the motif you want to calculate.
	"degree" is the average degree you want to threshold the graph with.

findMotifs(data,key,motifSize=3,degree=10,randGraphs=None, useCache=True):
	This is the main motif finding routine.
	"data" is a dictionary of all the graph data.
	"key" is the key into the dictionary for which you want to run findMotifs on.
	"motifSize" is the size of the motif you want to calculate.
	"degree" is the average degree you want to threshold the graph with.
	"randGraphs" is an optional argument that can be set to random set of random graph data to be used instead of the data from the "data" argument.
	"useCache" if True, looks first in the cache when running this function to see if the result has already been computed. If not, it computes the motifs and saves the results in the cache for late use.
	This function returns a MotifData object containing all the results

convertIDToGraph(mid, motifSize, save=False):
	This function draws a graph of the given motif ID
	"mid" is the motif ID you want to draw
	"motifSize" is the size of the motif for the ID
	"save" if true saves the picture in png format. If false, just displays a picture of the graph


plotMotifGraphs(data,motifSize=3,degree=10,numofmotifs=10,usetotal=False):
	This function plots a pyplot graph of the data


PDFstats(data, filename, edgeSwap=False, motifSize=3, degree=10):
	Creates a latex document of the T-test data for the motif distribution probabilities
	"filename" name of outputfile
	"edgeSwap" is whether to use edge swapped graphs for the RAND group.
	"motifSize" is the size of the motif you want to calculate.
	"degree" is the average degree you want to threshold the graph with.

PDFdiststats(data, filename, edgeSwap=False, motifSize=3, degree=10):
	Same as above except it creates a latex document of the T-test data

network-motif's People

Contributors

gtremper avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.