R script problem
1
0
Entering edit mode
fernanro • 0
@fernanro-13882
Last seen 6.6 years ago

I am following a protocol for running DESeq2 and get an error message in collapsing the initial table (sri) to one row per sample. The command is the following:

>  for(i in seq_len(nrow(samples))) {rw = (sri$LibraryName == samples$LibraryName[i]) if (samples$LibraryLayout[i] == "PAIRED") { samples$fastq1[i] = paste0(sri$Run[rw],"_1.fastq",collapse=",") samples$fastq2[i] = paste0(sri$Run[rw],"_2.fastq",collapse=",") } else { samples$fastq1[i] = paste0(sri$Run[rw],".fastq",collapse=",") samples$fastq2[i] = "" }

The error message is in the 'if' argument:

Error: unexpected 'if' in "for(i in seq_len(nrow(samples))) {rw = (sri$LibraryName == samples$LibraryName[i]) if"

I don't know much about R language so any help would be wellcome. 

Fernando

 

R rnaseq bioconductor • 566 views
ADD COMMENT
0
Entering edit mode

hi,

This code isn't from DESeq2 materials, so I'm taking off the DESeq2 tag, and renaming to "R script problem"

ADD REPLY
0
Entering edit mode
@james-w-macdonald-5106
Last seen 1 hour ago
United States

You need to make sure that your parentheses match. You would be well served to use something like Rstudio to do your coding, as it would have pointed out the mismatched parentheses in the code you present.

That said, this isn't a Bioconductor question, but instead is a basic R question, and you should post that sort of thing on R-help (r-help@r-project.org) or StackOverflow.

 

ADD COMMENT

Login before adding your answer.

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