diff --git a/src/repertoire.r b/src/repertoire.r index 79e98ed..a3669ff 100644 --- a/src/repertoire.r +++ b/src/repertoire.r @@ -10,11 +10,16 @@ generate_repertoire <- function(number_of_sequences) { )) } +save_data <- function(data) { + Biostrings::writeXStringSet(data$sequence, "data/sequence.fasta") + Biostrings::writeXStringSet(data$junction, "data/HVR.fasta") +} + process_data <- function(data) { dna_sequence <- Biostrings::DNAStringSet(data$sequence) data$sequence <- Biostrings::reverseComplement(dna_sequence) names(data$sequence) <- paste(rownames(data), data$v_call, data$j_call, " ") - Biostrings::writeXStringSet(data$sequence, "data/sequence.fasta") + return(data) } parse_cli_arguments <- function() { @@ -27,4 +32,5 @@ parse_cli_arguments <- function() { argument <- parse_cli_arguments() repertoire <- generate_repertoire(number_of_sequences = as.integer(argument)) -process_data(data = repertoire) +data <- process_data(data = repertoire) +save_data(data) \ No newline at end of file