statOmics/tradeSeq

plotsmoothers

Closed this issue · 1 comments

hello everyone,

I made a loop to generate all the plotsmoothers for all the genes my question is how can I generate that the plots for the genes with dynamic expression are not continuous?
Thank you
my respectful greetings
this is my code i try with slope
threshold_slope <- 0.2
for (i in 1:length(virilisTFs_cand)) {
A <- virilisTFs_cand[i]

Get the row metadata of the sce object

rowData <- rowData(sce)

Extract the gene IDs from the row metadata

gene_ids <- rownames(rowData)

if (A %in% gene_ids) {
# Récupération des données de la courbe
plot_data <- plotSmoothers(sce, assays(sce)$counts, gene = A, lwd = 0.2, alpha = 0.5, border = TRUE)

# Extraction des coordonnées x et y des points de la courbe
x <- plot_data$data$time
y <- plot_data$data$gene_count

# Calcul de la pente de la courbe
slope <- lm(y ~ x)$coefficients[2]

# Affichage de la pente
if (abs(slope) > threshold_slope) {
  # Enregistrement du graphique au format PNG dans le dossier "plots"
  png(file = paste0("plots/", A, ".png"), width = 800, height = 600)
  plot(plot_data)
  dev.off()
} else {
  png(file = paste0("plots2/", A, ".png"), width = 800, height = 600)
  plot(plot_data)
  dev.off()
}

}

Hi @nouhay

Please do not spam other threads or our inboxes with your question. Lately we have indeed not been very fast in responding, but it will not be helpful to spam other threads.

Could you please be more specific about what you mean with the following?

genes with dynamic expression are not continuous