library(immuneSIM) library(Biostrings) generate_repertoire <- function(number_of_sequences) { return(immuneSIM( number_of_seqs = number_of_sequences, species = "hs", receptor = "tr", chain = "b" )) } 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") } parse_cli_arguments <- function() { args <- commandArgs(trailingOnly = TRUE) if (length(args) != 1) { stop("usage: repertoire.r ") } return(args[1]) } argument <- parse_cli_arguments() repertoire <- generate_repertoire(number_of_sequences = as.integer(argument)) process_data(data = repertoire)