Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jeanmanguy's full-sized avatar
🏠
Working from home

Jean Manguy jeanmanguy

🏠
Working from home
  • Dublin, Ireland
View GitHub Profile
@jeanmanguy
jeanmanguy / uniprot_xml_2_tsv.xsl
Last active January 18, 2020 13:38
convert uniprot file to TSV [WIP]
<?xml version='1.0' encoding="UTF-8"?>
<xsl:stylesheet
xmlns:u="http://uniprot.org/uniprot"
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
version='1.0'
>
<xsl:output method="text" encoding="UTF-8" />
<xsl:variable name="separator" select="'&#x9;'" />
@jeanmanguy
jeanmanguy / render_rmarkdwn_file.sh
Created May 14, 2018 10:39
render rmarkdwn file
R -e 'rmarkdown::render("<file>.Rmd", "pdf_document")'
@jeanmanguy
jeanmanguy / R_data_frame_all_objects_size.md
Last active April 26, 2018 13:03
list all objects and get the allocated space for each object, in a sorted data_frame
library(purrr)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
@jeanmanguy
jeanmanguy / best9oftweets.R
Last active January 1, 2018 18:21
create a collage with the best 9 tweets from the tweet activity data
# code adapted from http://www.masalmon.eu/2017/12/30/best9of2017/
library(purrr)
library(webshot) #webshot::install_phantomjs()
library(magick)
library(dplyr)
library(glue)
# load all the CSV files in the data folder downloaded from https://analytics.twitter.com/user/<username>/tweets
my_tweets <- file.path("data", list.files("data", pattern = "^tweet_activity_metrics_")) %>% map_df(readr::read_csv)
get_offsprings <- function(node_to_collapse, phylo) {
# todo: assert that node is scalar
phylo %>%
tidytree::as_data_frame() %>%
tidytree::offspring(.node = node_to_collapse) %>%
dplyr::pull(node)
}
get_offspring_tips <- function(phylo, node_to_collapse) {
# todo: assert that node is scalar

Keybase proof

I hereby claim:

  • I am jeanmanguy on github.
  • I am jeanmanguy (https://keybase.io/jeanmanguy) on keybase.
  • I have a public key ASBB7PdT01pxgfLJDhwg-nDoV7ipwOOEx7r2Jimiv_ta6wo

To claim this, I am signing this object:

@jeanmanguy
jeanmanguy / presidentielle_2017_T1.R
Last active April 29, 2017 18:12
Cleaning and tidying of the French presidential election 2017 official results (1st round)
library(purrr)
library(dplyr)
library(tidyr)
library(readr)
PR17_BVot_T1_FE <- read_csv2(
file = "https://www.data.gouv.fr/fr/datasets/r/8fdb0926-ea9d-4fb4-a136-7767cd97e30b",
locale = locale("fr", encoding = "iso-8859-1"),
col_names = FALSE,
skip = 1