Skip to content

Instantly share code, notes, and snippets.

View mathieulemieux's full-sized avatar

Mathieu Lemieux mathieulemieux

  • Genome Sciences Centre - BC Cancer
  • Vancouver, Canada
View GitHub Profile
@mathieulemieux
mathieulemieux / dictionaryComprehension.py
Created October 4, 2022 23:44
Dictionary comprehension
keys = ('a', 'b', 'c')
Vais = (1, 2, 3)
myDict = {k:v for k, v in zip(keys, vals)}
@mathieulemieux
mathieulemieux / binary.py
Created September 17, 2022 21:48
decimal_to_binary
import sys
def transform(nb):
binary = '0' if nb == 0 else ''
while nb > 0:
binary += str(nb % 2)
nb = nb // 2
padding = 8 - (8 if len(binary) % 8 == 0 else len(binary) % 8)
padded = (padding * '0') + binary[::-1]
const { applyFix } = require('./util');
const test = async (session) => {
console.time('Execution Time');
const test = await session.query(
`SELECT @class, reference1, reference2 FROM Variant
WHERE deletedAt IS NULL`,
).all();
console.log(`There are ${test.length} Variant`);
@mathieulemieux
mathieulemieux / normalizeEvidenceLevel.py
Last active July 28, 2022 17:27
GSC - GraphKB EvidenceLevel
import os
import re
from graphkb import GraphKBConnection
def main():
"""
This script updates the GraphKB database via its API.
It adds crossReferenceOf edges to EvidenceLevel records to reference normalized ipr levels.
@mathieulemieux
mathieulemieux / fib.py
Last active June 16, 2022 19:09
fibonnacci
def fib(n, k):
if n in (1, 2):
return 1
return fib(n-1, k) + fib(n-2, k)*k
print(fib(5, 3))
def fib_memo(n, k):
@mathieulemieux
mathieulemieux / evidenceItemsQuery.graphql
Last active April 15, 2022 18:28
GSC - Civic loader
query evidenceItems(
$after: String
$assertionId: Int
$before: String
$clinicalSignificance: EvidenceClinicalSignificance
$clinicalTrialId: Int
$description: String
$diseaseId: Int
$diseaseName: String
$drugId: Int
@mathieulemieux
mathieulemieux / allSolidTumors.js
Last active April 4, 2022 19:10
GSC - all solid tumors ontology
/*
To be runned on orientdbdev.bcgsc.ca server
*/
const fs = require('fs');
const { OrientDBClient } = require('orientjs');
const setClient = async () => {
const client = await OrientDBClient.connect({
host: 'localhost',

global.graphkbRequests.push({ opt, result: { result: {} } }); global.graphkbRequests[global.graphkbRequests.length - 1].result = result;

Alternatively, you can just paste from the clipboard
@mathieulemieux
mathieulemieux / LICENSE
Last active December 2, 2021 21:27
Template files
MIT License
Copyright (c) 2021 Mathieu Lemieux
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: