Code Monkey home page Code Monkey logo

Comments (3)

Kirk3gaard avatar Kirk3gaard commented on August 19, 2024
labelframe<-data %>% 
  select(starts_with("cov"),binID) %>%
  filter(!is.na(binID)) %>%
  group_by(binID) %>%
  replace(., is.na(.), 0) %>%
  summarise_all(funs(mean))

mmplot(...)+
geom_text_repel(
    data          = labelframe,
    aes(label=binID),
    nudge_x       = 1,
    segment.size  = 0.2,
    segment.color = "grey50",
    direction     = "y",
    hjust         = 1,
    size=5
  )

from mmgenome2.

KasperSkytte avatar KasperSkytte commented on August 19, 2024

Something like this, where you just specify a column with groups?

library(mmgenome2)
#> Loading required package: ggplot2
mmsubset <- mmextract(mmgenome2, 
                      data.frame(cov_C13.11.25 = c(1.253, 1.298, 2.78, 3.006, 1.772),
                                 cov_C14.01.09 = c(46.774, 26.499, 15.013, 28.049, 48.58))
                      )
#> 185 scaffolds (or 2.39% of the scaffolds in mm, weighted by length) remain after 97100 of 97285 scaffolds have been filtered.
bin1 <- mmextract(mmsubset, 
                  data.frame(cov_C13.11.25 = c(1.239, 1.273, 1.732, 2.075, 1.658),
                             cov_C14.01.09 = c(30.96, 41.872, 45.587, 40.788, 31.734))
                  )
#> 54 scaffolds (or 53.19% of the scaffolds in mm, weighted by length) remain after 131 of 185 scaffolds have been filtered.
bin2 <- mmextract(mmsubset,
                  data.frame(cov_C13.11.25 = c(2.052, 2.479, 2.874, 2.527),
                             cov_C14.01.09 = c(20.203, 29.722, 25.62, 17.494))
                  )
#> 41 scaffolds (or 43.23% of the scaffolds in mm, weighted by length) remain after 144 of 185 scaffolds have been filtered.
mmsubset$bin <- NA
mmsubset$bin[which(mmsubset$scaffold %in% bin1$scaffold)] <- "bin1"
mmsubset$bin[which(mmsubset$scaffold %in% bin2$scaffold)] <- "bin2"

mmplot(mmsubset,
            x = "cov_C13.11.25",
            y = "cov_C14.01.09",
            label_bins = "bin")

Created on 2018-10-03 by the reprex package (v0.2.1)

from mmgenome2.

KasperSkytte avatar KasperSkytte commented on August 19, 2024

Main addition is this

from mmgenome2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.