From 4adb92e901ec63960b1bce16b272ed4afac42f0c Mon Sep 17 00:00:00 2001 From: coolneng Date: Thu, 22 Apr 2021 11:54:40 +0200 Subject: [PATCH] Export original CDR3 to a file --- src/repertoire.r | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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