Skip to content

Instantly share code, notes, and snippets.

/**
* The module csv is a set of function to parse many format using a delimitter as csv file
* Supported format:
* - .mat matrix file
* - .bed UCSC file
* For parse a .csv file use std.csv
*/
module bed;
import std.conv;
import std.string;
import std.stdio;
import std.range;
mixin template arrayDelegator( alias instance, methods... ){
static if( methods.length > 0 ){
static if( methods[0] == "opIndexAssign" ){
mixin("
void opIndexAssign( " ~ ElementEncodingType!(typeof(instance)).stringof ~ " value, size_t index ){
array[index] = value;
import std.traits;
import std.stdio;
import std.string;
import std.range;
import std.ascii; // lowercase
static string getFunctionParameterString(T, S)( T ptt, S pstc ) @safe pure nothrow{
enum result = "";
static if( ptt.length > 0 && pstc.length > 0 && ptt.length == pstc.length){
result = ptt[0].stringof ~" "~ pstc.stringof ~" ";
import std.string;
import std.stdio;
import std.range;
import std.lowercase;
mixin template delegates( alias instance, methods... ){
static if( methods.length > 0 ){
static if( hasmembers(instance, methods[0]) ){
alias ReturnType!(methods[0]) type; // function/method type returned for first method
$ diff runtime/phobos/std/regex.d ../phobos/std/regex.d
184c184
< $(WEB http://unicode.org/reports/tr18/, UTS 18). Specifically:
---
> $(WEB unicode.org/reports/tr18/, UTS 18). Specifically:
5560a5561,5564
> static if(direction == OneShot.Fwd)
> startPc = startPc;
> else
> startPc = cast(uint)re.ir.length-IRL!(IR.LookbehindEnd);
@bioinfornatics
bioinfornatics / bencher_sqlite_raw.py
Created March 17, 2020 14:12
bencher sqlite, raw text, others…
#!/usr/bin/env python3
import sqlite3
import random
import string
from uuid import uuid4
from typing import List
from statistics import mean
def random_str():
str_length = random.randint(40,50)
@bioinfornatics
bioinfornatics / pyarrow_learning.py
Last active March 17, 2020 16:02
pyarrow write 2D list into table
#!/usr/bin/env python3
import pyarrow.parquet as pq
import pyarrow as pa
import random
import string
from uuid import uuid4
def random_str():
str_length = random.randint(40,50)
return ''.join(random.choice(string.ascii_lowercase) for _ in range(str_length))
@bioinfornatics
bioinfornatics / bench_parquet_sqlite_raw.py
Last active March 19, 2020 15:29
bench parquet vs sqlite vs raw
#!/usr/bin/env python3
import sqlite3
import random
import string
from uuid import uuid4
from typing import List, Tuple
from statistics import mean
import pyarrow as pa
import pyarrow.parquet as pq
#!/usr/bin/env python3
import sqlite3
import random
import string
from uuid import uuid4
from typing import List
from statistics import mean
def random_str():
str_length = random.randint(40,50)
@bioinfornatics
bioinfornatics / sequence_diagram_abi_stable_library.plantuml
Created September 12, 2023 07:53
sequence diagram using abi_stable_library
@startuml
App -> MyPluginInterface : use specialized defined API
MyPluginInterface -> MyPlugin : call load_from_directory
MyPlugin -> "abi_stable::library::RootModule" : call load_from_directory
"abi_stable::library::RootModule" -> MysharedLib : load .so file
@enduml