Skip to content

Instantly share code, notes, and snippets.

@jackkamm
jackkamm / gist:3b606d15d83063ed8e5f03ae1c7ab928
Last active February 17, 2023 23:08
Augment/convert h5ad for zellkonverter pr 86
import numpy as np
import pandas as pd
import anndata as ad
adata = ad.read_h5ad("/home/jack/src/zellkonverter/inst/extdata/krumsiek11.h5ad")
# add float column to colData/obs
adata.obs['dummy_num'] = 42.42
# float column with NA
<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
virsh edit win10-gaming
or other application using the libvirt API.
-->
<domain type='kvm'>
<name>win10-gaming</name>
<uuid>b562f5ca-4792-4d2d-99be-ece9905ff714</uuid>

Observations from initial testing of ob-session-async-shell.el:

  • Didn’t work with zsh
  • Worked with bash and sh
  • #+RESULTS contains input commands that it shouldn’t, as well as the command printing the end-indicator, for example see the below code block and its #+RESULTS:
    sleep 1
    echo foo
        
[ 0.000000] Linux version 5.2.8-arch1-1-ARCH (builduser@heftig-63215) (gcc version 9.1.0 (GCC)) #1 SMP PREEMPT Fri Aug 9 21:36:07 UTC 2019
[ 0.000000] Command line: initrd=\initramfs-linux.img cryptdevice=UUID=d837c52a-7aca-4e58-a595-ee22f4518288:cryptroot resume=/dev/mapper/cryptroot resume_offset=94031872 root=/dev/mapper/cryptroot rw
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Hygon HygonGenuine
[ 0.000000] Centaur CentaurHauls
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
@jackkamm
jackkamm / backup_home.sh
Created February 2, 2019 23:42
backup $HOME
# This is a simple script to backup, compress, and encrypt $HOME
set +e
# set recipient for encryption
RECIPIENT="jackkamm@gmail.com"
# To improve I/O, keep $DEST on local filesystem,
# and copy it to external medium afterwards
DEST=/var/tmp/backup_home.tar
@jackkamm
jackkamm / bam2consensus.py
Last active November 23, 2023 13:03
Generate consensus fasta from bam file
from collections import Counter, OrderedDict
import pysam
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
def bam2consensus(
ref_fname, bam_fname, ac_threshold, af_threshold, out_fname):
consensus = OrderedDict()
@jackkamm
jackkamm / ncbi-sankey.R
Created November 21, 2018 02:46
sankey visualization of NCBI taxonomy counts in shiny
library(taxizedb)
library(dplyr)
library(purrr)
library(sankeyD3)
library(shiny)
df <- read.csv('data/mosquito_reports/cms_040_rna_a_s21.csv', head=T, stringsAsFactors=F)
df %>%
filter(tax_id > 0, tax_level==1, NT_r > 0) %>%
@jackkamm
jackkamm / download_assembly_db.py
Created October 18, 2018 00:54
Download Genbank Assembly DB fasta with BioPython
import os
import urllib
import xml.etree.ElementTree as ET
from Bio import Entrez
Entrez.email = "jack.kamm@czbiohub.org"
uid = ET.parse(Entrez.esearch(db="assembly", term="GCA_000150765.1")).getroot().find("IdList")[0].text
ftp_path = ET.parse(Entrez.esummary(db="assembly", id=uid)).getroot().find("DocumentSummarySet").find("DocumentSummary").find("FtpPath_GenBank").text
basename = os.path.basename(ftp_path)