Esempio n. 1
0
def main():
    from hpf.superfunc.go import read_file, output_matrix, output_sparse_matrix
    print "Reading MGI IDs ({0}) and GO terms ({1}) for matrix creation".format(args.mgi_file, args.go_file)
    mgi_ids  = read_file(args.mgi_file)
    go_terms = read_file(args.go_file)

    print "Creating annotation matrix against database {0}".format(args.database)
    annotation_matrix = build_annotation_matrix(mgi_ids, go_terms, args.database)

    print "Writing annotation matrix to file {0}".format(args.outfile)
    if args.store_sparse:
        output_sparse_matrix(annotation_matrix, args.outfile, val=1)
    else:
        output_matrix(annotation_matrix, args.outfile)
Esempio n. 2
0
def main():
    from hpf.superfunc.go import read_file, output_matrix, output_sparse_matrix
    print "Reading GO terms from infile {0}".format(args.go_file)
    go_terms = read_file(args.go_file)
    
    if args.type == "parent":
        print "Building parent matrix against database {0}".format(args.database)
        result_matrix = build_parent_matrix(go_terms, args.database)
    elif args.type == "common_parent":
        print "Building common parents matrix against database {0}".format(args.database)
        result_matrix = build_common_parent_matrix(go_terms, args.database)

    print "Writing parent matrix to file {0}".format(args.outfile)
    if args.store_sparse:
        output_sparse_matrix(result_matrix, args.outfile, val=1)
    else:
        output_matrix(result_matrix, args.outfile)