Entering edit mode
4.6 years ago
Manuel Mendoza
▴
10
Hi folks,
I've created a function that generates a gene sequence and now I wanna concatenate n
genes together. I've tried reiterative adding using a for loop
but at the ned, al subfeatures of genes n > 1
were lost...
>>> gene_a = sim_gene(n_exons = 3)
>>> gene_b = sim_gene(n_exons = 2)
>>> genes = gene_a + gene_b
>>> with open('genes.gff', "w") as out_handle:
... GFF.write([genes], out_handle)
The output if the followign:
##gff-version 3
##sequence-region SimSeq 1 38054
SimSeq sim gene 1 21056 . + . ID=Gene_0
SimSeq sim exon 1125 3249 . + . Parent=Gene_0
SimSeq sim exon 5514 11139 . + . Parent=Gene_0
SimSeq sim exon 13618 16410 . + . Parent=Gene_0
SimSeq sim gene 42113 59110 . + . ID=Gene_1
And it should be this:
##gff-version 3
##sequence-region SimSeq 1 36058
SimSeq sim gene 1 21056 . + . ID=Gene_0
SimSeq sim exon 1125 3249 . + . Parent=Gene_0
SimSeq sim exon 5514 11139 . + . Parent=Gene_0
SimSeq sim exon 13618 16410 . + . Parent=Gene_0
SimSeq sim gene 21057 38054 . + . ID=Gene_1
SimSeq sim exon 23948 25492 . + . Parent=Gene_1
SimSeq sim exon 29648 36058 . + . Parent=Gene_1
If I export each gene generate independently, and then join the different gff it works but it's not smart at all...