arendsee / rhmmer

Simple R utilities for working with HMMER

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

help reading tblout

NataliHB opened this issue · comments

Hi,
I am trying to parse some tblout files using:

tblout <- system.file('extdata', 'Actibacterium_FB_281118_bin.2.tblout', package='rhmmer')
read_tblout(tblout)

However I keep getting this error:
Error: '' does not exist in current working directory ('/Users/user/Desktop/Hydrocarbon/04.Hydrocarbons'

I double checked and the .tblout files are all in that directory so I don't really understand the error. Sorry If this is too basic, but do you have any advise?

Many thanks!
Natali

Hi @NataliHB, rhmmer is not my package, but I just wrote this blurb for another project so thought this might be helpful for you:

Explanation about accessing external files packaged with (R packages)
Specifying paths to data files packaged with an R package is a bit ugly…it takes advantage of the base R function system.file and information about the package to derive the file paths. While this is helpful because it allows anyone to access the files in a package no matter where the package is installed on their computer, the syntax can be confusing because the example ends up looking a lot different than the code you would actually write. Whenever you see system.file() in this vignette, know that when you go to run similar code on your own files, you need to specify the path to your file to run the command without all of the accompanying system.file() code. See an example below:

# how we have to specify paths so that anyone can access the package data
fpath <- system.file("extdata", "SRR5947006.sig.gz", package="sourmashconsumr")
signature_df <- read_signature(fpath)

# how you will specify a path when you actually run the code
signature_df <- read_signature("path/to/your_signature_file.sig")

so for you, I think that would be:

read_tblout("Actibacterium_FB_281118_bin.2.tblout")

Thanks @talorreiter! Let me know if you want me to reopen if issue Natali.