Ejemplo n.º 1
0
    def _create_gtf_from_transcripts(self,
                                     gtf_path,
                                     exons_by_transcript,
                                     genes=None,
                                     strands=None):
        gtf = tests.gtf.GTF()
        gtf.path = gtf_path

        transcripts = list()
        for i, exons_for_transcript in enumerate(exons_by_transcript):
            transcript = tests.gtf.Transcript()
            transcript.chromosome = '1'
            strand_i = '+'
            if strands is not None:
                strand_i = strands[i]

            transcript.strand = strand_i
            gene_i = 1
            if genes is not None:
                gene_i = genes[i]

            transcript.gene_id = tests.util.gene_id_str(gene_i)
            transcript.gene_name = tests.util.gene_name_str(gene_i)
            transcript.transcript_id = tests.util.transcript_id_str(i)
            transcript.exons = exons_for_transcript
            transcripts.append(transcript)

        gtf.transcripts = transcripts
        error = gtf.write()
        self.assertFalse(error)
        return gtf
Ejemplo n.º 2
0
 def _create_gtf(self, gtf_path):
     gtf = tests.gtf.GTF()
     gtf.path = gtf_path
     transcript_1 = tests.gtf.Transcript()
     transcript_1.chromosome = '1'
     transcript_1.strand = '+'
     transcript_1.gene_id = tests.util.gene_id_str(1)
     transcript_1.gene_name = tests.util.gene_name_str(1)
     transcript_1.transcript_id = tests.util.transcript_id_str(1)
     transcript_1.exons = [(1, 100), (201, 300), (401, 500)]
     gtf.transcripts = [transcript_1]
     error = gtf.write()
     self.assertFalse(error)
     return gtf
Ejemplo n.º 3
0
    def _create_gtf_from_transcripts(self, gtf_path, exons_by_transcript):
        gtf = tests.gtf.GTF()
        gtf.path = gtf_path

        transcripts = list()
        for i, exons_for_transcript in enumerate(exons_by_transcript):
            transcript = tests.gtf.Transcript()
            transcript.chromosome = '1'
            transcript.strand = '+'
            transcript.gene_id = tests.util.gene_id_str(1)
            transcript.gene_name = tests.util.gene_name_str(1)
            transcript.transcript_id = tests.util.transcript_id_str(i)
            transcript.exons = exons_for_transcript
            transcripts.append(transcript)

        gtf.transcripts = transcripts
        error = gtf.write()
        self.assertFalse(error)
        return gtf