Error message when trying to use the 'Align' function of the 'Rsubread' package
2
0
Entering edit mode
@thomasdobrenel-9981
Last seen 7.7 years ago

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
rsubread rnaseq alignment • 1.5k views
ADD COMMENT
2
Entering edit mode
@gordon-smyth
Last seen 9 hours ago
WEHI, Melbourne, Australia

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 COMMENT
0
Entering edit mode

Hello,

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

Tom

ADD REPLY
0
Entering edit mode

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

ADD REPLY
1
Entering edit mode
Axel Klenk ▴ 990
@axel-klenk-3224
Last seen 7 hours ago
UPF, Barcelona, Spain

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

file.exists(targets$FileName)

?

Cheers,

 - axel

ADD COMMENT

Login before adding your answer.

Traffic: 878 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