Commit ef54e49b authored by fc-ibb105's avatar fc-ibb105
Browse files

modified RNA-seq.R in R

parent ff9ece64
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -105,8 +105,9 @@ c.rnaseq <- function(
		
	}

	if(is.null(dge_list)){
	ct <- tolower(count_type)

	if(is.null(dge_list)){
		if(ct == "star"){
			cols <- c(1, 2)
			header_str <- FALSE
@@ -119,6 +120,10 @@ c.rnaseq <- function(
			cols <- c(1,5)
			header_str <- TRUE
			skip_rows <- 0
		}else if(ct == "tcga"){
			cols <- c(1,4)
			header_str <- FALSE
			skip_rows <- 6
		}

		x <-	readDGE(
@@ -134,16 +139,21 @@ c.rnaseq <- function(
	x$samples$group <- group

	if(is.null(gtf_dt)){
		if(count_type %in% c("star","featurecounts")){
		if(ct %in% c("star","featurecounts")){
			gtf_dt <-	c.gtf(organism,"gene") %>% 
						as.data.table() %>% 
						.[,.(gene_id,gene_name,type = gene_type,chr = seqnames,start,end,strand)] |>
						setkey(gene_id,gene_name)
		}else if(count_type == "salmon"){
		}else if(ct == "salmon"){
			gtf_dt <-	c.gtf(organism,"transcript") %>% 
						as.data.table() %>% 
						.[,.(gene_id = transcript_id,gene_name = transcript_name,type = transcript_type,chr = seqnames,start,end,strand)] |>
						setkey(gene_id,gene_name)
		}else if(ct == "tcga"){
			gtf_dt <-	lapply(dir(),\(x){fread(x)[!1:4,.(gene_id,gene_name,type = gene_type)]}) |> 
						rbindlist() |> 
						unique() |> 
						setkey(gene_id,gene_name)
		}
	}