immunomind / immunarch

🧬 Immunarch: an R Package for Fast and Painless Exploration of Single-cell and Bulk T-cell/Antibody Immune Repertoires
https://immunarch.com
Apache License 2.0
306 stars 65 forks source link

Error loading Mixcr v4.3.2 data - [!] Warning: can't find a column with clonal counts #367

Open ArteEfs opened 1 year ago

ArteEfs commented 1 year ago

🐛 Bug

Hi,

Thanks so much for this amazing tool, it's been really helpful in analyzing TCR data. I have been using Immunarch without a problem with previous versions of Mixcr.

However, ever since updating to Mixcr v4.3.2, I can no longer upload my dataset. I'd be very grateful if you could help me solve the problem.

To Reproduce

The commands I give are:

  1. library(immunarch)
  2. data <- repLoad("X:/Schisto_experiment_TCRb_sequencing_data/C1/mixcr/results_threshold_6/tsv/txt/")

Then I get the error:

== Step 1/3: loading repertoire files... ==

Processing "X:/Schisto_experiment_TCRb_sequencing_data/C1/mixcr/results_threshold_6/tsv/txt/" ... -- [1/115] Parsing "X:/Schisto_experiment_TCRb_sequencing_data/C1/mixcr/results_threshold_6/tsv/txt/metadata.txt" -- metadata -- [2/115] Parsing "X:/Schisto_experiment_TCRb_sequencing_data/C1/mixcr/results_threshold_6/tsv/txt/S1.txt" -- mixcr
[!] Warning: can't find a column with clonal counts. Setting all clonal counts to 1.
Did you apply repLoad to MiXCR file _alignments.txt? If so please consider moving all .clonotypes..txt MiXCR files to a separate folder and apply repLoad to the folder. Note: The _alignments.txt file IS NOT a repertoire file suitable for any analysis. Error in [[<-: ! Assigned data bunch_translate(df[[nuc_headers[[i]]]]) must be compatible with existing data. x Existing data has 2423 rows. x Assigned data has 0 rows. i Only vectors of size 1 are recycled. Caused by error in vectbl_recycle_rhs_rows(): ! Can't recycle input of size 0 to size 2423. Run rlang::last_trace() to see where the error occurred.

rlang::last_trace() <error/tibble_error_assign_incompatible_size> Error in [[<-: ! Assigned data bunch_translate(df[[nuc_headers[[i]]]]) must be compatible with existing data. x Existing data has 2423 rows. x Assigned data has 0 rows. i Only vectors of size 1 are recycled. Caused by error in vectbl_recycle_rhs_rows(): ! Can't recycle input of size 0 to size 2423.

Backtrace: x

  1. -immunarch::repLoad("X:/Schisto_experiment_TCRb_sequencing_data/C1/mixcr/results_threshold_6/tsv/txt/")
  2. -immunarch (local) .process_batch(batches[[batch_i]], .format, .mode, .coding)
  3. -immunarch (local) .read_repertoire(.filepath, .format, .mode, .coding)
  4. -immunarch (local) parse_fun(.path, .mode)
  5. +-base::[[<-(*tmp*, aa_headers[[i]], value = <list>)
  6. -tibble:::[[<-.tbl_df(*tmp*, aa_headers[[i]], value = <list>)
  7. -tibble:::tbl_subassign(...)
  8. -tibble:::vectbl_recycle_rhs_rows(value, fast_nrow(xo), i_arg = NULL, value_arg, call)

The directory of my library only contains the sample .txt files and a metadata file, and no alignment files.

Here is a file from my dataset as an example of the Mixcr format. S1.txt

vadimnazarov commented 1 year ago

Hi Arte, thank you, the team will take a look. Should be an easy fix, if MiXCR changed the namings for the columns.

ArteEfs commented 1 year ago

Hi Vadim,

Thanks for the quick reply! It turns out I wasn't using the latest version of Immunarch, now that I updated it, the data is loading fine. :)

Out of curiosity, besides .txt files, does Immunarch also support .tsv as input? I'm asking because .tsv is now the preferred output of the Mixcr exportClones function.

Sorry for the change in subject, keep up the great work! :)