Skip to content

Instantly share code, notes, and snippets.

View zktuong's full-sized avatar

Zewen Kelvin Tuong zktuong

View GitHub Profile
name=getTitle;
dir = getDirectory("image");
path=dir+name
Final2 = path+"_final"
run("Set Measurements...", "area limit redirect=None decimal=3");
Stack.setDisplayMode("color");
Stack.setChannel(2);
resetMinAndMax();
Stack.setChannel(3);
resetMinAndMax();
@zktuong
zktuong / Batch Counting IHC.ijm
Created August 22, 2017 02:04 — forked from eeelinn/Batch Counting IHC.ijm
ImageJ macro that semi-automatically counts multiple DAB positively stained nuclei samples from IHC experiments in a batch. Influenced by: https://gist.github.com/zktuong/2b281aed13a089abb1de2b03a177754d
//NOTE: Before counting, please go to Analyze>>Set Scale and set the scale for image in pixels/um. Check "global" to maintain the same scale for all the images.
input = getDirectory("Input directory"); //Folder with images you want counted
output = getDirectory("Output directory"); //Folder where you want to save the new data (saves image of positive and total cells each)
keyword = "5HT"; //Keyword in the file names that you want (in case there are other photos in the folder)
suffix = ".tif"; //Works with tiff images
processFolder(input);
waitForUser("Batch Completed", "Batch Counting IHC has finished. Thank you for using!");
@zktuong
zktuong / VarScan2_format_converter_oncotator converter.py
Last active April 4, 2017 00:34 — forked from PoisonAlien/VarScan2_format_converter.py
NativeToVcf() creates a vcf file that oncotator can use as input. As before, the script will auto detect the input format (native or vcf). Only goes one way at the moment: Standard VarScan2 VCF output -> Standard VarScan2 native output -> oncotator-friendly VCF
__author__ = "Anand M, edited to be a oncotator input friendly version by ZK Tuong"
'''
Takes output file generated by VarScan2 somatic programme and converts the formats.
'''
import argparse, math, re
parser = argparse.ArgumentParser(
description="Converts VarScan2 somatic vcf to native format and vice-versa.\nInput is automatically detected")
@zktuong
zktuong / BubbleTreeInputFilePrep.R
Last active April 3, 2017 23:12
Generate .rda files from i) called copynumber files (VarScan2 CNV pipeline) and ii) VCF file (MuTect VCF unfiltered output). The two .rda files can then be used as input for BubbleTree prediction.
#!/usr/bin/env Rscript
# written by ZKTUONG z.tuong@uq.edu.au
# purpose is to automate the file prep steps to generate the right files as input for BubbleTree prediction analysis
# to invoke the script, do:
# Rscript --vanilla BubbleTreeInputFilePrep.R -cna [called somatic CN file] -vcf [mutect output VCF file] -snvout [output SNV R dataset] -cnvout [output CNV R dataset] -name [sample ID/name]
library(optparse);
option_list = list(
make_option(c("-cna", "--cna"), type="character", default=NULL,
@zktuong
zktuong / TumorVsNecroticTissueQuant.ijm
Created March 22, 2017 03:27
Basic imageJ macro to separate purple and pink areas from H&E stained IHC images to quantify size of tumor vs necrotic tissues
setTool("line");
waitForUser("Image selection", "Please zoom in (+) to where the scale bar is and then draw a line over the scale bar. Click 'OK' when ready.")
run("Original Scale");
run("Set Scale...");
run("Select None");
setTool("polygon");
waitForUser("Image selection", "Please draw to select area you want to keep for analysis\nIf you need to adjust, finish drawing first. Click 'OK' when ready.")
roiManager("Add");
run("Make Inverse");
setBackgroundColor(255, 255, 255);
@zktuong
zktuong / CountingBrownObjects.ijm
Created March 22, 2017 03:25
Basic imagej macro to count DAB positively stained nuclei from IHC experiments
// To run this script, you need to first save screen grab of your tiff.
// This script is set up for 50-66% zoom in OliVia.
// Then click Run when you're ready and wait for prompts. =)
// splits images to other colors
run("Set Measurements...", "area limit redirect=None decimal=3");
run("Colour Deconvolution", "vectors=[H DAB]");
waitForUser("Image selection", "Please select the brown image as have it as the front image. Then Click 'OK'.")
// change brown image to b/w