This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Load .gb file in R

Hello community, I am trying to load the .gb file I got after blast on ncbi. Tried a few libraries, like "genbankr", "read.gb", but without success.

I got the following error:

library(read.gb)
read.gb("orig_with_blast.gb", DNA = TRUE, Type = "full", Source = "File")
Error in eval(parse(text = Order[i])) : object 'ORGANISM' not found

library(genbankr)
genban <- readGenBank("orig_with_blast.gb")
Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 'seqlevels': unable to find an inherited method for function ‘seqinfo’ for signature ‘"NULL"’

I am an intermediate R user, although am a newbie with such kinds of files. Also, I am not sure how to upload the .gb file here, so you can have a look. The "Posting Guide" does not exist anymore :/ Any help would be appreciated :) Thanks! Milan

EDIT: So, what I am trying to do with this file is to extract the gene predictions, and ID's, which I then intend to use for plotting the up and down-regulated genes (don't ask :D ). So, instead of doing this "by hand" - scrolling through the file, I was thinking of trying to automatize it in a way that I extract all the predictions. So far, I am stuck with data import in R.

load .gb r

BLAST result files are NOT in GenBank format. I assume read.gb refers to a GenBank format file. If you want to parse BLAST output then consider using a tab separated output format like outfmt 6 for BLAST results.

You can post a snipper of your files using pastebin.com since it is likely a large file. Include the link here.

Thank you GenoMax for responding! Well, I've run the blast through NCBI using UGENE software. The output file format is .gb there is no doubt. Why is it exporting as such, and if there is an option for outfmt 6 formats I have no clue? Anyway, I pasted the data to pastebin.com, and here is the link: orig_with_blast.gb

Learned something new. But if you compare the file you have with a GenBank sample record you can see that while the structure is similar it is not identical. As the error above is saying your file is missing essential chunks like SOURCE and ORGANISM fields.

Yes, they are quite similar. I am working with the data from non-model organism so a typical workflow is not an option. Thanks for the help, I appreciate it! Hopefully somebody else would also have a comment, or two :)

Unless UGENE provides code to extract this info you may need to write something custom since most standard software will expect a GenBank format file to follow standard format which your file does not.

0 answers

No answers yet.

Log in to answer this question.