Skip to content

Instantly share code, notes, and snippets.

View lytze's full-sized avatar

Li Yuze lytze

  • Wageningen, the Netherlands
View GitHub Profile
@lytze
lytze / homer_to_meme.R
Created June 5, 2018 03:37
Homer motif file to MEME motif file
groups <- c("Group", "Names") # here are the group names for enrichment experiments, also folder names locates homer motif files
p_threash <- 1e-4 # p-value threashold
## make separate meme file for each homer file
for (g in groups) {
homer <- readLines(paste0("../data/homer_motifs/", g, "/homerMotifs.all.motifs"))
homer_starts <- grep("^>", homer)
homer_number <- length(homer_starts)
homer_lines <- length(homer)
homer_starts[homer_number + 1] <- homer_lines + 1
@lytze
lytze / server.R
Last active August 29, 2015 14:17 — forked from withr/server.R
library(shiny)
library(datasets)
Logged = FALSE;
PASSWORD <- data.frame(Brukernavn = "withr", Passord = "25d55ad283aa400af464c76d713c07ad")
# Define server logic required to summarize and view the selected dataset
shinyServer(function(input, output) {
source("www/Login.R", local = TRUE)
observe({
if (USER$Logged == TRUE) {
#!/broad/software/free/Linux/redhat_5_x86_64/pkgs/r_3.0.2/bin/Rscript
# Eric Vallabh Minikel
# CureFFI.org
# 2014-01-14
# example of how to use optparse in R scripts
# usage: ./exampleRScript1.r -a thisisa -b hiagain
# ./exampleRScript1.r --avar thisisa --bvar hiagain
@lytze
lytze / find_k_mer.R
Last active August 29, 2015 14:08
A 'Find k-mer' solution in RScript (Running under shell/terminal)
#! /usr/bin/Rscript
# Lytze Nov 4 2014
# An example of visit stdin (the real stdin, not the console) using RScript
# NO details about seting opts and args
# Usage:
## $ chmod u+x find_k_mer.R
## $ ./find_k_mer.R
# OR
## $ ./find_k_mer.R < inputfile
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("ReadImages", "reshape", "ggplot2")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
imageLoader <- function(url){ # This function takes a URL, and generates a data.frame with pixel locations and colors
# Download to disk, load
download.file(url, "tempPicture.jpg", mode = "wb") # Stash image locally
readImage <- read.jpeg("tempPicture.jpg")