@@ -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
153153most_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 )) }
0 commit comments