Ejemplo n.º 1
0
def main():
    parser = argparse.ArgumentParser(
        description = (" Agglomerative Hierarchical Cluster Implementation "),
    )
    
    # args
    parser.add_argument("--exp-file", required=True, help="Expression Matrix / TSV file")
    parser.add_argument("--clust-type", default="S", choices=["S", "C", "A"], help="Type of clustering")
    parser.add_argument("-k", type=int, help="Number of clusters", default=2)
    opts = parser.parse_args()

    (annotations, expression) = read_exp_data(opts.exp_file)
    
    # report some stuff
    log.info("Loaded expression/annotations for %i genes", len(annotations))
    clusterObj = Cluster(expression, annotations)
    print clusterObj.cluster(opts.clust_type, opts.k)
Ejemplo n.º 2
0
 def testAverageTwo(self):
     clusterObj = Cluster(self.expression, self.annotations)
     results = read_results("./test/key/avg-2.out")
     clusters = clusterObj.cluster("A",2)
     self.assertEqual(results, clusters)
Ejemplo n.º 3
0
 def testCompleteSix(self):
     clusterObj = Cluster(self.expression, self.annotations)
     results = read_results("./test/key/complete-6.out")
     clusters = clusterObj.cluster("C",6)
     self.assertEqual(results, clusters)
Ejemplo n.º 4
0
 def testSingleSix(self):
     clusterObj = Cluster(self.expression, self.annotations)
     results = read_results("./test/key/single-6.out")
     clusters = clusterObj.cluster("S",6)
     self.assertEqual(results, clusters)