Skip to content

Instantly share code, notes, and snippets.

View tractatus's full-sized avatar

Daniel Fürth tractatus

View GitHub Profile
@tractatus
tractatus / tensorflow-source-windows.md
Last active June 18, 2021 23:15
Speed-up by compiling TensorFlow from source?

Why compiling from source?

The most straigtforward way install TensorFlow is to work in a virtual Python environment and simply to use either the TensorFlow official packages in pip or a wheel (.whl) distribution.

Problems arise at some point when a lot of heavy image processing needs to be done.

Since prediction/inference primarly involves the CPU we might correctly ask ourselves:

Instead of precompiled binaries, that are not optimized for our set of CPU architecture extensions, what would be the speed gain if we would compile TensorFlow from source?

>RNA5-8SN5 URS0000005270_9606 Homo sapiens RNA, 5.8S ribosomal N1 (RNA5-8SN 1 to 3, RNA5-8SN5)
CGACTCTTAGCGGTGGATCACTCGGCTCGTGCGTCGATGAAGAACGCAGCTAGCTGCGAG
AATTAATGTGAATTGCAGGACACATTGATCATCGACACTTCGAACGCACTTGCGGCCCCG
GGTTCCTCCCGGGGCTACGCCTGTCTGAGCGTCGCTT
>18S URS000031689A_9606 Homo sapiens small subunit ribosomal RNA (18S)
TACCTGGTTGATCCTGCCAGTAGCATATGCTTGTCTCAAAGATTAAGCCATGCATGTCTA
AGTACGCACGGCCGGTACAGTGAAACTGCGAATGGCTCATTAAATCAGTTATGGTTCCTT
TGGTCGCTCGCTCCTCTCCTACTTGGATAACTGTGGTAATTCTAGAGCTAATACATGCCG
ACGGGCGCTGACCCCCTTCGCGGGGGGGATGCGTGCATTTATCAGATCAAAACCAACCCG
GTCAGCCCCTCTCCGGCCCCGGCCGGGGGGCGGGCGCCGGCGGCTTTGGTGACTCTAGAT
#load data
data<-read.table('/Users/danielfurth/Downloads/fisseq_output/results.tsv', sep='\t', header=TRUE )
#size select rolonies
data<-data[data$size>4,]
#extract single cycle info
intensity<-lapply(data$intensity,function(x)strsplit(x, ","))
read<-lapply(data$read,function(x)strsplit(x, ","))
comp<-lapply(data$component,function(x)strsplit(x, ","))
qual<-lapply(data$b_quality_pbm,function(x)strsplit(x, ","))
@tractatus
tractatus / index.html
Last active May 30, 2020 20:37
default HTML template
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content=".">
<meta name="author" content="Daniel Furth">
<link rel="icon" href="favicon.ico">
<title>Segment</title>
@tractatus
tractatus / readBioanalyzer.R
Created February 11, 2020 19:53
Read BioAnalyzer data into R for custom plotting
library(drc) #used for fitting Weibull retardation model to get Time vs. Size
clean.up<-function(data){
data<-data[-(nrow(data):(nrow(data)-1)),]
data$Value<-as.numeric(as.vector(data$Value))
data$Time<-as.numeric(as.vector(data$Time))
return(data)
}
find_peaks <- function (data, nt = c(25, 200, 500, 1000, 2000, 4000, 6000), m = 50, k = 2){
@tractatus
tractatus / Stitch WholeBrain Perkin-Elmer
Last active November 26, 2018 19:17
Stitch WholeBrain Perkin-Elmer
#' Sticthing on a Perkin-Elmer instrument
#'
#' This function allows you to stitch image tiles from Perkin Elmer Harmony software contained in a single folder.
#' @param folder a path to a folder containing image tiles in TIFF format and XML file for metadata.
#' @param digits number of significant digits to round up the position X,Y reported by Harmony XML metadata (this is used for matching).
#' @return a character vector with images that have been stitched.
#' @keywords perkin-elmer
#' @export
#' @examples
#' stitch.perkin.elmer('./Images')
@tractatus
tractatus / Stationary Wavelet Experimental
Created September 4, 2018 18:32
RUn this code to get access to experimental imgSWT function
imgSWT <- function(input, filter=NULL, scales=6, cell.bodies = 3, processes = 5, family='db2', sigma=10, processLength=12, alim=c(200, 500), pch=21, bg="white", cex=2, lwd=2, illustrator=F, output='waveletoutput') {
file <- as.character(input)[1]
family <- as.character(family)[1]
outputfile <- as.character(output)[1]
scales<-as.integer(scales)
cellBodies<-as.integer(cell.bodies)
processes <- as.integer(processes)
sigmaR<-as.integer(sigma)
processLength<-as.integer(processLength)
areaSize<-alim
@tractatus
tractatus / ameet.R
Last active July 12, 2018 15:54
Ameet_Berkeley
library(wholebrain)
#set folder path
folder<-'/Users/ameetrahane/Lab/Widlbrecht_Lab/brain-tissue-analysis/sectioned_test_1'
setwd(folder)
subfolders <- list.dirs(path = ".", full.names = TRUE, recursive = TRUE)
data <- data.frame()
#map to atlas coordinates
#set cutting thickness in millimeters
distance.between.sections <- 0.1
@tractatus
tractatus / edit_seg_in_script.R
Last active December 7, 2017 22:55
setting segmentation filter in a script
#just change the numbers here.
# alim = area limits of the soma, lower and upper
# threshold.range = where in intesnity to look for neurons, lower and upper.
# eccentricity = the roundness of neurons, lower means rounder.
# Max = the maximum intensity to do 8 bit rendering on (just for display purposes).
# Min = the minimum intensity to do 8 bit rendering on (just for display purposes).
# brain.threshold = the intensity where you find the autofluorescent outline of the brain section.
# resize = resizing parameter to match atlas and your brain section.
# blur = blurring (higher = more) to apply to the contour of the brain if you have damaged tissue etc.
# downsample = how much to downsample the image to reduce image processing speed.
@tractatus
tractatus / readroi.R
Created September 7, 2017 14:17
readroi ImageJ to R
## readroi.R - Read ImageJ files in to R
## Copyright (C) 2011 David C. Sterratt <david.c.sterratt@ed.ac.uk>
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of