Skip to content

Instantly share code, notes, and snippets.

Brent Pedersen brentp

Block or report user

Report or block brentp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@brentp
brentp / ex.pyx
Created Apr 24, 2019
how to access pysam internals from external cython project
View ex.pyx
from pysam.libcalignmentfile cimport AlignmentFile
cdef AlignmentFile samfile = AlignmentFile("../normal.bam", "rb")
print samfile.reference_filename
print samfile.b == NULL
View defer_speed.nim
import times
type AThing = ref object
i: int
iterator items(a:AThing): int =
when defined(dodefer):
defer:
a.i = 11
View set_times.nim
import times
import intsets
import tables
import sets
# cardinality for builtin sets is slow.
# nim c -d:release -r t.nim
# vs
# nim c -d:card -d:release -r t.nim
View count-af.nim
import hts/vcf
import os
var gnomad_path = commandLineParams()[0]
var
gvcf:VCF
total:int
mid:int
View mt_heteroplasmy.nim
import os
import stats
import hts
import plotly
import strformat
import bpbiopkg/pedfile
#[
look at allele balance on mitochondrial chromosome.
this only plots sites for each sample that have an allele balance (alt / ref + alt) between 0.01 and 0.99.
View debug_error.nim
type Signal* = object
left*: uint32
right*: uint32
left_exact* {.bitsize: 1.}: uint32
right_exact* {.bitsize: 1.}: uint32
when defined(debug):
name*: string
proc makeSignal(): Signal =
result.left_exact = 1'u32
View giab_ins_to_dup.nim
import hts
import strformat
import os
import osproc
import tables
var
vcf_path = commandLineParams()[0]
fasta_path = commandLineParams()[1]
vcf: VCF
View emit-ex.nim
{.emit:"""
#define bam_get_qual(b) ((b)->data + ((b)->core.n_cigar<<2) + (b)->core.l_qname + (((b)->core.l_qseq + 1)>>1))
""".}
proc bam_get_qual*(b: ptr bam1_t): ptr uint8 {.importc, nodecl.}
View custom-ami-i3-8xl.sh
# http://docs.aws.amazon.com/batch/latest/userguide/create-batch-ami.html
sudo yum update
sudo yum install -y grub
sudo yum install -y ecs-init
sudo reboot now
sudo stop ecs
sudo rm -rf /var/lib/ecs/data/ecs_agent_data.json
sudo -E su
View geneplot.py
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import gridspec
import seaborn as sns
sns.set_style('white')
def geneplot(exons, patho_variants, population_variants=None, constraint=None,
density=None,
opts={'constraint_color': (0.7, 0.7, 0.7),
You can’t perform that action at this time.