Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All clonal counts are set to 1 when column specified by ".count" is not found #417

Open
Jia340 opened this issue Oct 23, 2024 · 0 comments

Comments

@Jia340
Copy link

Jia340 commented Oct 23, 2024

Hi,

It appears that when using immunarch::repLoad(filename, .count = c("count_col_name"), all clonal counts are set to 1 if "count_col_name" is not found in the table (as shown in immunarch/R/io-parsers.R, line 682-691). It's mentioned in a message instead of an error or a warning so there's not a good way to capture that (e.g. use TryCatch).

This actually caused a lot of confusion in the real analysis as one can easily miss the warning and use the faked clonal counts in downstream analysis. I am wondering if the function can return an error/warning message directly, so that users know the column is not found and can double check their code? Thank you!

if (!any(.count %in% table.colnames)) {
    warn_msg <- c("  [!] Warning: can't find a column with clonal counts. Setting all clonal counts to 1.")
    warn_msg <- c(warn_msg, "\n      Did you apply repLoad to MiXCR file *_alignments.txt?")
    warn_msg <- c(warn_msg, " If so please consider moving all *.clonotypes.*.txt MiXCR files to")
    warn_msg <- c(warn_msg, " a separate folder and apply repLoad to the folder.")
    warn_msg <- c(warn_msg, "\n      Note: The *_alignments.txt file IS NOT a repertoire file suitable for any analysis.")
    message(warn_msg)

    .count <- .count[1]
    df[[.count]] <- 1
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant