This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Clutering Using Mcl Algorithm

I have a network of around 1000 nodes and 3 million edges. I have used the mcl software to break it up into clusters. MCL :loading a file

I have used the following command:

mcl blue_v1.txt -I 1.8 --abc -o blue_v2.mcl

This gives a file in ".mcl" format. I am not able to figure out the clusters in this file. How do I get in a tab delimited file or something that can be read into Cytoscape.

Thanks

clustering network

Can you open this file in notepad++?

1 answer

As far as I remember, the mcl output reports on each line all the proteins present in a cluster. There is no interaction here, so if you want to load it in Cytoscape to have to build back the network. Here is an example of python script I used time ago in order to do that, it takes in input the mcl output file and the original network file and create one network file for each cluster:

import sys 
import string

cluster_filename=sys.argv[1]
network_filename=sys.argv[2]


interactions=[]

# read interactions 
num_interactions=0
with open(network_filename) as in_handle:
    for line in in_handle:
        parts=line.strip().split("\t")
        ac1=parts[0]
        ac2=parts[1]
        interactions.append(ac1+"#"+ac2)
        interactions.append(ac2+"#"+ac1)
        num_interactions=num_interactions+1

print "%s interactions" % (num_interactions)

cluster=0

with open(cluster_filename) as in_handle:
    for line in in_handle:
        cluster = cluster+1
        acs=line.strip().split("\t")
        print "number of proteins: %s" % (len(acs))
        if len(acs) > 2:
            output=open(cluster_filename+ "." + str(cluster) + ".network.txt" ,  "w")

            i = 0
            while i < len(acs) :
                j=i
                while j < len(acs):
                    if acs[i] + "#" + acs[j] in interactions:
                        output.write(acs[i] + "\t" + acs[j] + "\n")
                    j=j+1
                i=i+1

            output.close()

Log in to answer this question.