code = DEFAULT_OUTPUT_FILENAME

	genes_in_lgn, edges_in_lgn = pl.read_lgn(lgnFilePath)

	list_of_expanded_network_file = pen.merge_different_pc_run(code, pcResultFolder)
	genes_in_tiles, blocks = pen.read_expanded_network(list_of_expanded_network_file)

	# 1st internal validation
	IV = InternalValidation(genes_in_tiles, blocks, genes_in_lgn, edges_in_lgn)

	expansion_list = IV.expansion_list()

    result_filename = os.path.splitext(xml_filename)[0] + ".csv"
    result_filepath = helper.generate_filepath(pcimFolder, result_filename)
    we.write_expansion_list(result_filepath, expansion_list)

    result_PPV_filename = "%s%s" % \
        (os.path.splitext(result_filename)[0], "_PPV.txt")
    result_SE_filename = "%s%s" % \
        (os.path.splitext(result_filename)[0], "_SE.txt")
    result_PPV_filepath = helper.generate_filepath(pcimFolder, result_PPV_filename)
    result_SE_filepath = helper.generate_filepath(pcimFolder, result_SE_filename)
    we.write_statistical_result(result_PPV_filepath, IV.PPV)
    we.write_statistical_result(result_SE_filepath, IV.SE)

	# 2nd internal validation
#	IV2 = InternalValidationRls(genes_in_tiles, blocks, genes_in_lgn, edges_in_lgn)

#	expansion_list_2 = IV2.expansion_list()
#	expansion_filepath = helper.generate_filepath(pcimFolder, code)
    lgn_filepath = helper.generate_filepath(LGN_FOLDER, lgn_filename)
    genes_in_lgn, edges_in_lgn = pl.read_lgn(lgn_filepath)

    list_of_expanded_network_file = pen.merge_different_pc_run(xml_filename,
        PC_RESULT_FOLDER)

    # no expanded network found for this xml file
    # maybe the result will be run at a later time
    if len(list_of_expanded_network_file) == 0:
        continue

    genes_in_tiles, blocks = pen.read_expanded_network(list_of_expanded_network_file)

    print "Internal Validation for %s" % xml_filename
    # 1st internal validation
    IV = InternalValidation(genes_in_tiles, blocks, genes_in_lgn, edges_in_lgn)

    expansion_list = IV.expansion_list()

    expansion_filepath = helper.generate_filepath(PCIM_FOLDER_1, xml_filename)
    we.write_expansion_list(expansion_filepath, expansion_list)

    # 2nd internal validation
    # IV2 = InternalValidationRls(genes_in_tiles, blocks, genes_in_lgn, edges_in_lgn)

    # expansion_list_2 = IV2.expansion_list()
    # expansion_filepath = helper.generate_filepath(PCIM_FOLDER_2, xml_filename)
    # we.write_expansion_list(expansion_filepath, expansion_list_2)