mikemc / speedyseq

Speedy versions of phyloseq functions
https://mikemc.github.io/speedyseq/
Other
46 stars 6 forks source link

taxa and sample names don't print correctly in component print methods #60

Closed mikemc closed 3 years ago

mikemc commented 3 years ago

See reprex below. I suspect this is due to a change in the functions from tibble et al I use under the hood. Applies to the methods for sample data, otu table, and tax table.

library(speedyseq)
data(GlobalPatterns)
GlobalPatterns %>% otu_table %>% head(2)
#> OTU Table:          [ 2 taxa and 26 samples ]:
#> Taxa are rows
#>          CL3   CC1   SV1 M31Fcsw M11Fcsw M31Plmr M11Plmr F21Plmr M31Tong
#> 38;5;250m1 549322     0     0     0       0       0       0       0       0
#>       0
#> 38;5;250m2 522457     0     0     0       0       0       0       0       0
#>       0
#> 38;5;246m# … with 7 more variables
#> 
GlobalPatterns %>% sample_data %>% head(2)
#> Sample Data:        [ 2 samples by 7 sample variables ]:
#>       X.SampleID Primer Final_Barcode Barcode_truncat… Barcode_full_le…
#> 38;5;250m1 CL3   CL3        ILBC_… AACGCA        TGCGTT           CTAGCGTGCG
#> T
#> 38;5;250m2 CC1   CC1        ILBC_… AACTCG        CGAGTT           CATCGACGAG
#> T
#> 38;5;246m# … with 2 more variables: SampleType <fct>, Description <fct>
mikemc commented 3 years ago

The issue arises from the step where I cut off the row numbers in tibble_print(), which is causing terminal color codes to appear in the string. A short-term fix will be to just keep the row numbers. Longer term I need to move away from the hacky method I'm using in tibble_print(), perhaps shifting to the "pillar" package, especially now thattibble::trunc_mat` is deprecated.