error in file(file, "rt") when reading in sample sheet using DESeqDataSetFromHTSeqCount
1
0
Entering edit mode
Yihan • 0
@8e03f28b
Last seen 2.6 years ago
United States

When I tried to read in the sample sheet (txt file) as a table using DESeqDataSetFromHTSeqCount, I got an error message: Error in file(file, "rt") : cannot open the connection.

# Read in sample sheet and append sample name as row labels
# Args:
#   input.file: a .txt samplesheet
#
# Returns:
#   table: a data table

ReadTable <- function(input.file) {
  table <- read.table(input.file, header=T, sep="\t")
  rownames(table) <- table$SampleName
  return(table)
}


sampleTable <- ReadTable("sample_sheet_copy.txt")
sampletable_med <- subset(sampleTable, Tissue == "med")
sampletable_cerv <- subset(sampleTable, Tissue == "cerv")

# load in the count data to produce a count matrix
# directory is path to directory where the counts are stored (one per sample)
# design is how we wish to model the data: here we are measuring differences by genotype

ddsHTSeq <- DESeqDataSetFromHTSeqCount(sampleTable = sampleTable,
                                       directory = "counts_4thcol",
                                       design = ~ 1)

counts_4thcol is a folder containing reads per gene in out.tab format, for example:

Xkr4 944

Gm39585 1

Gm38717 2

Rp1 0

Sox17 338 ...

Sample sheet is in a txt file like the following:

SampleName FileName Genotype Age Tissue

E1061-med_S4_merged E1061-med_S4_merged_counts.txt mdx 12m med ...

DESeq2 • 1.6k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 14 minutes ago
United States

R is telling you that the file doesn't exist in your current working directory. Here's an example:

> read.table("this_file_does_not_exist.txt")
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'this_file_does_not_exist.txt': No such file or directory

So you either mis-typed the file name, are in the wrong working directory, or the file just doesn't exist.

ADD COMMENT
0
Entering edit mode

Thank you very much!

ADD REPLY

Login before adding your answer.

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