tximport for gene level summarization of 9 quant.sf files
0
0
Entering edit mode
6 months ago
Cody • 0

I am trying to summarize quant.sf files from 9 samples. I am trying to follow this vignette (https://bioconductor.org/packages/devel/bioc/vignettes/tximport/inst/doc/tximport.html).

My quant.sf files are in 9 different sample files in a directory named 'Salmon'.

I created a vector of file names by:

> samples <- read.table(file.path(dir, "samples.txt"), header = TRUE)
> samples
                          files group_name names
1 sample_1_S1_R1_001.trim.fastq        Air Air_1
2 sample_2_S2_R1_001.trim.fastq        Air Air_2
3 sample_3_S3_R1_001.trim.fastq        Air Air_3
4 sample_4_S4_R1_001.trim.fastq    O3_24hr  24_1
5 sample_5_S5_R1_001.trim.fastq    O3_24hr  24_2
6 sample_6_S6_R1_001.trim.fastq    O3_24hr  24_3
7 sample_7_S7_R1_001.trim.fastq    O3_72hr  72_1
8 sample_8_S8_R1_001.trim.fastq    O3_72hr  72_2
9 sample_9_S9_R1_001.trim.fastq    O3_72hr  72_3

I tried pointing to the files by:

> files <- c("/scratch/lcs152/transcripts_quant/salmon/sample_1_S1_R1_001.trim.fastq/quant.sf", "/scratch/lcs152/transcripts_quant/salmon/sample_2_S2_R1_001.trim.fastq/quant.sf", "/scratch/lcs152/transcripts_quant/salmon/sample_3_S3_R1_001.trim.fastq/quant.sf", "/scratch/lcs152/transcripts_quant/salmon/sample_4_S4_R1_001.trim.fastq/quant.sf", "/scratch/lcs152/transcripts_quant/salmon/sample_5_S5_R1_001.trim.fastq/quant.sf", "/scratch/lcs152/transcripts_quant/salmon/sample_6_S6_R1_001.trim.fastq/quant.sf", "/scratch/lcs152/transcripts_quant/salmon/sample_7_S7_R1_001.trim.fastq/quant.sf", "/scratch/lcs152/transcripts_quant/salmon/sample_8_S8_R1_001.trim.fastq/quant.sf", "/scratch/lcs152/transcripts_quant/salmon/sample_9_S9_R1_001.trim.fastq/quant.sf")

Then adding names by:

>names(files) <- paste0(samples$name)

Then I checked to see the files were named properly:

> files
                                                                            Air_1 
"/scratch/lcs152/transcripts_quant/salmon/sample_1_S1_R1_001.trim.fastq/quant.sf" 
                                                                            Air_2 
"/scratch/lcs152/transcripts_quant/salmon/sample_2_S2_R1_001.trim.fastq/quant.sf" 
                                                                            Air_3 
"/scratch/lcs152/transcripts_quant/salmon/sample_3_S3_R1_001.trim.fastq/quant.sf" 
                                                                             24_1 
"/scratch/lcs152/transcripts_quant/salmon/sample_4_S4_R1_001.trim.fastq/quant.sf" 
                                                                             24_2 
"/scratch/lcs152/transcripts_quant/salmon/sample_5_S5_R1_001.trim.fastq/quant.sf" 
                                                                             24_3 
"/scratch/lcs152/transcripts_quant/salmon/sample_6_S6_R1_001.trim.fastq/quant.sf" 
                                                                             72_1 
"/scratch/lcs152/transcripts_quant/salmon/sample_7_S7_R1_001.trim.fastq/quant.sf" 
                                                                             72_2 
"/scratch/lcs152/transcripts_quant/salmon/sample_8_S8_R1_001.trim.fastq/quant.sf" 
                                                                             72_3 
"/scratch/lcs152/transcripts_quant/salmon/sample_9_S9_R1_001.trim.fastq/quant.sf"

But when I check to see if they exist, it tells me they don't:

> all(file.exists(files))
[1] FALSE

I'm very much a novice and not sure if the information I've provided is helpful. Any guidance would be appreciated!

salmon tximport rna-seq • 307 views
ADD COMMENT
0
Entering edit mode

You may want to completely automate the file list creation using list.files() and apply:

## Code untested, may need changes
dir_list <- list.files("/scratch/lcs152/transcripts_quant/salmon/", pattern="*trim.fastq")
file_list <- sapply(dir_list, list.files, pattern="quant.sf")
file_list <- setNames(x = file_list, samples$name)
ADD REPLY
0
Entering edit mode

Do not delete posts that have received feedback.

ADD REPLY

Login before adding your answer.

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