Comments (2)
Hey @gustavjoh.
I was facing the same issue trying to use the pubRepApply function. This is how dealt with it:
I searched for the function code with trace(pubRepApply, edit = T)
and copied it to my script with another name, but changing the original line
pr.res = dplyr::inner_join(.pr1, .pr2, by = col_before_samples)
for this
pr.res = as.data.table(dplyr::inner_join(.pr1, .pr2, by = col_before_samples))
as it follows:
my_function <- function (.pr1, .pr2, .fun = function(x) log10(x[1])/log10(x[2]))
{
col_before_samples = names(.pr1)[1:(match("Samples", colnames(.pr1)) -
1)]
tmp = rowMeans(public_matrix(.pr1), na.rm = T)
.pr1[, (match("Samples", colnames(.pr1)) + 1):ncol(.pr1)] = NULL
.pr1[["Quant"]] = tmp
tmp = rowMeans(public_matrix(.pr2), na.rm = T)
.pr2[, (match("Samples", colnames(.pr2)) + 1):ncol(.pr2)] = NULL
.pr2[["Quant"]] = tmp
pr.res = as.data.table(dplyr::inner_join(.pr1, .pr2, by = col_before_samples))
pr.res[["Samples.x"]] = pr.res[["Samples.x"]] + pr.res[["Samples.y"]]
pr.res[, `:=`(Samples.y, NULL)]
names(pr.res)[match("Samples.x", colnames(pr.res))] = "Samples"
pr.res[["Result"]] = apply(pr.res[, c("Quant.x", "Quant.y")],
1, .fun)
add_class(pr.res, "immunr_public_repertoire_apply")
}
Then calling the new function:
pr3 = my_function(pr1, pr2)
I don't know how the output was intended to be, but I think it's working fine now.
Hope it helps.
from immunarch.
Thank you!
Your solution works, seems like the line causing the problem is the one below.
pr.res[, ':='(Samples.y, NULL)]
What I can see is that it only removes the column "Samples.y" so that line could also be replaced by the code below, perhaps not as clean code. But at least it doesn't change the datatype.
'pr.res = dplyr::select(pr.res, -Samples.y)'
Hope this is fixed in the next version
Thank you again!
from immunarch.
Related Issues (20)
- select_()` was deprecated in dplyr 0.7.0.
- Error when generating plot for "Gini coefficient" HOT 1
- Issue with repLoad and repGermline when using O. mykiss IMGT data HOT 2
- Ambiguous Gene Usage in TRBD HOT 2
- Package Installation Error HOT 1
- Get Immunarch back to CRAN
- Number of sequence provided in .data and .dist are not matching!
- Deprecation warning from purrr in function seqCluster
- Single cell TCRSeq HOT 1
- C call with TRUST4 files HOT 2
- gene_stats for pig TRAV
- Found dataframe without required column Cluster
- How to specify groups order?
- MiXCR import no longer works HOT 4
- File naming vs loading problems HOT 2
- Cellranger Data Loading HOT 1
- object 'generate_germline_sequence' not found
- CDR3 Length paired 10x data
- Novaseq X and 10X
- dbAnnotate problems
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from immunarch.