From baf83775b973ec8e2da364f31ace8fd50aa41048 Mon Sep 17 00:00:00 2001 From: Jacqueline HY Siu <42074014+JHYSiu@users.noreply.github.com> Date: Wed, 6 Mar 2024 12:01:58 +0000 Subject: [PATCH] Update loadContigs.R Fixed to load data from Immcantation --- R/loadContigs.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/loadContigs.R b/R/loadContigs.R index 9b964e05..aae506b6 100644 --- a/R/loadContigs.R +++ b/R/loadContigs.R @@ -55,7 +55,7 @@ loadContigs <- function(input, if (format %in% c("10X", "WAT3R", "Omniscope")) { df <- lapply(contig.files, read.csv) - } else if("json") { + } else if(format %in% c("json")) { df <- lapply(contig.files, function(x) { tmp <- as.data.frame(fromJSON(x)) }) @@ -229,9 +229,9 @@ loadContigs <- function(input, for (i in seq_along(df)) { df[[i]][df[[i]] == ""] <- NA df[[i]] <- as.data.frame(df[[i]]) - df[[i]] <- df[[i]][,c("sequence_id", "locus", "consensus_count", "v_call", "d_call", "j_call", "c_gene", "cdr3", "cdr3_aa")] + df[[i]] <- df[[i]][,c("sequence_id", "locus", "consensus_count", "v_call", "d_call", "j_call", "c_call", "cdr3", "cdr3_aa")] colnames(df[[i]]) <- c("barcode", "chain", "reads", "v_gene", "d_gene", "j_gene", "c_gene", "cdr3_nt", "cdr3") - df[[i]] <- str_split(df[[i]][,"barcode"], "_", simplify = TRUE)[,1] + df[[i]]$barcode <- str_split(df[[i]][,"barcode"], "_", simplify = TRUE)[,1] } return(df) }