改写后读⼊数据
stop("Directory provided does not exist")
drillmyhole}
barcode.loc <- file.path(run, paste(prefix,'barcodes.',suffix,p=''))
gene.loc <- file.path(run, paste(prefix,'genes.',suffix,p=''))
六级分数线是425吗
features.loc <- file.path(run, paste(prefix,'features.',suffix,'.gz',p=''))
if( ists(file.path(run,paste(prefix,'',p='')))){matrix.loc <- file.path(run,prefix,paste(prefix,'',p=''))}el{matrix.loc <- file.path(run,paste(prefix,'mtx',s # Flag to indicate if this data is from CellRanger >= 3.0
pre_ver_3 <- ists(gene.loc)
if (!pre_ver_3) {
addgz <- function(s) {
acome
return(paste0(s, ".gz"))
}
barcode.loc <- addgz(s = barcode.loc)
matrix.loc <- addgz(s = matrix.loc)
}
小学英语面试if (!ists(barcode.loc)) {
stop("Barcode file missing. Expecting ", baname(path = barcode.loc))
}
if (!pre_ver_3 && !ists(features.loc) ) {
stop("Gene name or features file missing. Expecting ", baname(path = features.loc))
}
if (!ists(matrix.loc)) {
print(matrix.loc)
stop("Expression matrix file missing. Expecting ", baname(path = matrix.loc))
}
data <- readMM(file = matrix.loc)
cell.names <- readLines(barcode.loc)
if(!dim(data)[2]==length(cell.names)){data <- t(readMM(file = matrix.loc))}###这是与cellranger输出结果最⼤的不同
if (all(grepl(pattern = "\\-1$", x = cell.names)) & strip.suffix) {
cell.names <- as.vector(x = as.character(x = sapply(
X = cell.names,
FUN = ExtractField,
field = 1,
delim = "-"
)))
}
if (is.null(x = names(x = data.dir))) {
if (i < 2) {
colnames(x = data) <- cell.names
} el {
colnames(x = data) <- paste0(i, "_", cell.names)
}
} el {
绯闻女孩第一季土豆colnames(x = data) <- paste0(names(x = data.dir)[i], "_", cell.names)
}
feature.names <- read.delim(
file = ifel(test = pre_ver_3, yes = gene.loc, no = features.loc),
header = FALSE,
stringsAsFactors = FALSE
)
if (any(is.na(x = feature.names[, lumn]))) {
西华大学是几本warning(喝彩的意思
'Some features names are NA. Replacing NA names with ID from the opposite column requested',
call. = FALSE,
abimmediate. = TRUE
)
na.features <- which(x = is.na(x = feature.names[, lumn]))豆腐渣工程的意思
feature.names[na.features, lumn] <- feature.names[na.features, lumn]
}
if (unique.features) {
fcols = ncol(x = feature.names)
if (fcols < lumn) {
stop(paste0("lumn was t to ", lumn,
" but (or genes.tsv) only has ", fcols, " columns.",
" Try tting lumn argument to a value <= to ", fcols, "."))
}
rownames(x = data) <- make.unique(names = feature.names[, lumn])
}
faq是什么意思# In cell ranger 3.0, a third column specifying the type of data was added
# and we will return each type of data as a parate matrix
if (ncol(x = feature.names) > 2) {
data_types <- factor(x = feature.names$V3)
lvls <- levels(x = data_types)