I have been running through the bioconductor introduction to ballgown and hit a snag in loading up the .ctab files using the method described therin.
https://www.bioconductor.org/packages/devel/bioc/vignettes/ballgown/inst/doc/ballgown.html
The instructions suggest that if you store your data in a file structure like so:
Ballgowndata
sample1_folder
e2t.ctab
e_data.ctab
i2t.ctab
i_data.ctab
t_data.ctab
sample2_folder
e2t.ctab
e_data.ctab
i2t.ctab
i_data.ctab
t_data.ctab
etc...
you should be able to load it using the dataDir function and a regular expression by which it matches your sample folders: Specifically it suggests creating a file Load.r
library(ballgown)
data_directory = system.file('extdata', package='ballgown')
bg = ballgown(dataDir=data_directory, samplePattern='sample', meas='all')
save(bg, file='bg.rda')
and then using this script through the command line
R CMD BATCH load.R
I have done this very thing for the sample data provided with ballgown and it works, but when i try to use this method with my own data, which is stored in a folder with the following path
/Users/mylapple/Desktop/test_reads_folder_output/ballgown_inputs/sample_SRR446038.bam/
and structure:
ballgown_inputs
sample_SRR446038.bam
e2t.ctab
e_data.ctab
i2t.ctab
i_data.ctab
t_data.ctab
sample_SRR446039.bam
e2t.ctab
e_data.ctab
i2t.ctab
i_data.ctab
t_data.ctab
sample_SRR446040.bam
e2t.ctab
e_data.ctab
i2t.ctab
i_data.ctab
t_data.ctab
Etc...
It gives me an error output:
> library(ballgown)
Attaching package: ‘ballgown’
The following object is masked from ‘package:base’:
structure
> data_directory = system.file('ballgown_inputs', package='ballgown')
> bg = ballgown(dataDir=data_directory, samplePattern='sample', meas='all')
Mon Mar 4 16:45:48 2019
Mon Mar 4 16:45:48 2019: Reading linking tables
Error in file(file, "rt") : invalid 'description' argument
Calls: ballgown -> read.table -> file
Execution halted
From what little I've been able to find on the web this error seems to pretain to the inability to find the right path to the data. But I am unsure why that would be. It was my understanding that this dataDir function would search for the correct files, and it certainly worked with the toy dataset ballgown comes with. So why wont it work with mine?
Id greatly appreciate any light you could shed on this matter.
data_directory = system.file('ballgown_inputs', package='ballgown')
is only valid for the example files. You have to specify the path to the directory with the ballgown folders.data_directory = system.file(Users/mylapple/Desktop/test_reads_folder_output/ballgown_inputs, package = 'ballgown') ??
No, you need
list.dirs
. Please spend some quality time on R basics.system.file()
is only used to load dummy data from packages, which is why you specify thepackage=xxx
parameter.list.dirs("/path/to/the/folder/that/contains/the/ballgowns")
Good advice. I will be sure to do so.