```{css, echo=FALSE}

h1 { font-size: 25px; background-color: #337ab7; padding: 5px 10px; color: white; font-weight: bold; }

h2 { color: #337ab7; font-weight: bold; }

tfoot { display: none; }

# PIP profiles

*Click on the image to enlarge it*

```r

if(!is.na(params$annotationTable)){
  params$pipSTAT$plot
} else {
  params$plot
}

shiny::setProgress(1/8) 

PIP exploration

inter = params$pipSTAT$dt

DT::datatable(inter, rownames = FALSE,  container = params$pipSTAT$sketch,  colnames = c('', colnames(inter)[-1]),
              selection = 'none',escape = F, extensions = 'Buttons',
              options = list( 
                dom = 'BfRrltpi', 
                autoWidth=TRUE,
                paging=T, 
                scrollX = T,
                fixedColumns = list(leftColumns = c(1,2)), 
                buttons = c('copy', 'csv', 'excel', 'pdf', 'print')),
) %>%
  formatStyle(
    'Color',
    width='20px',
    `font-size` ="1px",
    color = styleEqual(
      inter$Color, inter$Color
    ),
    backgroundColor = styleEqual(
      inter$Color, inter$Color
    )
  ) %>% formatRound(3:ncol(inter), 2)
shiny::setProgress(2/8) 

Information

Resume

Reference sequence name : r names(params$genomes$genomesNto1$reference)

Reference sequence size : r nchar(params$genomes$genomesNto1$reference)

if(params$genomes$genomesNto1$seqType == "DNA"){
  HTML("<p><b>Sequence Type </b>:  Nucleic acid sequence</p>")
} else {
  HTML("<p><b>Sequence Type </b>: Protein sequence</p>")
}
shiny::setProgress(3/8) 

Type of alignment : r params$genomes$genomesNto1$pairwiseType

Mean size of query sequences : r round(mean(unlist(lapply(params$genomes$genomesNto1$alignments, nchar))))

Number of query sequences : r length(params$genomes$genomesNto1$alignments)

Type of alignment : r params$genomes$genomesNto1$pairwiseType

Sequence information

if(is.null(params$genomes$SummarySequence)){
  if(params$genomes$seqType == "DNA"){
    resInter  = do.call("rbind", lapply(params$genomes$genomesNto1$sequences, function(s){
      c(Size = nchar(s), (table(unlist(strsplit(as.character(s),"")))/nchar(s)) * 100)
    }))

  } else {
    suppressMessages(suppressWarnings(library(seqinr)))

    resInter <- do.call("rbind", lapply(params$genomes$genomesNto1$sequences, function(s){

      statInter = AAstat(unlist(strsplit(as.character(s), "")), plot = F)
      vectInter = setNames(rep(0, 31),
                           c("Pi", "Tiny","Small","Aliphatic" ,"Aromatic","Non.polar", "Polar","Charged","Basic","Acidic",
                             "*","A","C","D","E","F","G","H","I","K","L","M","N","P","Q","R","S","T","V","W","Y"))

      vectInter[names(statInter$Compo)] = statInter$Compo
      vectInter[names(unlist(statInter$Prop))] = round(unlist(statInter$Prop), 2)
      vectInter["Pi"] = round(statInter$Pi, 2)
      vectInter = c(Size = nchar(s), vectInter)
    }))

    detach(package:seqinr)

    resInter
  }

  resInter <- as.data.frame(resInter) %>%
    mutate(name = unlist(lapply(rownames(resInter), function(x){
      pos = which(unlist(strsplit(x, "")) == "_")
      pos = pos[length(pos)]
      substr(x,1,pos-1)
    })))

  message(as.character(as.data.frame(params$pipSTAT$dt)[,2]))

  inter = cbind.data.frame(allNames = as.data.frame(params$pipSTAT$dt)[,2], color = as.data.frame(params$pipSTAT$dt)[,1])  %>%
    mutate(name = unlist(lapply(as.character(as.data.frame(params$pipSTAT$dt)[,2]), function(x){
      pos = which(unlist(strsplit(x, "")) == "(")
      pos = pos[length(pos)]
      substr(x,1,pos-2)
    })))

  resInter <- inter  %>%
    left_join(resInter, by="name") %>%
    mutate(name = allNames) %>%
    select(-allNames) %>%
    arrange(match(name, as.character(as.data.frame(params$pipSTAT$dt)[,2])))

  datatable(resInter,  rownames = FALSE,colnames = c('', colnames(resInter)[-1]),  extensions = 'Buttons', options = list(dom = 'BfRrltpi',
                                                                                                                          autoWidth=TRUE,scrollX = TRUE, 
                                                                                                                          buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))%>%
    formatStyle(
      'color',
      width='20px',
      `font-size` ="1px",
      color = styleEqual(
        resInter$color, resInter$color
      ),
      backgroundColor = styleEqual(
        resInter$color, resInter$color
      )
    )
} else {
  datatable(params$genomes$SummarySequence, colnames = c('', colnames(params$genomes$SummarySequence)[-1]),
            rownames = FALSE, extensions = 'Buttons', options = list(dom = 'BfRrltpi',autoWidth=TRUE, scrollX = TRUE, 
                                                                     buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))%>%
    formatStyle(
      'color',
      width='20px',
      `font-size` ="1px",
      color = styleEqual(
        params$genomes$SummarySequence$color, params$genomes$SummarySequence$color
      ),
      backgroundColor = styleEqual(
        params$genomes$SummarySequence$color, params$genomes$SummarySequence$color
      )
    )
}

shiny::setProgress(4/8) 
if(params$genomes$genomesNto1$seqType == "DNA"){
  HTML("<h2>Annotation</h2>")
}
if(params$genomes$genomesNto1$seqType == "DNA"){
  datatable(params$annotationTable[, 1:(ncol(params$annotationTable)-3)], escape = F, extensions = 'Buttons', options = list(dom = 'BfRrltpi',scrollX = TRUE, 
                                                                                                                             buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
}
shiny::setProgress(5/8) 

Alignments

Resume

inter = cbind.data.frame(allNames = as.data.frame(params$pipSTAT$dt)[,2], color = as.data.frame(params$pipSTAT$dt)[,1])  %>%
  mutate(name = unlist(lapply(as.character(as.data.frame(params$pipSTAT$dt)[,2]), function(x){
    pos = which(unlist(strsplit(x, "")) == "(")
    pos = pos[length(pos)]
    substr(x,1,pos-2)
  })))

inter = inter %>% left_join(params$genomes$genomesNto1$stats  %>%
                              mutate(name = rownames(params$genomes$genomesNto1$stats)),
                            by="name") %>%  arrange(desc(score))  %>%
  mutate(name = allNames) %>%
  select(-allNames)  %>%
  arrange(match(name, as.character(as.data.frame(params$pipSTAT$dt)[,2])))

datatable(inter,  colnames = c('', colnames(inter)[-1]), 
          extensions = 'Buttons', options = list(dom = 'BfRrltpi',scrollX = TRUE, 
                                                 buttons = c('copy', 'csv', 
                                                             'excel', 'pdf', 
                                                             'print'))) %>%
  formatStyle(
    'color',
    width='20px',
    `font-size` ="1px",
    color = styleEqual(
      inter$color, inter$color
    ),
    backgroundColor = styleEqual(
      inter$color, inter$color
    )
  )
shiny::setProgress(6/8) 

Distribution

if(!is.null(params$plotlyRV$plotGG_scorePlot)){
  params$plotlyRV$plotGG_scorePlot
} else {
  inter = cbind.data.frame(name = rownames(params$genomes$genomesNto1$stats), 
                           score = round(params$genomes$genomesNto1$stats$score))
  inter = inter[order(inter$score, decreasing = TRUE), ]
  inter$name <- factor(inter$name, levels = inter$name)

  ggplot(data=inter, aes(x=name, y=score)) +
    geom_bar(stat="identity", fill="steelblue")+
    geom_text(aes(label=score), vjust=-0.3, size=3.5)+
    theme_minimal() + 
    theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
    labs(title="Score distribution",
         x ="Species", y = "Score")
}
shiny::setProgress(7/8) 
if(!is.null(params$plotlyRV$plotGG_pidPlot)){
  params$plotlyRV$plotGG_pidPlot
} else {
  inter = cbind.data.frame(name = rownames(params$genomes$genomesNto1$stats), 
                           pid = round(params$genomes$genomesNto1$stats$pid))
  inter = inter[order(inter$pid, decreasing = TRUE), ]
  inter$name <- factor(inter$name, levels = inter$name)

  ggplot(data=inter, aes(x=name, y=pid)) +
    geom_bar(stat="identity", fill="steelblue")+
    geom_text(aes(label=pid), vjust=-0.3, size=3.5)+
    theme_minimal() + 
    theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
    labs(title="PID distribution",
         x ="Species", y = "PID")
}
shiny::setProgress(8/8) 

Session Information

In this section is gathered all the information concerning the working environment, the versions of the packages used ... to be able to reproduce the analyses.

R session information and parameters

The versions of the R software and Bioconductor packages used for this analysis are listed below. It is important to save them if one wants to re-perform the analysis in the same conditions.

sessionInfo()


IFB-ElixirFr/PIPprofileR documentation built on June 21, 2022, 7:13 a.m.