Closed lijinw closed 2 years ago
Hi @lijinw , thanks for again reaching out with such a very detailed issue description. That helps a lot with identifying potential issues.
The missing arrows seem to arise from your used standard font not supporting specific UTF8 glyphs. That means you probably have to change the used font type to be able to plot the arrows.
Basically, the arrows are just the UFT8-Glyphs ⬆
and ⬇
, you can produce them with the following R-code:
intToUtf8(11014)
intToUtf8(11015)
Does your R environment display those symbols when running the code above?
To be honest, I am no expert on the whole UTF8 font topic, especially not on macOS, but I will try my best.
You should be able to list your available fonts for the Quartz plotting system on macOS with grDevices::quartzFonts()
You can select a font or font-family and supply it to plotting functions.
For a quick check if your selected font can plot those glyphs, run:
par(family = "*Your selected font*")
plot(1:5, t = "n")
text(2,2,c(intToUtf8(c(11014))),cex=3)
text(4,4,c(intToUtf8(c(11015))),cex=3)
When you have found a font that is working (and looking reasonable), you can specify it in the plot_transcripts_view()
command, and it should be passed down to the correct plotting function:
plot_transcripts_view(dturtle = table_LPS_sig,
gtf = "gencode.vM25.annotation.gtf",
genome = 'mm10',
one_to_one = TRUE,
savepath = "images_LPS_transcript",
add_to_table = "transcript_view",
family = "*Your selected font*")
I hope that helps with your problem.
P.S.: I read online that there might be a font called family="Apple Symbols"
which supposedly is able to plot glyphs. As I do not have access to a macOS-Machine, I sadly can not verify if that solves your issue.
Hi @TobiTekath ,
I have tried the code you share with me. I can get the arrows by running below in R directly.
intToUtf8(11014)
[1] "⬆"
intToUtf8(11015)
[1] "⬇"
grDevices::quartzFonts()
$serif [1] "Times-Roman" "Times-Bold" "Times-Italic" "Times-BoldItalic"
$sans [1] "Helvetica" "Helvetica-Bold" "Helvetica-Oblique" "Helvetica-BoldOblique"
$mono [1] "Courier" "Courier-Bold" "Courier-Oblique" "Courier-BoldOblique"
Then I replace the code with a specific font, like below:
par(family = "Times-Roman") plot(1:5, t = "n") text(2,2,c(intToUtf8(c(11014))),cex=3) text(4,4,c(intToUtf8(c(11015))),cex=3)
However, none of them can draw the arrow in the plot. Is this because Mac didn't support UFT8-Glyphs? Thanks!
Hi @lijinw ,
so we definitively found the culprit. To fix the issue, you must find a font supporting at least these two glyphs.
You could have a look at the extrafont or showtext packages - these shall allow you to import additional fonts.
Again, you might try the "Apple Symbols" font that should be pre-installed on your system. At least according to Wikipedia it should support the needed Glyphs (see here).
Hi @TobiTekath,
Thanks for your help!
Hi, I'm sorry to disturb you again. Thanks for your help completing the transcript plot. But I find there is no arrow for pointing out the direction of change in my transcript plot. Could you please help me fix the bug?
table_LPS_sig <- plot_transcripts_view(dturtle = table_LPS_sig, gtf = "gencode.vM25.annotation.gtf", genome = 'mm10', one_to_one = TRUE, savepath = "images_LPS_transcript", add_to_table = "transcript_view")
This the traceback traceback()
To Reproduce Steps to reproduce the behavior: library(data.table)
install.packages("apeglm")
library(apeglm) library(DTUrtle) setwd("/Users/LiJin/Documents/nBox/Lijin/Manvendra/rsem") library(DESeq2)
DTU
prepare gtf files
tx2gene <- import_gtf(gtf_file = "gencode.vM25.annotation.gtf") tx2gene$gene_name <- one_to_one_mapping(name = tx2gene$gene_name, id = tx2gene$gene_id)
> Changed 110 names.
tx2gene$transcript_name <- one_to_one_mapping(name = tx2gene$transcript_name, id = tx2gene$transcript_id) tx2gene <- move_columns_to_front(df = tx2gene, columns = c("transcript_name", "gene_name"))
import files
list.files("/Users/LiJin/Documents/nBox/Lijin/Manvendra/rsem/") files <- Sys.glob("/Users/LiJin/Documents/nBox/Lijin/Manvendra/rsem/*isoforms.results") files names(files) <- gsub("/Users/LiJin/Documents/nBox/Lijin/Manvendra/rsem/","",files) data <- import_counts(files, type = "rsem", tx2gene=tx2gene[,c("transcript_id", "gene_name")]) rownames(data) <- tx2gene$transcript_name[match(rownames(data), tx2gene$transcript_id)] dim(data) #142604 8 head(data) colnames(data) <- gsub(".isoforms.results","",colnames(data)) pd <- data.frame("id"=colnames(data), "group"=c(rep("Ctr_LPS",4), rep("Ctr_Ut",4),rep("Mut_LPS",4),rep("Mut_Ut",4)), stringsAsFactors = FALSE) pd dturtle_LPS <- run_drimseq(counts = data, tx2gene = tx2gene, pd=pd, id_col = "id", cond_col = "group", cond_levels = c("Mut_LPS","Ctr_LPS"), filtering_strategy = "bulk")
Retain 28420 of 71996 features.
Removed 43576 features.
head(dturtle_LPS$meta_table_gene) dturtle_LPS$used_filtering_options
dturtle_LPS_sig <- posthoc_and_stager(dturtle = dturtle_LPS, ofdr = 0.05, posthoc = 0.1)
Posthoc filtered 15787 features.
Found 13 significant genes with 13 significant transcripts (OFDR: 0.05)
table_LPS_sig <- create_dtu_table(dturtle = dturtle_LPS_sig, add_gene_metadata = list("chromosome"="seqnames"), add_tx_metadata = list("tx_expr_in_max" = c("exp_in", max))) dim(table_LPS_sig$dtu_table)
13 8
table_LPS_sig <- plot_proportion_barplot(dturtle = table_LPS_sig, meta_gene_id = "gene_id.1", savepath = "images_LPS_barplot", add_to_table = "barplot")
head(plot_LPS_sig$dtu_table$barplot) head(list.files("./images/"))
table_LPS_sig <- plot_proportion_pheatmap(dturtle = table_LPS_sig, include_expression = TRUE, treeheight_col=20, savepath = "images_LPS_heatmap", add_to_table = "pheatmap")
table_LPS_sig <- plot_transcripts_view(dturtle = table_LPS_sig, gtf = "gencode.vM25.annotation.gtf", genome = 'mm10', one_to_one = TRUE, savepath = "images_LPS_transcript", add_to_table = "transcript_view")
Please complete the following information: -R version 4.1.2 (2021-11-01) -Platform: x86_64-apple-darwin17.0 (64-bit) -Running under: macOS Catalina 10.15.7 -DTUrtle_1.0.2