Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move read.table out of loop #121

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions assets/multiqc_config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
report_comment: >
This report has been generated by the <a href="https://github.com/nf-core/rnasplice/releases/tag/1.0.2" target="_blank">nf-core/rnasplice</a>
This report has been generated by the <a href="https://github.com/nf-core/rnasplice/releases/tag/1.0.3" target="_blank">nf-core/rnasplice</a>
analysis pipeline. For information about how to interpret these results, please see the
<a href="https://nf-co.re/rnasplice/1.0.2/docs/output" target="_blank">documentation</a>.
<a href="https://nf-co.re/rnasplice/1.0.3/docs/output" target="_blank">documentation</a>.
report_section_order:
"nf-core-rnasplice-methods-description":
Expand Down
19 changes: 11 additions & 8 deletions bin/suppa_split_file.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ if (length(args) == 5){

}

######################################
######### Read in input file #########
######################################

input_data <- read.csv(input_file, sep="\t", header=TRUE)

######################################
####### Process samplesheet ##########
######################################
Expand Down Expand Up @@ -63,19 +69,16 @@ conditions <- unique(samplesheet[,"condition"])
#########################################################

# Function for taking all sample names associated with a given condition
split_files <- function(condition, samplesheet, input_file, output_file_suffix, prefix, calculate_ranges){
split_files <- function(condition, samplesheet, input_data, output_file_suffix, prefix, calculate_ranges){

# Get indices of rows which cover given condition for ranges
indices <- which(samplesheet$condition == condition)

# Get sample names for given condition
sample_names <- samplesheet[samplesheet$condition == condition,]$sample

# Read in input file
input_file <- read.csv(input_file, sep="\t", header=TRUE)

# Check header of input_file contains all samples from processed samplesheet
if (!all(samplesheet$sample %in% colnames(input_file))) {
# Check header of input_data contains all samples from processed samplesheet
if (!all(samplesheet$sample %in% colnames(input_data))) {

stop("suppa_split_file.R Input_file must contain samplesheet samples.", call.=FALSE)

Expand All @@ -92,7 +95,7 @@ split_files <- function(condition, samplesheet, input_file, output_file_suffix,
}

# Subset input files and save out as new file
write.table(input_file[,sample_names, drop=F], file = output_file, quote = FALSE, sep = "\t")
write.table(input_data[,sample_names, drop=F], file = output_file, quote = FALSE, sep = "\t")

# Get Cluster ranges which match the tpm and psi files above (1-3 4-6)
# Column numbers have to be continuous, with no overlapping or missing columns between them. Ex:1-3,4-6
Expand All @@ -118,7 +121,7 @@ split_files <- function(condition, samplesheet, input_file, output_file_suffix,
for (cond in conditions) {

# Split files
split_files(cond, samplesheet, input_file, output_file_suffix, prefix, calculate_ranges)
split_files(cond, samplesheet, input_data, output_file_suffix, prefix, calculate_ranges)

}

Expand Down
2 changes: 1 addition & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ manifest {
description = """Alternative splicing analysis using RNA-seq."""
mainScript = 'main.nf'
nextflowVersion = '!>=23.04.0'
version = '1.0.2'
version = '1.0.3'
doi = '10.5281/zenodo.8424632'
}

Expand Down
Loading