I am trying to make a fasta file of reduced exon sequences (collapse all isoforms of a gene into one transcript). I'm running into a problem where exons on the negative strand are listed in ascending order based on chromosome coordinates, but this results in the exon sequences being written in the wrong order. I've tried several methods to re-order the negative strand elements, but they were all running very slow. What would be the best way to do this?
library('BSgenome.Mmusculus.UCSC.mm10') library('GenomicFeatures') genome <- BSgenome.Mmusculus.UCSC.mm10 gencode <- makeTxDbFromGFF('~/Downloads/gencode.vM8.basic.annotation.gtf') exonAll <- exonsBy(gencode, by='gene') exonAll2 <- reduce(exonAll) seqs <- extractTranscriptSeqs(genome, exonAll2) writeXStringSet(seqs, '~/Desktop/basic.fa')