Add v_call and j_call to sequence ID

This commit is contained in:
coolneng 2021-04-21 18:46:00 +02:00
parent 82fdfdc6b9
commit 282b86e31b
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 3 additions and 3 deletions

View File

@ -11,17 +11,17 @@ generate_repertoire <- function(number_of_sequences) {
} }
save_data <- function(data, reads) { save_data <- function(data, reads) {
Biostrings::writeXStringSet(data$sequence, "data/sequence.fasta")
vdj_sequences <- data[-1] vdj_sequences <- data[-1]
amplified_vdj <- vdj_sequences[rep(seq_len(nrow(vdj_sequences)), reads), ] amplified_vdj <- vdj_sequences[rep(seq_len(nrow(vdj_sequences)), reads), ]
write.csv(amplified_vdj, "data/vdj_metadata.csv", row.names = FALSE) Biostrings::writeXStringSet(data$sequence, "data/sequence.fasta")
} }
process_data <- function(repertoire, reads) { process_data <- function(repertoire, reads) {
columns <- c("sequence", "junction", "v_call", "j_call") columns <- c("sequence", "v_call", "j_call")
data <- repertoire[, columns] data <- repertoire[, columns]
dna_sequence <- Biostrings::DNAStringSet(data$sequence) dna_sequence <- Biostrings::DNAStringSet(data$sequence)
data$sequence <- Biostrings::reverseComplement(dna_sequence) data$sequence <- Biostrings::reverseComplement(dna_sequence)
names(data$sequence) <- paste(rownames(data), data$v_call, data$j_call)
save_data(data, reads) save_data(data, reads)
} }