Commit 0ab056cf authored by Chaos's avatar Chaos
Browse files

modified gtf.R in R

parent 2f63c575
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -13,11 +13,13 @@ chaos_anno <- function(organism,type = NA){

gtf <-	function(
			organism,
			type = NA
			type = NA,
			gtf_file = NA
){
	ref <- chaos_anno(organism,"ref")
	anno_v <- chaos_anno(organism,"anno_v")

	if(is.na(gtf_file)){
		gtf_file <- paste0(
						"~/Reference/",
						ref,
@@ -25,6 +27,7 @@ gtf <- function(
						anno_v,
						".annotation.gtf.gz"
		)
	}

	type.list <- c("gene","transcript","exon","CDS","start_codon","stop_codon","UTR","Selenocysteine")
	type <- type %>% .[. %in% type.list]
@@ -49,10 +52,12 @@ gtf <- function(
				)

	if(file.exists(rds_file)){
		print(paste0(rds_file," exists, reading file"))
		readRDS(rds_file)
	}else{
		gtf <- BiocIO::import(gtf_file,feature.type = type)
		saveRDS(gtf,rds_file,compress = "xz")
		print(paste0(rds_file," saved"))
		gtf
	}
}
 No newline at end of file