This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Tool to merge two GTFs

My lab is looking to merge our go-to Homo_sapiens.GRCh38.86.gtf GTF with lncRNAKB (http://psychiatry.som.jhmi.edu/lncrnakb/download.php) GTF, but we want to drop anything in the lncRNAKB gtf that completely overlaps or differs by < 25 nts from coordinates in the GRch38 GTF. Is there any tool that can do this (hopefully in R) or is this a manual task?

r gtf

2 answers

Hi,

I developed a tool called isomatch (https://github.com/zhengxinchang/isomatch) that can compare transcripts not only on junction sites but also on TSS / TES. I think this tool is good fit for your purposes.

I would probably avoid doing this fully manually, especially if you care about transcript structure and not just broad genomic overlap.

For a quick coordinate-based filter, bedtools intersect is usually the simplest route. Convert both GTFs to BED-like intervals, then remove lncRNAKB entries that overlap GRCh38 features, adding your 25 nt buffer depending on how strict you want to be.

But if the goal is transcript-level comparison, then tools like AGAT, gffcompare, or the newer isomatch suggestion are more appropriate. Simple overlap can be misleading with lncRNAs because two transcripts may overlap genomically but still have different exon structures, TSS/TES, or strand.

In R, you could also do it with GenomicRanges using findOverlaps() and resize() / flank() style logic for the 25 nt tolerance. That gives you more control, but you’ll need to be very explicit about whether you are comparing genes, transcripts, exons, or full transcript ranges.

So I’d say:

  • if you only mean “remove anything close to existing GRCh38 coordinates”, use bedtools or GenomicRanges
  • if you mean “remove already represented transcript models”, use AGAT/gffcompare/isomatch

The second is usually safer for annotation merging.

Log in to answer this question.