Question: Error message when trying to use the 'Align' function of the 'Rsubread' package
gravatar for thomas.dobrenel
2.4 years ago by
thomas.dobrenel0 wrote:

Macintosh; Intel Mac OS X 10_10_5

Rstudio Version 0.99.903

R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"


Dear colleagues,

I tried to use the 'Rsubread' package for doing an alignment between my RNAseq data and the index of the genome I just created and I have an error message (see below). I first thought that there was something wrong with the index I created but it seems that the error is most likely caused by the reading of the files. I double-checked and the names of the files are exactly identical to the names in the table and are located in the appropriate folder and I also tried to change the name of the FASTQ documents both in the .fastq and in the .txt but this didn't help. Could somebody help me to figure out what can be the cause of this problem and how to solve it? I thank you in advance.

> targets=read.delim("run_info2.txt",header=T)
> targets
                                       FileName CellType Status Type
1 P4355_125_TCTCGCGC-TATAGCCT_L001_R1_001.fastq       PM   DMSO Ctrl
2 P4355_126_TCTCGCGC-ATAGAGGC_L001_R1_001.fastq       PM    AZD Down
3 P4355_127_TCTCGCGC-CCTATCCT_L001_R1_001.fastq    White   DMSO Ctrl
4 P4355_128_TCTCGCGC-GGCTCTGA_L001_R1_001.fastq    White    AZD Down
5 P4355_129_GAATTCGT-AGGCGAAG_L001_R1_001.fastq    White   EtOH Ctrl
6 P4355_130_CTGAAGCT-AGGCGAAG_L001_R1_001.fastq    White   Estr Ctrl
7 P4355_131_TAATGCGC-AGGCGAAG_L001_R1_001.fastq    TOROE   EtOH Ctrl
8 P4355_132_CGGCTATG-AGGCGAAG_L001_R1_001.fastq    TOROE   Estr   Up
> output.files=sub('.fastq','.bam',targets$FileName)
> align('mm10',readfile1=targets$FileName,phredOffset=33,input_format='FASTQ',output_file = output.files)
Error in file.exists(readfile1) : invalid 'file' argument
ADD COMMENTlink modified 2.4 years ago by Gordon Smyth35k • written 2.4 years ago by thomas.dobrenel0
gravatar for Gordon Smyth
2.4 years ago by
Gordon Smyth35k
Walter and Eliza Hall Institute of Medical Research, Melbourne, Australia
Gordon Smyth35k wrote:

As Axel has guessed, the problem is that read.delim() has converted your filenames into a factor, and file.exists() will not accept a factor argument. Try this instead:

targets <- read.delim("run_info2.txt", stringsAsFactors=FALSE)
output.files <- sub('.fastq','.bam',targets$FileName)
align('mm10',readfile1=targets$FileName,phredOffset=33,input_format='FASTQ',output_file = output.files)
ADD COMMENTlink modified 2.4 years ago • written 2.4 years ago by Gordon Smyth35k


Indeed, you were right, targets$FileName was a factor and not a character and, as such, it couldn't run properly.

I then changed the code you gave me and it worked (well, actually, Rstudio finally crashed but at least, it initiated something that I didn't have before).

Thank you very much to both of you


ADD REPLYlink written 2.4 years ago by thomas.dobrenel0

It may help to run it in an ordinary R session instead of in Rstudio.

ADD REPLYlink modified 2.4 years ago • written 2.4 years ago by Gordon Smyth35k
gravatar for Axel Klenk
2.4 years ago by
Axel Klenk920
Axel Klenk920 wrote:

Dear Thomas,

hmm, just an idea -- are you sure that targets$FileName is a character, not a factor?

What does str(targets) say about this?

As the error message claims the problem is with file.exists -- what's the result of




 - axel

ADD COMMENTlink written 2.4 years ago by Axel Klenk920
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 394 users visited in the last hour