Skip to content

Instantly share code, notes, and snippets.

View BrunoGrandePhD's full-sized avatar

Bruno Grande BrunoGrandePhD

View GitHub Profile
#############################################
pwd
STDOUT
/home/galaxy/galaxy_dist/database/tmp/tmp-toolshed-mtdIAQaet/ensembl-tools-release-77
#############################################
#############################################
pwd
STDERR
@BrunoGrandePhD
BrunoGrandePhD / gist:4277625d8be45e6a4840
Created October 25, 2014 02:38
Bootstrap Command and Output
$ sh galaxy_dist/run_tool_shed.sh -bootstrap_from_tool_shed http://toolshed.g2.bx.psu.edu
Bootstrapping from tool shed at http://toolshed.g2.bx.psu.edu.
Creating database... done.
Creating user 'bgrande' with email address '[email protected]'...Traceback (most recent call last):
File "lib/tool_shed/scripts/bootstrap_tool_shed/create_user_with_api_key.py", line 152, in <module>
app = BootstrapApplication( config )
File "lib/tool_shed/scripts/bootstrap_tool_shed/create_user_with_api_key.py", line 46, in __init__
create_tables=False )
File "/home/galaxy/galaxy_dist/lib/galaxy/webapps/tool_shed/model/mapping.py", line 330, in init
result.shed_counter = shed_statistics.ShedCounter( result )
@BrunoGrandePhD
BrunoGrandePhD / detect_gifs.py
Created August 26, 2015 05:11
Automatically create animated GIFs from a batch of photos
#!/usr/bin/env python
"""
detect_gifs.py
==============
This script tries to automatically detect
GIF opportunities within a batch of photos.
"""
from __future__ import print_function
@BrunoGrandePhD
BrunoGrandePhD / icgc_to_maf.R
Created June 16, 2016 23:14
A simple R script to convert an ICGC simple mutations file into the TCGA MAF format for re-annotation with maf2maf (see vcf2maf)
suppressPackageStartupMessages({
library(readr)
library(dplyr)
})
maf_cols <- c(
"Hugo_Symbol","Entrez_Gene_Id","Center","NCBI_Build","Chromosome","Start_Position",
"End_Position","Strand","Variant_Classification","Variant_Type","Reference_Allele",
"Tumor_Seq_Allele1","Tumor_Seq_Allele2","dbSNP_RS","dbSNP_Val_Status","Tumor_Sample_Barcode",
"Matched_Norm_Sample_Barcode","Match_Norm_Seq_Allele1","Match_Norm_Seq_Allele2",
@BrunoGrandePhD
BrunoGrandePhD / fixpdf.sh
Created June 19, 2016 23:53
Sometimes, the font is messed up on a printed version of a PDF file. It seems that this may be caused by the missing embedded fonts in the PDF file. The following shell function simplifies the process.
# Ensure that fonts are embedded in a PDF file for correct printing
# Credit: http://stackoverflow.com/a/4234150
function fixpdf {
# Print usage is no arguments are given
if [ "$#" -eq 0 ]; then
echo "Usage: fixpdf PDF_FILE [PDF_FILE ...]"
fi
# Check if ghostscript is installed
if ! type gs >/dev/null 2>&1; then
echo 'Error: ghostscript is either not installed or not in your PATH.'
@BrunoGrandePhD
BrunoGrandePhD / calc_exon_cov.sh
Last active June 22, 2016 18:13
Command for calculating average coverage for genes in a targeted sequencing experiment
# Input:
# - exons.bed: Exons BED file with the fourth column containing the gene name for gene coverage summarizing
# - sample.bam: BAM file using the same genome build (aka chromosome names and coordinate system) as exons.bed
# Output:
# - Tab-delimited file with two columns: gene name and average coverage
samtools bedcov exons.bed sample.bam \
| awk ' \
BEGIN { \
FS=OFS="\t"} \
git branch new-master # Assumption: HEAD is pointing to the new commits
git checkout master
git branch before-revert
git revert --no-edit commit_X..master # Revert the commits you want to discard
git rebase -i before-revert # Optional: squash all commits except top one to create one revert commit
git checkout new-master
git rebase master
git checkout master
git merge new-master
git branch -D new-master before-revert
@BrunoGrandePhD
BrunoGrandePhD / ggplot2_workshop.R
Created October 26, 2016 00:03
R script capturing what was covered in the SciProg.ca workshop on ggplot2 (https://github.com/sciprog-sfu/sciprog-sfu.github.io/issues/143)
## GGplot2 workshop Sciprog October 24 2016
# Author: Michelle Jones
library(ggplot2)
#install the packages for the workshop
#install.packages(c("tidyverse","ggthemes","cowplot"))
#install.packages("gapminder")
#Load packages
library(tidyverse)
library(ggthemes)
@BrunoGrandePhD
BrunoGrandePhD / remove-big-file.sh
Created December 15, 2016 01:16
Remove a large committed file from your Git repository.
# The commands below are a guide to remove a large file that has been
# accidentally committed to a Git repository's history. If the file is
# larger than 100 MB, GitHub will prevent you from pushing your latest
# commits. The annotated steps below should help you remove the large
# file from your commit history, even if you've made new commit since.
# Some Git users advise against rebasing. You can safely use it here
# because you haven't published your changes yet.
# So, you first need to rebase your current branch onto the point that
@BrunoGrandePhD
BrunoGrandePhD / Dockerfile
Created January 31, 2017 02:01
"Sentiment Analysis for Amazon Product Reviews" by Apala Guha
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y vim wget git htop tmux
RUN apt-get install -y openssh-client default-jre default-jdk
RUN apt-get install -y python2.7
RUN ln -s /usr/bin/python2.7 /usr/bin/python
RUN wget https://bootstrap.pypa.io/get-pip.py
RUN python get-pip.py
RUN pip2.7 install numpy
RUN pip2.7 install pandas