So I have a list of several thousand RNA transcripts, and I am trying to find out how they are spliced. Right now I am running matchLRpatterns() from the Biostrings package with a max gap length of 0, after running a matchpattern function to categorize the transcripts by donor sites (where the first cut in an RNA transcript is made to cut out introns). But applying that to several thousand transcripts is quite time consuming, when you have 5 donor sequences to match to 9 acceptor sequences in 100 nucleotide long transcripts. Instead, I am thinking to sort by donor, remove all that comes before the splice junction by converting it to a string then using gsub, then using matchpattern again, but I only want to check the first 8 nucleotides after the splice junction for the consensus sequence that follows my list of acceptor sites. If I just run matchpattern without shortening the length of the transcript, I will just find acceptor sites in the RNA transcript, not the acceptor site at the splice junction.

I was thinking lapply the gsub function to the transcripts to remove up to the splice junction, then lapply the strsplit function to make a list of lists of groups of 1 character strings, lapply the head function to get the first 8 single character strings in each list, lapply the paste function to make them one string again, lapply the DNAString function to make the sequences readable by matchpattern, then lapply the matchpattern function to check the acceptor sequence at the splice junction. Is there a better way? This feels a bit clunky and roundabout way of doing it. I know gsub can remove characters after a certain character or sequence of characters, but I am not sure what the first sequence in each transcript is at the splice junction. Can I still use gsub, but tell it to remove characters after a certain number of characters? Or better yet, is there a way to get matchpattern to only check the first x nucleotides in a sequence?

  • 3
    $\begingroup$ Please edit your question and include i) an example of your input data, ii) the output you would want from that data and iii) the code you are currently using so we don't reinvent the wheel. $\endgroup$ – terdon Jul 6 '19 at 12:42
  • 1
    $\begingroup$ I suggest you follow @terdon suggestion to increase the likelihood of receiving help. The task you are referring to in the title can be easily achieved via the following: smallx<-substr(x, start, stop) $\endgroup$ – Fabio Marroni Jul 6 '19 at 14:13

Is there any particular reason why you want to do this via pattern matching in R? This sounds like something that SuperTranscripts and Lace might be useful for:


Finally, Lace will annotate each superTranscript with blocks either by using the graph structure itself or alternatively using a script called Mobius (packaged with Lace) which infers the annotation from spliced junctions discovered when mapping reads to the superTranscript.

  • $\begingroup$ I was unaware of the existence of Lace and SuperTranscripts. My mentor in the lab I just started in wanted me to write code in R to help organize his Illumina reads for his research. I can ask him if he has heard of it, and if he would consider using it. $\endgroup$ – Joe Kowzun Jul 6 '19 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.