Skip to content

Instantly share code, notes, and snippets.

View stratust's full-sized avatar

Thiago Y Oliveira stratust

  • The Rockefeller University
  • New York
View GitHub Profile
@stratust
stratust / ChooseClusterResolutionDownsample.R
Created September 21, 2022 21:40
ChooseClusterResolutionDownsample
# Choose clustering resolution from seurat v3 object by clustering at multiple resolutions and choosing max silhouette score
# Based on code from: https://gist.github.com/BenjaminDoran/a4c8939b2f180b5ddf7e9179697d07ba
ChooseClusterResolutionDownsample <- function(
input.srobj, n.pcs = 1:30, sample.name = format(Sys.time(), "%a-%b-%d-%X-%Y-%Z"),
res.low = .01, res.high=3, res.n = 40, bias = "over", figdir=F, ncores = 1) {
######## step 1: save the input seurat object as a new temporary object,
######## dont want to overwrite or change the original one with all of the parameter scans
srobj.tmp = input.srobj
#!/usr/bin/sh
# use HOMER to find peaks
export analysis_name="histone_noinput_1000_10000"
# Find peaks for Z8-ChIP_S1_R1_001
mkdir -p findPeaks_${analysis_name}/Z8-ChIP_S1_R1_001
findPeaks tags/Z8-ChIP_S1_R1_001 \
-style histone -region -size 1000 -minDist 10000 \
@stratust
stratust / get_pattern.pl
Created April 25, 2017 14:21
usage: "perl get_pattern.pl pattern.fasta genome.fasta > output_example.bed"
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw(say);
use Bio::SeqIO;
my $pattern_file = shift @ARGV;
my $genome_file = shift @ARGV;
@stratust
stratust / dataprinter.py
Created April 18, 2017 15:28
Simulate Perl Data::Printer in python using a combination of pygments and jsonpickle
#!/usr/bin/env python
"""A simple python script template.
"""
from pygments import highlight
from pygments.lexers import JsonLexer
from pygments.formatters import Terminal256Formatter
import jsonpickle
@stratust
stratust / dbix_candy_simple.pl
Last active August 29, 2015 14:07
dbix_candy_simple.pl
#!/usr/bin/env perl
use feature qw(say);
use MooseX::Declare;
use Method::Signatures::Modifiers;
class MyApp::Schema::Result::Role {
use MooseX::NonMoose;
use MooseX::MarkAsMethods autoclean => 1;
use DBIx::Class::Candy -autotable => v1;
@stratust
stratust / test.pl
Created August 28, 2014 15:08
Test Gist to Evernote
print "Hello world\n";
my $var = 10;
print $var;
perlbrew install perl-5.16.3 -Dusethreads \
-Duselargefiles -Dcccdlflags=-fPIC -Doptimize=-O2 \
-Duseshrplib -Duse64bitall -Darchname=x86_64-linux-gnu \
--as threaded-perl-5.16.3
@stratust
stratust / create_picard_scripts.sh
Created September 23, 2012 22:46
Create wrapper scripts for use picard commands as standard unix commands
#!/bin/sh
picard_jars='/data_alpha/local/bioinformatic_tools/picard-tools-1.77'
bin="$picard_jars/bin"
for i in $picard_jars/*.jar
do
command_name=`echo $i | perl -plane 's/.*\/(\S+).jar/$1/g'`
echo $command_name
echo '#!/usr/bin/env sh' > $bin/$command_name
echo 'java -jar '$i' $@' >> $bin/$command_name
#!/bin/sh
sudo tc qdisc del dev wlan0 root
sudo tc qdisc del dev eth0 root