Patch the extract.obiclean function
This commit is contained in:
42
R/obiclean.R
42
R/obiclean.R
@@ -56,9 +56,8 @@ setMethod("extracts.obiclean", "metabarcoding.data", function(obj) {
|
||||
cols = colnames(obj@motus)
|
||||
cleancols = grep(pat,cols)
|
||||
clean.names=cols[cleancols]
|
||||
p = grep(pat,cols)
|
||||
d = t(as.factor.or.matrix(obj@motus[,p]))
|
||||
n = sapply(strsplit(cols[p],':'),function(y) y[[2]])
|
||||
d = t(as.factor.or.matrix(obj@motus[,cleancols]))
|
||||
n = sapply(strsplit(cols[cleancols],':'),function(y) y[[2]])
|
||||
rownames(d)=n
|
||||
d = d[rownames(obj@reads),]
|
||||
obj[["obiclean_status"]]=d
|
||||
@@ -68,28 +67,31 @@ setMethod("extracts.obiclean", "metabarcoding.data", function(obj) {
|
||||
pat = "^obiclean_count:.*$"
|
||||
cols = colnames(newmotus)
|
||||
cleancols = grep(pat,cols)
|
||||
clean.names=cols[cleancols]
|
||||
p = grep(pat,cols)
|
||||
d = t(as.factor.or.matrix(newmotus[,p]))
|
||||
n = sapply(strsplit(cols[p],':'),function(y) y[[2]])
|
||||
rownames(d)=n
|
||||
d = d[rownames(obj@reads),]
|
||||
obj[["obiclean_count"]]=d
|
||||
|
||||
newmotus = newmotus[-cleancols]
|
||||
if (length(cleancols) > 0) {
|
||||
clean.names=cols[cleancols]
|
||||
d = t(as.factor.or.matrix(newmotus[,cleancols]))
|
||||
n = sapply(strsplit(cols[cleancols],':'),function(y) y[[2]])
|
||||
rownames(d)=n
|
||||
d = d[rownames(obj@reads),]
|
||||
obj[["obiclean_count"]]=d
|
||||
|
||||
newmotus = newmotus[-cleancols]
|
||||
}
|
||||
|
||||
pat = "^obiclean_cluster:.*$"
|
||||
cols = colnames(newmotus)
|
||||
cleancols = grep(pat,cols)
|
||||
clean.names=cols[cleancols]
|
||||
p = grep(pat,cols)
|
||||
d = t(as.factor.or.matrix(newmotus[,p]))
|
||||
n = sapply(strsplit(cols[p],':'),function(y) y[[2]])
|
||||
rownames(d)=n
|
||||
d = d[rownames(obj@reads),]
|
||||
obj[["obiclean_cluster"]]=d
|
||||
|
||||
newmotus = newmotus[-cleancols]
|
||||
if (length(cleancols) > 0) {
|
||||
clean.names=cols[cleancols]
|
||||
d = t(as.factor.or.matrix(newmotus[,cleancols]))
|
||||
n = sapply(strsplit(cols[cleancols],':'),function(y) y[[2]])
|
||||
rownames(d)=n
|
||||
d = d[rownames(obj@reads),]
|
||||
obj[["obiclean_cluster"]]=d
|
||||
|
||||
newmotus = newmotus[-cleancols]
|
||||
}
|
||||
|
||||
newdata = copy.metabarcoding.data(obj,motus=newmotus)
|
||||
|
||||
|
Reference in New Issue
Block a user