コード例 #1
0
    def setUp(self, rename_func=None):
        self.tmp_files = list()

        self.ref_len_file = StringIO(TRANSCRIPT_LENGTHS)
        self.annotation_file = StringIO(TRANSCRIPT_ANNOTATION)
        self.alignment_file_1 = StringIO(READ_SET_1)
        self.alignment_file_2 = StringIO(READ_SET_2)

        self.handle = h5py.File(BytesIO(), "w")
        self.handle_2 = h5py.File(BytesIO(), "w")

        create.create_ribo(ribo=self.handle,
                           experiment_name="merzifon",
                           alignment_file=self.alignment_file_1,
                           reference_name="hg38",
                           lengths_file=self.ref_len_file,
                           annotation_file=self.annotation_file,
                           metagene_radius=METAGENE_RADIUS,
                           left_span=LEFT_SPAN,
                           right_span=RIGHT_SPAN,
                           length_min=2,
                           length_max=5,
                           store_coverage=False,
                           nprocess=NPROCESS,
                           tmp_file_prefix="")
        self.ref_len_file.seek(0)
        self.annotation_file.seek(0)
        self.alignment_file_1 = StringIO(READ_SET_1)

        set_metadata(self.handle, "merzifon", METADATA_EXPERIMENT_DICT)

        create.create_ribo(ribo=self.handle_2,
                           experiment_name="ankara",
                           alignment_file=self.alignment_file_2,
                           reference_name="hg38",
                           lengths_file=self.ref_len_file,
                           annotation_file=self.annotation_file,
                           metagene_radius=METAGENE_RADIUS,
                           left_span=LEFT_SPAN,
                           right_span=RIGHT_SPAN,
                           length_min=2,
                           length_max=5,
                           store_coverage=True,
                           nprocess=NPROCESS,
                           tmp_file_prefix="")
        self.ref_len_file.seek(0)
        self.annotation_file.seek(0)
        self.alignment_file_2 = StringIO(READ_SET_2)

        self.merged_io = BytesIO()
        self.merged_ribo = h5py.File(self.merged_io, "w")
        merge_ribos(self.merged_ribo, [self.handle, self.handle_2])
        set_metadata(self.merged_ribo, name=None, metadata=RIBO_METADATA_STR_1)
        self.merged_ribo.close()

        self.sample_ribo = Ribo(self.merged_io, alias=rename_func)
コード例 #2
0
    def setUp(self):
        self.tmp_files = list()

        self.ref_len_file = StringIO(TRANSCRIPT_LENGTHS)
        self.annotation_file = StringIO(TRANSCRIPT_ANNOTATION)
        self.alignment_file_1 = StringIO(READ_SET_1)
        self.alignment_file_2 = StringIO(READ_SET_2)
        self.in_ref_len_file = StringIO(INCOMPATIBLE_TRANSCRIPT_LENGTHS)
        self.in_annotation_file = StringIO(INCOMPATIBLE_TRANSCRIPT_ANNOTATION)

        self.handle = h5py.File(BytesIO(), "w")
        self.handle_2 = h5py.File(BytesIO(), "w")

        create.create_ribo(ribo=self.handle,
                           experiment_name="merzifon",
                           alignment_file=self.alignment_file_1,
                           reference_name="hg38",
                           lengths_file=self.ref_len_file,
                           annotation_file=self.annotation_file,
                           metagene_radius=METAGENE_RADIUS,
                           left_span=LEFT_SPAN,
                           right_span=RIGHT_SPAN,
                           length_min=2,
                           length_max=5,
                           nprocess=NPROCESS,
                           tmp_file_prefix="")
        self.ref_len_file.seek(0)
        self.annotation_file.seek(0)
        self.alignment_file_1 = StringIO(READ_SET_1)

        create.create_ribo(ribo=self.handle_2,
                           experiment_name="ankara",
                           alignment_file=self.alignment_file_2,
                           reference_name="hg38",
                           lengths_file=self.ref_len_file,
                           annotation_file=self.annotation_file,
                           metagene_radius=METAGENE_RADIUS,
                           left_span=LEFT_SPAN,
                           right_span=RIGHT_SPAN,
                           length_min=2,
                           length_max=5,
                           nprocess=NPROCESS,
                           tmp_file_prefix="")
        self.ref_len_file.seek(0)
        self.annotation_file.seek(0)
        self.alignment_file_2 = StringIO(READ_SET_2)

        self.merged_ribo = h5py.File(BytesIO(), "w")
        merge_ribos(self.merged_ribo, [self.handle, self.handle_2])
コード例 #3
0
    def setUp(self):
        self.ref_len_file = StringIO(TRANSCRIPT_LENGTHS)
        self.annotation_file = StringIO(TRANSCRIPT_ANNOTATION)
        self.alignment_file = StringIO(READ_SET_1)
        self.alignment_file_2 = StringIO(READ_SET_2)
        self.tsv_1 = StringIO(rnaseq_data.RNASEQ_tsv_1)
        self.tsv_2 = StringIO(rnaseq_data.RNASEQ_tsv_2)
        self.tsv_3 = StringIO(rnaseq_data.RNASEQ_tsv_3)

        self.handle = h5py.File(BytesIO(), "w")
        self.handle_2 = h5py.File(BytesIO(), "w")

        self.rnaseq_reads_handle = StringIO(rnaseq_data.RNASEQ_READS)
        self.rnaseq_reads_handle_2 = StringIO(rnaseq_data.RNASEQ_READS_2)

        create.create_ribo(self.handle,
                           "merzifon",
                           alignment_file=self.alignment_file,
                           reference_name="appris_human_v2",
                           length_min=2,
                           length_max=5,
                           metagene_radius=METAGENE_RADIUS,
                           left_span=LEFT_SPAN,
                           right_span=RIGHT_SPAN,
                           lengths_file=self.ref_len_file,
                           store_coverage=True,
                           annotation_file=self.annotation_file)

        self.ref_len_file.seek(0)
        self.annotation_file.seek(0)

        create.create_ribo(self.handle_2,
                           "adana",
                           alignment_file=self.alignment_file_2,
                           reference_name="appris_human_v2",
                           length_min=2,
                           length_max=5,
                           metagene_radius=METAGENE_RADIUS,
                           left_span=LEFT_SPAN,
                           right_span=RIGHT_SPAN,
                           lengths_file=self.ref_len_file,
                           store_coverage=True,
                           annotation_file=self.annotation_file)

        self.merged_ribo = h5py.File(BytesIO(), "w")
        merge_ribos(self.merged_ribo, [self.handle, self.handle_2])
コード例 #4
0
    def test_merge_incompatible_reference(self):
        handle_incompatible = h5py.File(BytesIO(), "w")
        ribo_out = h5py.File(BytesIO(), "w")

        create.create_ribo(
            ribo=handle_incompatible,
            experiment_name="izmir",
            alignment_file=self.alignment_file_2,
            reference_name="hg38",
            lengths_file=self.in_ref_len_file,  # incomp lens
            annotation_file=self.in_annotation_file,  # incomp annot.
            metagene_radius=METAGENE_RADIUS,
            left_span=LEFT_SPAN,
            right_span=RIGHT_SPAN,
            length_min=2,
            length_max=5,
            nprocess=NPROCESS,
            tmp_file_prefix="")

        with self.assertRaises(ValueError):
            merge_ribos(ribo_out,
                        [self.handle, self.handle_2, handle_incompatible])
コード例 #5
0
    def test_merge_single_ribo(self):
        single_merged = h5py.File(BytesIO(), "w")

        merge_ribos(single_merged, [self.handle])

        self.assertTrue("merzifon" in get_experiment_names(single_merged))