Create count matrix from multible quant sf files from different directories
1
0
Entering edit mode
JG13 • 0
@eeb93914
Last seen 7 days ago
Greece

Hi, i have multiple quant.sf files in different directories with names SRX1022857, SRX1022858, SRX1022859 etc

files <- list.files(pattern = "SRX")
> files
 [1] "SRX1022857" "SRX1022858" "SRX1022859" "SRX1022860" "SRX1022861" "SRX1022862" "SRX1022863" "SRX1022864" "SRX1022865" "SRX1022866" "SRX1022867"
[12] "SRX1022868" "SRX1022869" "SRX1022870" "SRX1022871" "SRX1022872" "SRX1022873" "SRX1022874" "SRX1022875" "SRX1022876" "SRX1022877" "SRX1022878"
[23] "SRX1022879" "SRX1022880" "SRX1022881" "SRX1022882" "SRX1022883" "SRX1022884" "SRX1022885" "SRX1022886" "SRX1022887" "SRX1022888" "SRX1022889"
[34] "SRX1022890" "SRX1022891" "SRX1022892" "SRX1022893" "SRX1022894" "SRX1022895" "SRX1022896" "SRX1022897" "SRX1022898" "SRX1022899" "SRX1022900"
[45] "SRX1022901" "SRX1022902" "SRX1022903" "SRX1022904" "SRX1022905" "SRX1022906" "SRX1022907" "SRX1022908" "SRX1022909" "SRX1022910" "SRX1022911"
[56] "SRX1022912" "SRX1022913" "SRX1022914" "SRX1022915" "SRX1022916" "SRX1022917" "SRX1022918" "SRX1022919" "SRX1022920" "SRX1022921" "SRX1022922"
[67] "SRX1022923" "SRX1022924" "SRX1022925" "SRX1022926" "SRX1022927" "SRX1022928" "SRX1022929"

How can I use library(tximport) to create a count matrix for all of them?

tximportData tximport salmon • 312 views
ADD COMMENT
0
Entering edit mode
@mikelove
Last seen 13 hours ago
United States

With Bioconductor software, start by checking out the vignette first. You can find this either on the website or from within your R session:

  • Go to package landing page, then go down to "Documentation" and look for an HTML vignette (for my software I have HTML output)
  • Run the command browseVignettes("package-name")
ADD COMMENT
0
Entering edit mode

each SRX* is a directory and inside this directory there is a quant.sf file with the same name. I am confused how to use the files in order to import the names for each sample and the number of reads with tximport to create a count matrix. In previous case I used quant.sf but from the same directory like that

files <- list.files(pattern = "\\.sf$")
names(files) <- paste0("quant", 19:24)
all(file.exists(files))

But I am wondering how to import them if I am in a directory called salmon and inside this there are all SRX1022857.... folders I do

library(tximportData)
dir <- system.file("salmon_res", package="tximportData")
list.files(dir)

But it doesn't list anything although that inside salmon_res there are all directories with SRX10*

ADD REPLY
0
Entering edit mode
fls <- dir("^SRX[0-9]+$", "quant.sf", full.names = TRUE)

Edited to add a missing quote

ADD REPLY
0
Entering edit mode

i tried it but this also returns character(0).But I managed to do it in a different way I specify the dir manually , list the files , provide a csv with the names of each directory and specify the files and then use the tximport

dir2 <- "/Desktop/_pipeline"
list.files(dir2)
samples <- read.table(file.path(dir2, "sampleshee.csv"), sep=",", header = TRUE)
samples
samples$sampleID
files <- file.path(dir2, "salmon_res", samples$sampleID, "quant.sf")
all(file.exists(files))
txi.inf.rep <- tximport(files, type = "salmon", txOut = TRUE)
ADD REPLY

Login before adding your answer.

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