@@ -10,8 +10,8 @@ library(tximport)
1010# Parsing command line arguments
1111args <- commandArgs(trailingOnly = TRUE )
1212if (length(args ) < 4 ) {
13- stop(" Usage: tximport.r <coldata_path> <path> <prefix> <quant_type> <tx2gene_path>" ,
14- call. = FALSE )
13+ stop(" Usage: tximport.r <coldata_path> <path> <prefix> <quant_type> <tx2gene_path>" ,
14+ call. = FALSE )
1515}
1616
1717# Assigning command line arguments to variables
@@ -21,7 +21,7 @@ prefix <- args[3]
2121quant_type <- args [4 ]
2222tx2gene_path <- args [5 ]
2323
24- # # Functions
24+ # # Functions
2525
2626# Build a table from a SummarizedExperiment object
2727build_table <- function (se.obj , slot ) {
@@ -31,7 +31,7 @@ build_table <- function(se.obj, slot) {
3131# Write a table to a file with given parameters
3232write_se_table <- function (params ) {
3333 file_name <- paste0(prefix , " ." , params $ suffix )
34- write.table(build_table(params $ obj , params $ slot ), file_name ,
34+ write.table(build_table(params $ obj , params $ slot ), file_name ,
3535 sep = " \t " , quote = FALSE , row.names = FALSE )
3636}
3737
@@ -40,9 +40,9 @@ read_transcript_info <- function(tinfo_path){
4040 info <- file.info(tinfo_path )
4141 if (info $ size == 0 ) {
4242 stop(" tx2gene file is empty" )
43- }
43+ }
4444
45- transcript_info <- read.csv(tinfo_path , sep = " \t " , header = FALSE ,
45+ transcript_info <- read.csv(tinfo_path , sep = " \t " , header = FALSE ,
4646 col.names = c(" tx" , " gene_id" , " gene_name" ))
4747
4848 extra <- setdiff(rownames(txi [[1 ]]), as.character(transcript_info [[" tx" ]]))
@@ -51,8 +51,8 @@ read_transcript_info <- function(tinfo_path){
5151 rownames(transcript_info ) <- transcript_info [[" tx" ]]
5252
5353 list (transcript = transcript_info ,
54- gene = unique(transcript_info [,2 : 3 ]),
55- tx2gene = transcript_info [,1 : 2 ])
54+ gene = unique(transcript_info [,2 : 3 ]),
55+ tx2gene = transcript_info [,1 : 2 ])
5656}
5757
5858# Read and process sample/column data from a given path
@@ -71,8 +71,8 @@ read_coldata <- function(coldata_path){
7171# Create a SummarizedExperiment object with given data
7272create_summarized_experiment <- function (counts , abundance , length , col_data , row_data ) {
7373 SummarizedExperiment(assays = list (counts = counts , abundance = abundance , length = length ),
74- colData = col_data ,
75- rowData = row_data )
74+ colData = col_data ,
75+ rowData = row_data )
7676}
7777
7878# Main script starts here
@@ -93,7 +93,7 @@ coldata <- read_coldata(coldata_path)
9393
9494# Create initial SummarizedExperiment object
9595se <- create_summarized_experiment(txi [[" counts" ]], txi [[" abundance" ]], txi [[" length" ]],
96- DataFrame(coldata ), transcript_info $ transcript )
96+ DataFrame(coldata ), transcript_info $ transcript )
9797
9898# Setting parameters for writing tables
9999params <- list (
@@ -116,11 +116,12 @@ if ("tx2gene" %in% names(transcript_info) && !is.null(transcript_info$tx2gene))
116116
117117 # Create gene-level SummarizedExperiment objects
118118 gse <- create_summarized_experiment(gi [[" counts" ]], gi [[" abundance" ]], gi [[" length" ]],
119- col_data_frame , gene_info )
119+ col_data_frame , gene_info )
120120 gse.ls <- create_summarized_experiment(gi.ls [[" counts" ]], gi.ls [[" abundance" ]], gi.ls [[" length" ]],
121- col_data_frame , gene_info )
121+ col_data_frame , gene_info )
122122 gse.s <- create_summarized_experiment(gi.s [[" counts" ]], gi.s [[" abundance" ]], gi.s [[" length" ]],
123- col_data_frame , gene_info )
123+ col_data_frame , gene_info )
124+
124125 params <- c(params , list (
125126 list (obj = gse , slot = " length" , suffix = " gene_lengths.tsv" ),
126127 list (obj = gse , slot = " abundance" , suffix = " gene_tpm.tsv" ),
0 commit comments