Skip to content

Commit 44914bc

Browse files
committed
even readier
1 parent d697a4a commit 44914bc

File tree

3 files changed

+9
-22
lines changed

3 files changed

+9
-22
lines changed

conda/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package:
22
name: squeezemeta
3-
version: '1.3.0'
3+
version: '1.3.1'
44

55
source:
66
git_url: https://github.com/jtamames/squeezemeta.git

lib/SQMtools/R/summary.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,25 @@ summary.SQM = function(SQM)
2424
res$contigs$N90 = Npercent(as.numeric(SQM$contigs$table$Length), 90) # as.numeric to avoid integer overflow.
2525

2626
sk = SQM$contigs$tax[,'superkingdom']
27-
sk = sk[!grepl('^Unclassified', sk)] # Remove Unclassified
27+
sk = sk[!grepl('^Unclassified|^Unmapped', sk)] # Remove Unclassified
2828
sk = sk[!grepl('in NCBI)', sk)] # Remove "virtual" taxa (coming for ranks missing in NCBI for some taxa).
2929
p = SQM$contigs$tax[,'phylum']
30-
p = p[!grepl('^Unclassified', p)]
30+
p = p[!grepl('^Unclassified|^Unmapped', p)]
3131
p = p[!grepl('in NCBI)', p)]
3232
c_ = SQM$contigs$tax[,'class']
33-
c_ = c_[!grepl('^Unclassified', c_)]
33+
c_ = c_[!grepl('^Unclassified|^Unmapped', c_)]
3434
c_ = c_[!grepl('in NCBI)', c_)]
3535
o = SQM$contigs$tax[,'order']
36-
o = o[!grepl('^Unclassified', o)]
36+
o = o[!grepl('^Unclassified|^Unmapped', o)]
3737
o = o[!grepl('in NCBI)', o)]
3838
f = SQM$contigs$tax[,'family']
39-
f = f[!grepl('^Unclassified', f)]
39+
f = f[!grepl('^Unclassified|^Unmapped', f)]
4040
f = f[!grepl('in NCBI)', f)]
4141
g = SQM$contigs$tax[,'genus']
42-
g = g[!grepl('^Unclassified', g)]
42+
g = g[!grepl('^Unclassified|^Unmapped', g)]
4343
g = g[!grepl('in NCBI)', g)]
4444
s = SQM$contigs$tax[,'species']
45-
s = s[!grepl('^Unclassified', s)]
45+
s = s[!grepl('^Unclassified|^Unmapped', s)]
4646
s = s[!grepl('in NCBI)', s)]
4747

4848
res$contigs$superkingdom = list(nContigs = length(sk), nTaxa = length(unique(sk)), most_abundant = most_abundant_row(SQM$tax$superkingdom$abund) )
@@ -152,7 +152,7 @@ Npercent = function(len, percent)
152152
#' @noRd
153153
most_abundant_row = function(table, ignore_unclassified=T)
154154
{
155-
if(ignore_unclassified) { table = table[!grepl('Unclassified', rownames(table)),,drop=F] }
155+
if(ignore_unclassified) { table = table[!grepl('Unclassified|Unmapped', rownames(table)),,drop=F] }
156156
colMaxsIdx = apply(table, 2, which.max)
157157
res = rownames(table)[colMaxsIdx]
158158
if(is.null(res)) { res = rep('Unclassified', ncol(table)) }

lib/SQMtools/R/summary_lite.R

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,3 @@ Npercent = function(len, percent)
141141
Npercent = len_sorted[cumsum(len_sorted) >= sum(len_sorted)*percent/100][1]
142142
return(Npercent)
143143
}
144-
145-
146-
#' Return the name of the most abundant row for all the colums of a taxa.
147-
#' @noRd
148-
most_abundant_row = function(table, ignore_unclassified=T)
149-
{
150-
if(ignore_unclassified) { table = table[!grepl('Unclassified', rownames(table)),,drop=F] }
151-
colMaxsIdx = apply(table, 2, which.max)
152-
res = rownames(table)[colMaxsIdx]
153-
if(is.null(res)) { res = rep('Unclassified', ncol(table)) }
154-
names(res) = colnames(table)
155-
return(res)
156-
}

0 commit comments

Comments
 (0)