###### required packages
   1. pandas, numpy, collections, scipy, math, statsmodels

###### This pipeline provided three main part
   1. it provides the overview of network properties, including number of nodes, edges, density and degree of the given network. 
   2. it provides the overview of cluster results and ground truth 
   3. it provides the hypergeometric analysis for cluster i versus GO term j
   4. it provides leave one out cross validation prediction

###### command line ###

python main.py -in <Undirected weighted network file> -o <Output name> -ic <cluster file> -ig <GO term file>  -m <minimum cluster size we analyze> -a <significance level alpha> -d <output file directory>

example: python main.py -in Reg-nodup-noloop.txt -o Reg -ig PID_6_10_NEW.csv -n 3 -a 0.001 -ic ./bigclam-result/Reg_325cmtyvv.txt -d Reg_325

## < Undirected weighted network file> 
   1. should be undirected network
   2. should be weighted
   3. file should not have headers
   4. file should be tab delimited
   5. sample file:
		node1	node2	1.0
		node1	node3	0.5

## <Output name>
   1. output name in front of each file
   2. all output files should stay in output folder under environment
   3. example: if we validate for adaptive lasso network, then -o AdaL

## <cluster file>
   1. text file
   2. each line are nodes in a cluster, nodes are tab delimited
   3. line index is the cluster ID
   4. no headers
   5. sample: (cluster 1: node1, node2, node3, cluster 2: node4, node5)
		node1	node2	node3	
		node4	node5

## <GO term file>
   1. should be tab delimited format without headers
   2. sample file: first column geneID, second column GO ID
		GeneID1	GO1
		GeneID2	GO2

## <minimum cluster size we analyze>
   1. the minimum cluster size we treat as meaningful clusters
   2. example: -m 3

## <significance level alpha>
   1. example: -a 0.05


### Output Files ###
1. XX_absOverlap_clusters_go.txt: 
	Absolute overlap between cluster i and GO term j
2. XX_absOverlap_clusters.txt: 
	Absolute overlap between cluster i and cluster j
3. XX_absOverlap_go.txt: 
	Absolute overlap between GO term i and GO term j

4. XX_minOverlap_clusters_go.txt
	Overlap based on min(A, B), for example, if we compare cluster A and GO term B, the value = overlap(A, B)/min(A, B)
5. XX_minOverlap_clusters.txt
	Overlap based on min(A, B), for example, if we compare cluster A and cluster B, the value = overlap(A, B)/min(A, B)
6. XX_minOverlap_go.txt
	Overlap based on min(A, B), for example, if we compare GO term A and GO term B, the value = overlap(A, B)/min(A, B)

7. XX_unionOverlap_clusters_go.txt
	Overlap based on union(A, B), for example, if we compare cluster A and GO term B, the value = overlap(A, B)/union(A, B)
8. XX_unionOverlap_clusters.txt
	Overlap based on union(A, B), for example, if we compare cluster A and cluster B, the value = overlap(A, B)/union(A, B)
9. XX_unionOverlap_go.txt
	Overlap based on union(A, B), for example, if we compare GO term A and GO term B, the value = overlap(A, B)/union(A, B)


10. XX_cluster_size.txt
	size of each cluster, which means the number of genes in each cluster
11. XX_degree.txt
	degree of each node

12. XX_edgelist.txt
	manipulated edgeslist file for Gephi / BigCLAM usage
13. XX_nodelist.txt
	manipulated nodelist file for Gephi / BigCLAM usage

14. XX_enriched.txt
	Included enriched cluster IDs, number of genes in each enriched clusters, number of genes (annotated by at least a GO term) in enriched clusters

15. XX_go_full_size.txt
	All GO term sizes.
16. XX_go_3_size.txt
	GO terms of size greater than 2.
17. XX_gene_GO.txt
	Overview of how many genes are annotated by how many GO terms

18. XX_hypergeom_all_clusters.txt
	Detailed info. of all clusters, for each cluster and each GO term, there is N: the number of genes from network that have known GO term. n: cluster size, m: GO term zie, k: overlap size, p value, q value (corrected p value), precision, recall
19. XX_hypergeom_sig_clusters.txt
	Detailed info. of all significantly enriched clusters, for each cluster and each GO term, there is N: the number of genes from network that have known GO term. n: cluster size, m: GO term zie, k: overlap size, p value, q value (corrected p value), precision, recall
20. XX_sig_allGO_precision.txt
	Precision values of each enriched clusters and GO terms. If a cluster is signnificantly enriched by multiple GO terms, this file shows all of them
21. XX_sig_allGO_recall.txt
	Recall values of each enriched clusters and GO terms. If a cluster is signnificantly enriched by multiple GO terms, this file shows all of them
22. XX_sig_cluster_GO.txt
	Provide GO term names for each enriched clusters
23. XX_sig_precision.txt
	One precision value for each significant enriched cluster, if a cluster is significantly enriched by multiple GO terms, choose the one with smallest p-value
24. XX_sig_recall.txt
	One recall value for each significant enriched cluster, if a cluster is significantly enriched by multiple GO terms, choose the one with smallest p-value

25. XX_gene_GO_asso.txt
	Actually gene-GO associations that is available to us
26. XX_gene_go_pred.txt
	Leave one out (LOO) prediction output, predicted gene-GO associations


Command line:
python Net_dedup.py <input-network-file-name> <output-network-file-name>

<input-network-file-name>: no header, tab delimited, weighted network edgelist
<output-network-file-name>: no header, tab delimited, weighted network edgelist, with duplication removed



