Commit 1c4091dd authored by Chaos's avatar Chaos
Browse files

modified RNA-seq.R in R

parent 2441de0f
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -7,13 +7,16 @@ rnaseq123 <- function(

	if(tolower(count_type) == "star"){
		cols <- c(1, 2)
		header_str <- TRUE
		header_str <- FALSE
		skip_rows <- 4
	}else if(tolower(count_type) == "featurecounts")
	{
	}else if(tolower(count_type) == "featurecounts"){
		cols <- c(1, 7)
		header_str <- FALSE
		skip_rows <- 1
	}else if(tolower(count_type) == "salmon"){
		cols <- c(1,5)
		header_str <- TRUE
		skip_rows <- 0
	}

	x <-	readDGE(
@@ -30,10 +33,18 @@ rnaseq123 <- function(

	x$samples$group <- group

	if(count_type %in% c("star","featurecounts")){
		gtf_info <- gtf(organism,"gene") %>% 
					as.data.table() %>% 
				.[,.(gene_id,gene_name,type,chr = seqnames,start,end,strand)] |>
					.[,.(gene_id,gene_name,type = gene_type,chr = seqnames,start,end,strand)] |>
					setkey(gene_id,gene_name)
	}else if(count_type == "salmon"){
		gtf_info <- 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)
	}


	## it will take few minutes to load the gtf_file
	## filter the unneeded rows