Error when trying to import GTF files using rtracklayer's import function
0
0
Entering edit mode
3.8 years ago
Marcel • 0

I'm trying to use rtracklayer's import function to import a GTF file. I downloaded the current comprehensive genome annotation for human from GENCODE, gunzipped the .gz file and tried the following:

library(rtracklayer)
granges <-import("gencode.v36.annotation.gtf")

I am getting the following error:

Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'con' in selecting a method for function 'import': invalid class “GFF2File” object: undefined class for slot "resource" ("characterORconnection")

Also, adding the parameter format="gtf" does not make a difference.

When searching for this on the web, I'm only getting results regarding a tool called IsoformSwitchAnalyzeR where the authors recommended updating their software. But I'm neither using their tool, nor is it even installed on my PC.

For now, I am importing the GTF files manually, but I would like to use rtracklayer's import function. I hope, someone can help.

annotation rtracklayer software error • 4.7k views
ADD COMMENT
0
Entering edit mode

What happens with rtracklayer::import("gencode.v36.annotation.gtf")?

ADD REPLY
0
Entering edit mode

I'm getting exactly the same error as before.

ADD REPLY
0
Entering edit mode

What version of rtracklayer are you using? sessionInfo().

Also, annotation files such as GTFs are generally stored as TxDb objects in R, so depending on your downstream analysis you could use GenomicFeatures::makeTxDbFromGFF.

ADD REPLY
0
Entering edit mode

It says rtracklayer_1.48.0

Thanks for your suggestion. As I said, I am able to load these files manually, so I'm not really in need of another workaround, I'd just like rtracklayer to be working.

ADD REPLY
0
Entering edit mode

Having the same problem, have you managed to use "import"?

ADD REPLY
1
Entering edit mode

Adding this here in case it helps somebody - in my case the GTF itself was not formatted correctly. The problem disappeared when fixed the format.

ADD REPLY
0
Entering edit mode

Please do not add answers unless you're answering the top-level question. Use Add Comment or Add Reply instead. Your post has been moved to a comment this time.

ADD REPLY
0
Entering edit mode

getting the same issue, did you ever solve the problem?

ADD REPLY
0
Entering edit mode

Format issue, you can try AGAT to sanitaze your file. I guess agat_convert_sp_gff2gtf.pl will do the job even if you provide a GTF as input. Be stringent to keep only official features e.g. GTF v2.5: --gtf_version 2.5

ADD REPLY
0
Entering edit mode

I used read.table and read.lines to see what was wrong with the file.

ADD REPLY
0
Entering edit mode

It this file downloaded from somewhere or was it manipulated before trying to read it? You can try downloading from GENCODE (any of their GTFs) and see whether this works. If not then it is some software-based thing, else it is something with your file.

ADD REPLY
0
Entering edit mode

I haven't tried since then. I'll try again in a few days, when I'll be analyzing my next RNA-seq data.

ADD REPLY

Login before adding your answer.

Traffic: 1644 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6