for key in temp_locus_description:
        if locus_description.has_key(key):
            locus_description[key] = chain(locus_description[key], temp_locus_description[key])
        else:
            locus_description[key] = temp_locus_description[key]

    return locus_description

def write_locus_description(locus_description):
    output_file = open("translation_analysis.txt", "w")
    for key in locus_description:
        for description in locus_description[key]:
            line = chain([key], description.strip().split("\t"))
            # pdb.set_trace()
            output_file.write('\t'.join(map(str, line)))
            output_file.write('\n')

    output_file.close()

"""
args[0]: Known gene network (LGN)
args[1]: path to folder of output file
"""
if __name__ == '__main__':
    print "# loading not translated locus..."
    file_name = "not_translated_locus.csv"
    not_translated_locus = cf.read_node_unweighted(file_name)

    print "# locus - probe translationg analysis"
    translation_analysis(list(not_translated_locus), "affy_ATH1_array_elements-2010-12-20.txt")
    epilog = """
    This program gave general information for graph network
    """

    # parse options:
    parser = MyParser(usage, description=description,epilog=epilog)
    parser.add_option("-d", "--delimiter", dest="delimiter", default="\t",
                      help="delimiter of input & output files [default: tab]")

    (options, args) = parser.parse_args()
    if len(args) != 2:
        parser.error("incorrect number of arguments")
    delimiter = options.delimiter
    if delimiter == '\\t':
        delimiter = '\t'


    print "# loading network from edgelist..."
    basename = os.path.splitext(args[0])[0]

    LGN = cf.read_node_unweighted(args[0])
    expansion_lists = read_result_from_one_iteration(args[1], delimiter=delimiter)
    probes_from_expansion = merge_nodes_from_expansion_lists(expansion_lists)
    G = frequency_computation(expansion_lists)
    write_frequency(G)
    subLGNs = create_list_subLGN(D, SIZE_OF_SUBLGN, LGN)

    internal_assessment(probes_from_expansion, LGN, subLGNs, G, D)