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 /
Last active Jan 13, 2020
allele balance invenstigation in CEPH
nim c -d:danger -d:release -r abs.nim > abs.txt
mkdir -p pngs
rm -f pngs/NA*
rm -f pngs/HG*
convert -delay 25 pngs/*.png -loop 0 abs.gif
View avx512_experiments.nim
import bitops
{.passC:"-mavx512f -mavx512vl -mavx512bw -mpopcnt"}
{.passL:"-mavx512f -mavx512vl -mavx512bw -mpopcnt"}
when defined(vcc):
{.pragma: x86, noDecl, header:"<intrin.h>".}
{.pragma: x86, noDecl, header:"<x86intrin.h>".}
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):
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]
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
vcf_path = commandLineParams()[0]
fasta_path = commandLineParams()[1]
vcf: VCF
View emit-ex.nim
#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.}
You can’t perform that action at this time.