Skip to content

Instantly share code, notes, and snippets.

View kstawiski's full-sized avatar

Konrad Stawiski MD PhD kstawiski

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kstawiski
kstawiski / SampleSizeEstimation.R
Last active April 7, 2022 13:25
Sample size estmation for circulating miRNA biomarker study based on nonlinear weighted least squares optimization.
# This code is a part of paper entitled: "Deep learning-based integration of circulating and cellular miRNAs expression of pancreatic cancer"
# Author: Konrad Stawiski, MD, PhD (konrad@konsta.com.pl; https://konsta.com.pl)
# Based on https://bmcmedinformdecismak.biomedcentral.com/articles/10.1186/1472-6947-12-8
library(dplyr)
setwd("C:/Users/konra/OneDrive/Doktorat/Analiza/Szacowanie")
set.seed(1)
# Get exemplary file
Elias2017 <- data.table::fread("Elias2017.csv")
@kstawiski
kstawiski / gist:5e7bd54b33b83a84c312b9a774970eea
Created February 28, 2022 22:24
Symlink to OneDrive directory
mklink /J "C:\Projekty\" "C:\Users\Konrad\OneDrive - Uniwersytet Medyczny w Łodzi\"
@kstawiski
kstawiski / setup.sh
Created February 11, 2022 12:08
Create ChromeOS image for Grub2win on linux server
#!/bin/bash
wget https://github.com/sebanc/brunch/releases/download/r97-stable-20220121/brunch_r97_stable_20220121.tar.gz
# Chrome OS image: https://cros-updates-serving.appspot.com/
wget https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_14324.62.0_rammus_recovery_stable-channel_mp-v2.bin.zip
sudo apt install -y pv cgpt
tar xvzf brunch_*.tar.gz
unzip chromeos_*.bin.zip
sudo bash chromeos-install.sh -src chromeos_*.bin -dst chromeos.img -s 32 # 32 GB image
@kstawiski
kstawiski / Analysis.R
Last active February 3, 2022 00:39
Supplementary code to paper entatiled "The prognostic value of PI-RADS score in CyberKnife ultra-hypofractionated radiotherapy for localized prostate cancer." by Miszyk et. al. Code by Konrad Stawiski MD, PhD (konrad@konsta.com.pl, https://konsta.com.pl).
# -*- coding: utf-8 -*-
options(reticulate.conda_binary = "/opt/conda/bin/conda") # conda path
library(survival)
library(ranger)
library(ggplot2)
library(dplyr)
library(readr)
completed = read_csv("pirads_v0_complete.csv")
library(ggpubr)
library(ggsci)
temp = data.frame("Przyjęcie" = dane$Poczatkowe.stezenie.kreatyniny.w.trakcie.hospitalizacji., "Wypis" = dane$Stezenie.kreatyniny.przy.wypisie.)
a = ggpaired(temp, cond1 = "Przyjęcie", cond2 = "Wypis", palette = "npg", xlab = "", ylab = "Kreatynina", line.color = "grey", point.size = 0.01)
describe(temp)
wilcox.test(temp$Przyjęcie, temp$Wypis, paired = T)
t.test(temp$Przyjęcie, temp$Wypis, paired = T)
gridExtra::grid.arrange(a, ncol = 1)
@kstawiski
kstawiski / gist:f4c79f18f1a470157aca34ac500a4fba
Created November 19, 2021 18:33
Load Excel file and make character variables factors
library(readxl)
library(dplyr)
dane <- read_excel("dataset_uzupelniony.xlsx") %>% mutate_if(is.character,funs(factor(.)))
@kstawiski
kstawiski / 02_deeplearning.R
Created November 19, 2020 20:28
OmicSelector DeepLearning snippets
library(OmicSelector); set.seed(1);
if(!dir.exists("/OmicSelector/temp")) { dir.create("/OmicSelector/temp") }
OmicSelector_load_extension("deeplearning")
library(data.table)
#use_session_with_seed(1)
#selected_miRNAs = c("hsa.miR.192.5p",
# "hsa.let.7g.5p",
# "hsa.let.7a.5p",
# "hsa.let.7d.5p",
# "hsa.miR.194.5p",
suppressMessages(library(rmdformats))
suppressMessages(library(dplyr))
suppressMessages(library(plyr))
suppressMessages(library(tidyverse))
suppressMessages(library(reshape2))
suppressMessages(library(xlsx))
suppressMessages(library(psych))
suppressMessages(library(knitr))
suppressMessages(library(gplots))
suppressMessages(library(car))
@kstawiski
kstawiski / ks_miRNAhelpers.R
Last active February 12, 2020 23:36
miRNAhelpers - code for miRNA feature selection (publication in progress..)
library(plyr)
library(dplyr)
library(edgeR)
library(epiDisplay)
library(rsq)
library(MASS)
library(Biocomb)
library(caret)
library(dplyr)
library(epiDisplay)