def setUp(self):
        self.text_to_align = """Cell senescence is a process of irreversible arrest of cell proliferation and plays an important role in tumor suppression. Recent studies showed that Wnt inhibition is a trigger of cellular senescence. Using methods of reverse genetics, we recently identified VentX, a human homolog of the vertebrate Xenopus Vent family of homeobox genes, as a novel Wnt repressor and a putative tumor suppressor in lymphocytic leukemia. Here, we show that VentX is a direct transcriptional activator of p53-p21 and p16ink4a-Rb tumor suppression pathways. Ectopic expression of VentX in cancer cells caused an irreversible cell cycle arrest with a typical senescence-like phenotype. Conversely, inhibition of VentX expression by RNA interference ameliorated chemotherapeutic agent-induced senescence in lymphocytic leukemia cells. The results of our study further reveal the mechanisms underlying tumor suppression function of VentX and suggest a role of VentX as a potential target in cancer prevention and treatment."""
        self.no_case_fragment_dict, self.no_case_str_dict = text_aligner.load_alignment_dicts(
        )

        if os.path.exists("alignment_test.csv"):
            os.remove("alignment_test.csv")
def run_alignment_against_csv_file(input_csv_file_name, output_csv_file_name, column_to_align, columns_to_export=[],
                                   table_export_name="", additional_constant_field=None, export_json_file_name=None,
                                   default_data_type="VarChar(255)", additional_list_of_fields_to_index=[]):
    """Run alignment against a CSV file and export to a database"""

    with open(input_csv_file_name, 'rb') as f:
        j = 0
        csv_reader = csv.DictReader(f)

        fragment_dict, exact_dict = text_aligner.load_alignment_dicts()
        text_aligner_obj = text_aligner.TextAligner(fragment_dict, exact_dict)

        tagging_column_list = []
        for column_to_export in columns_to_export:
            tagging_column_list += [(column_to_export, default_data_type)]

        if additional_constant_field is not None:
            tagging_column_list += [(additional_constant_field[0], default_data_type)]

        text_aligner_obj.register_tagging_type(tagging_column_list)


        with open(output_csv_file_name, "wb") as fw:
            i = 0
            for row in csv_reader:
                tagging_values = [row[key] for key in columns_to_export]


                if additional_constant_field is not None:
                    tagging_values += [additional_constant_field[1]]

                if i == 0:
                    csv_writer = csv.writer(fw)
                    csv_writer.writerow(text_aligner_obj.column_headers())

                text_to_align = row[column_to_align].strip()
                if text_to_align != "" and text_to_align is not None:
                    alignment_result = text_aligner_obj.align_text(text_to_align)
                    text_aligner_obj.export_text_alignment_to_csv(alignment_result, fw, tagging_values)
                i += 1

                if i % 100 == 0:
                    print("Aligned %s" % i)
                j += 1

        list_of_fields_to_index = ["fragment", "exact_sui", "sentence_number", "word_number", "fragment_length"]

        complete_list_of_fields_to_index = list_of_fields_to_index + additional_list_of_fields_to_index

        if export_json_file_name is not None:
            add_export_to_json_file(export_json_file_name, table_export_name, output_csv_file_name,
                                    text_aligner_obj.alignment_headers_data_type,
                                    fields_to_index=complete_list_of_fields_to_index)
示例#3
0
def run_alignment_against_csv_file(input_csv_file_name,
                                   output_csv_file_name,
                                   column_to_align,
                                   columns_to_export=[],
                                   table_export_name="",
                                   additional_constant_field=None,
                                   export_json_file_name=None,
                                   default_data_type="VarChar(255)",
                                   additional_list_of_fields_to_index=[]):
    """Run alignment against a CSV file and export to a database"""

    with open(input_csv_file_name, 'rb') as f:
        j = 0
        csv_reader = csv.DictReader(f)

        fragment_dict, exact_dict = text_aligner.load_alignment_dicts()
        text_aligner_obj = text_aligner.TextAligner(fragment_dict, exact_dict)

        tagging_column_list = []
        for column_to_export in columns_to_export:
            tagging_column_list += [(column_to_export, default_data_type)]

        if additional_constant_field is not None:
            tagging_column_list += [(additional_constant_field[0],
                                     default_data_type)]

        text_aligner_obj.register_tagging_type(tagging_column_list)

        with open(output_csv_file_name, "wb") as fw:
            i = 0
            for row in csv_reader:
                tagging_values = [row[key] for key in columns_to_export]

                if additional_constant_field is not None:
                    tagging_values += [additional_constant_field[1]]

                if i == 0:
                    csv_writer = csv.writer(fw)
                    csv_writer.writerow(text_aligner_obj.column_headers())

                text_to_align = row[column_to_align].strip()
                if text_to_align != "" and text_to_align is not None:
                    alignment_result = text_aligner_obj.align_text(
                        text_to_align)
                    text_aligner_obj.export_text_alignment_to_csv(
                        alignment_result, fw, tagging_values)
                i += 1

                if i % 100 == 0:
                    print("Aligned %s" % i)
                j += 1

        list_of_fields_to_index = [
            "fragment", "exact_sui", "sentence_number", "word_number",
            "fragment_length"
        ]

        complete_list_of_fields_to_index = list_of_fields_to_index + additional_list_of_fields_to_index

        if export_json_file_name is not None:
            add_export_to_json_file(
                export_json_file_name,
                table_export_name,
                output_csv_file_name,
                text_aligner_obj.alignment_headers_data_type,
                fields_to_index=complete_list_of_fields_to_index)
    def setUp(self):
        self.text_to_align = """Cell senescence is a process of irreversible arrest of cell proliferation and plays an important role in tumor suppression. Recent studies showed that Wnt inhibition is a trigger of cellular senescence. Using methods of reverse genetics, we recently identified VentX, a human homolog of the vertebrate Xenopus Vent family of homeobox genes, as a novel Wnt repressor and a putative tumor suppressor in lymphocytic leukemia. Here, we show that VentX is a direct transcriptional activator of p53-p21 and p16ink4a-Rb tumor suppression pathways. Ectopic expression of VentX in cancer cells caused an irreversible cell cycle arrest with a typical senescence-like phenotype. Conversely, inhibition of VentX expression by RNA interference ameliorated chemotherapeutic agent-induced senescence in lymphocytic leukemia cells. The results of our study further reveal the mechanisms underlying tumor suppression function of VentX and suggest a role of VentX as a potential target in cancer prevention and treatment."""
        self.no_case_fragment_dict, self.no_case_str_dict = text_aligner.load_alignment_dicts()

        if os.path.exists("alignment_test.csv"):
            os.remove("alignment_test.csv")