Skip to content

Instantly share code, notes, and snippets.

View louismullie's full-sized avatar

L louismullie

View GitHub Profile
-- Function to split the input query and generate all contiguous combinations
CREATE FUNCTION split_to_table(@input_query VARCHAR(MAX))
RETURNS @result TABLE (combination VARCHAR(MAX))
AS
BEGIN
DECLARE @words TABLE (id INT IDENTITY(1,1), word VARCHAR(255))
DECLARE @total_words INT, @i INT, @j INT, @current_combination VARCHAR(MAX)
-- Step 1: Splitting the input string into words
INSERT INTO @words (word)
@louismullie
louismullie / carescape-parser.py
Last active June 15, 2023 20:08
CareScape parser
import re
from struct import iter_unpack
from quopri import decodestring
import magic
import matplotlib.pyplot as plt
import numpy as np
# Constants
UNITS = {
Hey dahani9091 (ChatGPT project)
novo_test = pd.read_csv("test.csv")
novo_test
df_cavity = pd.read_csv('/content/gdrive/MyDrive/Kaggle/cavity_pred_CUSTOM_A.csv', low_memory=False)
df_cavity = df_cavity.rename(columns={'variant': 'mutation_key'})
df_cavity
novo_test2 = novo_test.copy().rename({'protein_sequence': 'mutant_seq', 'seq_id': 'source_df_id'}, axis = 1)
novo_test2['sequence'] = 'VPVNPEPDATSVENVALKTGSGDSQSDPIKADLEVKGQSALPFDVDCWAILCKGAPNVLQRVNEKTKNSNRDRSGANKGPFKDPQKWGIKALPPKNPSWSAQDFKSPEEYAFASSLQGGTNAILAPVNLASQNSQGGVLNGFYSANKVAQFDPSKPQQTKGTWFQITKFTGAAGPYCKALGSNDKSVCDKNKNIAGDWGFDPAKWAYQYDEKNNKFNYVGK'
novo_test2 = novo_test2.apply(find_mut,axis=1)
@louismullie
louismullie / requests.js
Last active March 25, 2021 02:01
coda19-dashboard-requests
// Requête no. 1
{
"header": {},
"body": {
"selectors": [
{
"resource": "Patient",
"filters": [
{ "path": "code",
"operator": "matches",
def auc_roc(y_true, y_pred):
# can be any tensorflow metric
value, update_op = tf.contrib.metrics.streaming_auc(y_pred, y_true)
# find all variables created for this metric
metric_vars = [i for i in tf.local_variables() if 'auc_roc' in i.name.split('/')[1]]
# Add metric variables to GLOBAL_VARIABLES collection.
# They will be initialized for new session.
for v in metric_vars:
tf.add_to_collection(tf.GraphKeys.GLOBAL_VARIABLES, v)
Import libraries (tensorflow backend)
from keras.models import Sequential
from keras.layers import Conv2D
from keras.layers import MaxPooling2D
from keras.layers import Flatten
from keras.layers import Dense
from keras.preprocessing.image import ImageDataGenerator
import matplotlib.pyplot as plt
import numpy as np
# Lab data
query = "SELECT lab_data.patient_site_uid, lab_name, lab_sample_time, lab_result_value, lab_sample_type from lab_data " + \
" INNER JOIN patient_data ON " + \
" lab_data.patient_site_uid = patient_data.patient_site_uid WHERE " + \
" (lab_data.lab_sample_type = 'venous_blood' OR " + \
" lab_data.lab_sample_type = 'arterial_blood' OR " + \
" lab_data.lab_sample_type = 'unspecified_blood') AND " + \
" lab_data.lab_result_status = 'resulted' " + \
inclusion_flag
@louismullie
louismullie / example.js
Last active July 24, 2020 21:03
Example D3-Node-R stack
const R = require('r-script')
const express = require('express')
const app = module.exports = express()
app.use(app.router)
app.get("/dashboard", function (req, res, next) {
res.send("Some HTML with D3.js code")
})
@louismullie
louismullie / Observation-Labs.js
Last active July 20, 2020 20:46
JSON template for the Observation FHIR resource
{
// The type of resource
"resourceType" : "Observation",
// The status of the observation
"status": "final",
// Time of the observation
"effectiveDateTime": "YYYY-MM-DDThh:mm:ss+zz:zz",