Skip to content

Instantly share code, notes, and snippets.

View IdoBar's full-sized avatar

Ido Bar IdoBar

View GitHub Profile
@IdoBar
IdoBar / install.deps.R
Last active July 31, 2016 22:16
Install dependencies in R
# Load GO and DE data to R
## @knitr prep_data
# Install missing CRAN packages if needed
# git.packages <- c("docopt/docopt.R")
# github.packages <- c("argparser")
install.deps <- function(p, repo="cran"){
call_install <- switch(repo,cran=c("install.packages(package, repos=\"http://cloud.r-project.org/\""),
@IdoBar
IdoBar / callPrimer3.R
Last active July 26, 2022 16:05 — forked from al2na/callPrimer3.R
calling primer3 from R
#' call primer3 for a given set of DNAstringSet object
#' Forked from https://gist.github.com/al2na/8540391
#' TODO: Add support for target amplicon region (Maybe as [] in the fasta input)
#' @param seq: DNA template as a character string (required)
#' @param fw_primer: optional forward (left) primer, if provided Primer3 will assess it and will try to find a suitable reverse primer. Default: NULL
#' @param rv_primer: optional reverse (right) primer (must be reverse-complemented to the template), if provided Primer3 will assess it and will try to find a suitable forward primer. Default: NULL
#' @param size_range: a string with space separated list of desired amplicon size ranges. Default: '151-500'
#' @param Tm: range of melting temprature parameters as a numerical vector containing (min,optimal,max). default: c(55,57,58)
#' @param name: name of the amplicon in 'chr_start_end' format
#' @param sequence_target: a string containing space separated list of target pairs: 'starting_position,target_length starting_p
@IdoBar
IdoBar / FlipImage.ps1
Created July 12, 2016 13:54
FlipImage PowerShell script used to rotate images in windows from R
$path = $args[0]
[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms");
$i = new-object System.Drawing.Bitmap $path
$i.RotateFlip("Rotate90FlipNone")
$i.Save($args[1],"png")
@IdoBar
IdoBar / split_blast_with_GNU-Parallel.bash
Last active October 6, 2017 10:34
A bash script using GNU-Parallel to split fasta file, process it in parallel (Blast, HMMscan, etc.) and combine the output parts
#!/bin/bash -v
# Define these according to the run
N=5000
NCPUS=4
# Use wildcards or specify an exact input fasta filename below (should be in your current working directory)
INPUT_FASTA="input.fasta"
DATE=`date +%d_%m_%Y`
REFDB="nt"
#CMD=`printf "hmmscan --cpu %s --domtblout \%s/\%s.pfam.domtblout ~/.hmmer-3.1/Pfam/Pfam-A.hmm \%s > \%s/\%s_pfam.log",$NCPUS`
@IdoBar
IdoBar / install-plenv.sh
Last active August 31, 2021 11:28 — forked from revmischa/install-plenv.sh
Set up plenv, install perl, cpanm, carton, set up environment
#!/bin/bash
# installs plenv, perl, carton, cpanminus, sets up environment in .bash_profile or .profile
# from https://github.com/tokuhirom/plenv#readme
MY_PROFILE_FILE="$HOME/.profile"
if [[ -n "$PERL_MB_OPT" ]]; then
echo "You must unset your local::lib environment variables first"
echo "Edit your ~/.bash_profile or ~/.bashrc and remove any references"
echo "to local::lib or export PERL*..."
@IdoBar
IdoBar / util.R
Last active October 12, 2023 05:37
A set of utilities to make easier R working environment
# util.R:
# Utilities to make R a happier place
# Originally created by Brendan O'Connor, brenocon.com/code
# Edited by Ido Bar.
# Source the file directly from this gist using `devtools::source_gist("7f63547158ecdbacf31b54a58af0d1cc", filename = "util.R")`
########################################
## Put everything into an environment, to not pollute global namespace
@IdoBar
IdoBar / .Rprofile
Last active January 26, 2020 12:05
Example of my .Rprofile
# If loading in an environment that doesn't respect my RPATH environment
# variable, set it here
sourceDir <- file.path(path.expand("~"), "R", "source")
if (Sys.getenv("RPATH") == "") {
if (!file.exists(sourceDir)) dir.create(sourceDir)
Sys.setenv(RPATH=sourceDir)
}
# Load commonly used functions and packages
@IdoBar
IdoBar / updated_parallel_split_blast.sh
Last active May 16, 2017 01:26
An updated version of the original split_blast_with_GNU-Parallel.bash script, accepting command line argumens, to allow using it from within scripts and automate in pipelines
#!/bin/bash
_usage() {
cat <<EOF
$*
Usage: $0 <[options]>
Options:
-i --in input fasta file. If not specified will defaults to stdin [-]
-o --out output combined results file. If not specified will defaults to stdout [-]
-p --parts how many parts to break to input fasta into [default:5000]
@IdoBar
IdoBar / New_computer_setup.md
Last active February 25, 2020 03:50
Setting up a new computer for scientific and bioinformatics data analysis

Setting up a new computer for scientific and bioinformatics data analysis

Follow these instructions to setup a new computer with commonly used tools and software for scientific data analysis (with emphasis on bioinformatics)

Windows machine

Use https://ninite.com/ to install the following open source software:

  1. FileZilla - FTP file transfer
  2. Firefox - web browser, add cliget addon for easy curl/wget download links
  3. PuTTY - remote shell access
  4. Java 8
  5. .NET - framework needed for Paint.net
@IdoBar
IdoBar / UniRef90.md
Created May 29, 2017 23:01 — forked from sujaikumar/UniRef90.md
UniRef90 protein blast database with taxon IDs

Goal

  • To create UniRef90 protein databases for NCBI blast and Diamond Blast
  • To create a tab delimited taxid mapping file with two columns : sequenceID\tNCBITaxonID

Steps:

Download the uniref90 xml file first (warning - this is ~15 GB, will take a while)