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
312 stars 66 forks source link

Error loading files from TRUST4 #415

Open Sa753 opened 2 months ago

Sa753 commented 2 months ago

I am loading Trust4_report.tsv file using repLoad from immunarch with no error. But the error happens when I try the following:

I subset the original Trust4_report.tsv file into separate TCR and BCR report.tsv files then save each one separately. I then load the BCR_report.tsv which has 28,000 rows and 10 columns with no problem but I get the error below when I load the TCR_report.tsv file which is around 3000 rows and 10 columns inspite that both are generated and saved in the same way.

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

Processing "" ... -- [1/1] Parsing "~/tcr_report.tsv" -- vdjtools Error in $<-:
! Assigned data df[[.dstart]] - df[[.vend]] - 1 must be compatible with existing data. ✖ Existing data has 3798 rows. ✖ Assigned data has 0 rows. ℹ Only vectors of size 1 are recycled. Caused by error in vectbl_recycle_rhs_rows(): ! Can't recycle input of size 0 to size 3798. Run rlang::last_trace() to see where the error occurred.

load the cdr3 file

cdr3 <- read.table(file = "~/trust4_report_files/Trust4_report.tsv", header = T, stringsAsFactors = F)

subset the tcr and bcr files

cdr3.bcr <- subset(cdr3, grepl("^IG",V) | grepl("^IG",J) | grepl("^IG",C)) cdr3.tcr <- subset(cdr3, grepl("^TR",V) | grepl("^TR",J) | grepl("^TR",C))

save the tcr and bcr file

write_tsv(cdr3.bcr, file='~/bcr_report.tsv', col_names = T)

write_tsv(cdr3.tcr, file='~/tcr_report.tsv', col_names = T)

load parsed file using immuarch

immdata <- repLoad('~/bcr_report.tsv') # successful no issues

immdata <- repLoad('~/tcr_report.tsv') # error mentioned above and no loading.

I am using R 4.3 and immunarch 0.9.1

Please advise

Thank you

Sa753 commented 2 months ago

I am aware that there was a fix for this error but don't know why this is temperamental, i.e work with some files and not with others produced in the same way. so please don't direct me to the previous issue, I am aware of it and tried it but did not work