Skip to content

Instantly share code, notes, and snippets.

View joelnitta's full-sized avatar

Joel Nitta joelnitta

View GitHub Profile
@joelnitta
joelnitta / stop-dockerd.sh
Created June 5, 2020 04:37
Stop a docker daemon using a stored PID
#!/usr/bin/bash
# Kill the job using the saved ID
kill -9 `cat dockerd.pid`
rm dockerd.pid
rm dockerd.log
@joelnitta
joelnitta / resume_example.Rmd
Last active August 27, 2020 07:40
Formatting for Rmd resume
---
title: "Resume"
output:
rmarkdown::word_document:
reference_docx: "custom-reference-2.docx"
---
##### Employer: Apple Date: 2000
@joelnitta
joelnitta / fastp_se.cwl
Created November 26, 2020 07:16
fastp (single-end) cwl tool
cwlVersion: v1.0
class: CommandLineTool
hints:
DockerRequirement:
dockerPull: quay.io/biocontainers/fastp:0.20.1--h8b12597_0
baseCommand: fastp
inputs:
@joelnitta
joelnitta / fastp-job.yml
Last active November 27, 2020 06:30
fastp (single end) cwl job
in1:
class: File
path: raw-sequence.fastq.gz
out1: trimmed.fastq.gz
html: report.html
json: report.json
@joelnitta
joelnitta / start-dockerd.sh
Created December 23, 2020 05:58
Start rootless docker daemon
#!/usr/bin/bash
# Start docker daemon in background
nohup dockerd-rootless.sh --experimental --storage-driver vfs >| dockerd.log 2>&1 &
# Save the process ID so we can kill it later
echo $! > dockerd.pid
@joelnitta
joelnitta / stop-dockerd.sh
Created December 23, 2020 05:59
Stop rootless docker daemon
#!/usr/bin/bash
# Kill the job using the saved ID
kill -9 `cat dockerd.pid`
rm dockerd.pid
rm dockerd.log
@joelnitta
joelnitta / alice.txt
Created January 19, 2021 05:53
alice
Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, “and what is the use of a book,” thought Alice “without pictures or conversations?”
So she was considering in her own mind (as well as she could, for the hot day made her feel very sleepy and stupid), whether the pleasure of making a daisy-chain would be worth the trouble of getting up and picking the daisies, when suddenly a White Rabbit with pink eyes ran close by her.
There was nothing so very remarkable in that; nor did Alice think it so very much out of the way to hear the Rabbit say to itself, “Oh dear! Oh dear! I shall be late!” (when she thought it over afterwards, it occurred to her that she ought to have wondered at this, but at the time it all seemed quite natural); but when the Rabbit actually took a watch out of its waistcoat-pocket, and looked at it, and then hurried on, Alice s
@joelnitta
joelnitta / filmy_tree.nwk
Created January 27, 2021 05:11
Filmy fern tree
[Filmy ferns (family hymenophyllaceae) from Moorea, French Polynesia]
[extracted from original tree file 'data_and_scripts/Phylo_Analysis/data/RAxML_bipartitions.all_broad.reduced']
[from Nitta 2017 https://doi.org/10.5061/dryad.df59g]
((Hymenophyllum_pallidum:37.640917,(Hymenophyllum_digitatum:34.732943,(Hymenophyllum_javanicum:34.626438,(Hymenophyllum_polyanthos:27.555333,Hymenophyllum_multifidum:27.555334)72:7.071105)12:0.106504)28:2.907974)40:180.075944,(Callistopteris_apiifolia:184.754946,(Abrodictyum_dentatum:176.779987,((Polyphlebium_borbonicum:43.831809,Polyphlebium_endlicherianum:43.831809)59:120.99542,(Didymoglossum_tahitense:158.642039,(Vandenboschia_maxima:150.345143,((Crepidomanes_minutum1:19.391489,(Crepidomanes_minutum3:14.96513,Crepidomanes_minutum2:14.96513)70:4.426359)99:60.813946,(Crepidomanes_humile:49.60898,(Crepidomanes_kurzii:18.703906,Crepidomanes_bipunctatum:18.703906)26:30.905073)94:30.596454)88:70.139707)73:8.296898)69:6.18519)98:11.952757)20:7.974959)98:32.961915)100;
@joelnitta
joelnitta / ggtree_show_bs
Last active January 27, 2021 05:22
How to print bootstrap support values with ggtree
# How to print bootstrap support values with ggtree
library(ape)
library(ggtree)
library(tibble)
# phy is a list of class 'phylo' as defined in ape, with node labels
# as typically obtained after running ape::read.tree() on a tree in newick format
# (here, filmy ferns from Moorea, French Polynesia)
phy <- read.tree("https://gist.githubusercontent.com/joelnitta/11b80d76cc44b7d0492cc6f7fe0acaa8/raw")
@joelnitta
joelnitta / gb_acc_to_taxonomy.R
Last active February 5, 2021 02:56
Go from genbank accession numbers to taxonomic data in the NCBI database
# Go from genbank accession numbers to taxonomic data from the NCBI database
# `accs` is a (long) list of genbank accession numbers
# can only search max ca. 200 at a time because of NCBI limits
gb_acc <- rentrez::entrez_search(db = "nuccore", term = paste(accs[1:200], collapse = "|"), use_history = TRUE, retmax=200)
# For each accession, link to the taxonomy database
gb_tax_links <- rentrez::entrez_link(dbfrom = "nuccore", db = "taxonomy", id = gb_acc$ids)
# Query the taxonomy database using the IDs in the links. Output is XML