Skip to content

Instantly share code, notes, and snippets.

@zachcp
zachcp / Makefile
Last active January 2, 2023 23:50
Experiment with Cyber for Fasta
run:
./cyber readfq.cy < test.fasta
# 190 Mb
downloadref:
wget https://ftp.ncbi.nlm.nih.gov/genomes/genbank/metagenomes/human_skin_metagenome/latest_assembly_versions/GCA_013297495.1_ASM1329749v1/GCA_013297495.1_ASM1329749v1_genomic.fna.gz
gunzip GCA_013297495.1_ASM1329749v1_genomic.fna.gz
test_cy:
@zachcp
zachcp / index.html
Created November 27, 2022 19:07
Example of uploading and parsing a GBK file with Pyodide + Biopython
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/pyodide/v0.21.3/full/pyodide.js"></script>
</head>
<body>
Pyodide test page <br>
Open your browser console to see Pyodide output
<p>You can execute any Python code. Just enter something in the box below and click the button.</p>
@zachcp
zachcp / molt-to-svg.R
Created October 5, 2022 18:44
Molecule in GGPlot Via SVG
library(dplyr)
library(depict)
library(grid)
library(ggplot2)
library(svgparser)
# SVG code to make background box transparent
my_css = '
rect {
fill: none;
@zachcp
zachcp / benchmarks.R
Created September 19, 2022 14:22
Metabolomics benchmarks update
# install.packages("microbenchmark")
# install.packages("plyr")
#
# install.packages("rcdk")
# install.packages("OrgMassSpecR")
# install.packages("CHNOSZ")
#
# BiocManager::install("Rdisop")
# BiocManager::install("MetaboCoreUtils")
#
@zachcp
zachcp / List FK Relationships
Last active March 3, 2021 16:32
Foreign Key Ordering
select kcu.table_schema || '.' ||kcu.table_name as foreign_table,
'>-' as rel,
rel_tco.table_schema || '.' || rel_tco.table_name as primary_table,
string_agg(kcu.column_name, ', ') as fk_columns,
kcu.constraint_name
from information_schema.table_constraints tco
join information_schema.key_column_usage kcu
on tco.constraint_schema = kcu.constraint_schema
and tco.constraint_name = kcu.constraint_name
join information_schema.referential_constraints rco
@zachcp
zachcp / download.sh
Last active August 13, 2020 21:59
NPAtlas DataLevin Test
wget https://www.npatlas.org/custom/versions/np_atlas_2020_06/NPAtlas_download.json
@zachcp
zachcp / Import Poacket.scpt
Created February 14, 2020 12:39
Pocket-to-DevonThink
-- POCKET2DEVONTHINK
-- script imports articles from a local Pocket for Mac app into the inbox of the current Devonthink database
-- script comes with the use-it-like-you-want-to-and-dont-blame-me licence
-- last changed on Jan 5, 2015
-- recent changes: errorhandling; pdfs for pocket records without mime setting; conditional searches
-- USER SETTINGS; please adopt to your needs
--loop_min/max define the range of pocket articles to be imported
-- 1/10 would, e.g., import the first ten articles you've ever stored in Pocket
-- 1 and, say, 100000 would presumably move all of them into DT
@zachcp
zachcp / devtools_check.log
Created January 20, 2020 17:49
rCDK build failure 20200120
* using log directory ‘/private/var/folders/yc/53w8dbxx2hjg11_brr2pj5740000gn/T/RtmpWPpy1T/rcdk.Rcheck’
* using R version 3.6.0 (2019-04-26)
* using platform: x86_64-apple-darwin15.6.0 (64-bit)
* using session charset: UTF-8
* using options ‘--no-manual --as-cran’
* checking for file ‘rcdk/DESCRIPTION’ ... OK
* this is package ‘rcdk’ version ‘3.4.9.2’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
(require '[clj-http.client :as client])
(require '[clojure.data.csv :as csv])
(require '[clojure.java.io :as io]))
(require '[mundaneum.query :refer [describe entity label property query stringify-query *default-language* clojurize-results Clojurizable]])
(require '[mundaneum.properties :refer [properties]])
(require '[backtick :refer [template syntax-quote]])
;; data loading functions
@zachcp
zachcp / count-duplicate-inchis.sparql
Last active December 8, 2019 16:09
Some WikiData Queries
SELECT (COUNT(*) as ?agg)
WHERE {
SELECT (COUNT(*) as ?count)
WHERE {
?item wdt:P235 ?inchi .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
}
GROUP BY ?item
HAVING( COUNT(?inchi) > 1)
LIMIT 1000