Skip to content

Instantly share code, notes, and snippets.

@pjbriggs
pjbriggs / cellranger_sge.strip_pe.pl
Created December 14, 2018 08:55
SGE client JSV script to strip "-pe smp.pe 1" from cellranger SGE jobs
#!/usr/bin/env perl
#
# Client JSV script from Mark Lundie for running cellranger
# pipeline
#
# Strips "-pe smp.pe 1" lines from job submission scripts
# (requests for >1 core will be kept unchanged)
#
# Include in qsub commands using -jsv PATH/TO/sge.strip_pe.pl
@pjbriggs
pjbriggs / run_craft_gp_example.sh
Created April 8, 2016 15:24
Example script to run CRAFT-GP pipeline
#!/bin/bash
#
# Run example CRAFT-GP pipeline based on docs
#
# 0. Set up test data
if [ ! -d test-data ] ; then
mkdir test-data
fi
cat >test-data/test_index_snps.in <<EOF
rs chr position
@pjbriggs
pjbriggs / install_craft_gp_R_libs.sh
Last active April 8, 2016 15:35
Script to install local versions of R libraries needed by CRAFT-GP pipeline
#!/usr/bin/bash
#
packages="dplyr coloc readr tidyr stringr optparse"
export INSTALL_DIR=$(pwd)/R_LIBS/CRAFT-GP
if [ ! -d $INSTALL_DIR ] ; then
mkdir -p $INSTALL_DIR
fi
export R_LIBS=$R_LIBS:$INSTALL_DIR
for package in $packages ; do
@pjbriggs
pjbriggs / step_handler.py.diff
Created September 15, 2015 13:34
Patch to fix tool dependency installation from .zip files in galaxy v15.07
diff --git a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/step_handler.py b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/step_handler.py
index 3d28462..5c98da6 100755
--- a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/step_handler.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/step_handler.py
@@ -81,7 +81,7 @@ class CompressedFile( object ):
if self.file_type == 'zip':
for zipped_file in self.getmembers():
filename = self.getname( zipped_file )
- absolute_filepath = os.path.join( extraction_path, filename )
+ absolute_filepath = os.path.join( path, filename )
@pjbriggs
pjbriggs / migrate_legacy_galaxy_config.sh
Created August 27, 2015 12:55
Script to move config (.ini and .xml) files from "legacy" Galaxy dist into 'config' dir
#!/bin/bash -e
#
# Migrate "legacy" config files in Galaxy distribution
#
# Check nothing is running
if [ ! -z "$(ls *.pid 2>/dev/null)" ] ; then
echo ERROR check you have stopped all Galaxy processes >&2
exit 1
fi
#
@pjbriggs
pjbriggs / vsearch_clustering_tests.sh
Created July 2, 2015 15:04
Test scripts for vsearch functions, to generate example data for the vsearch Galaxy tools
#!/bin/sh
#
# Generate test outputs for clustering
#
# Existing test case (--cluster_fast)
vsearch \
--notrunclabels \
--cluster_fast BioMarKs5k.fsa.bz2 \
--maxrejects 2 \
--maxaccepts 1 \
@pjbriggs
pjbriggs / bedgraph_to_wig.py
Created June 19, 2015 16:16
Python script that converts a bedGraph format file to a wig file.
#!/usr/bin/env python
#
# Convert bedgraph file into wig format
#
# Based on perl script by Dave Tang
# http://davetang.org/wiki/tiki-index.php?page=wig
import optparse
import os
import gzip
@pjbriggs
pjbriggs / make_ceas_refseq_annotation.py
Last active August 29, 2015 14:23
Make a generic refSeq-based annotation file for CEAS program using fetchChromSizes and build_genomeBG. The resulting annotation can be used for test purposes but shouldn't be used for genuine analyses.
#!/usr/bin/env python
#
# Make generic CEAS annotation file for arbitrary genome build
#
# Needs the UCSC fetchChromSizes program plus build_genomeBG from CEAS
#
# Usage: make_ceas_refseq_annotation.py <GENOME>
#
import optparse
import os
@pjbriggs
pjbriggs / history.py.diff
Created June 17, 2015 11:58
Patch to fix "Share history with user" function in galaxy-dist 15.05
diff -r c3cef260df88 lib/galaxy/webapps/galaxy/controllers/history.py
--- a/lib/galaxy/webapps/galaxy/controllers/history.py Fri May 15 15:20:17 2015 -0400
+++ b/lib/galaxy/webapps/galaxy/controllers/history.py Wed Jun 17 12:51:41 2015 +0100
@@ -899,7 +899,7 @@
for history_id in ids:
history_id = self.decode_id( history_id )
history = self.history_manager.get_owned( history_id, trans.user, current_history=trans.history )
- histories.append( )
+ histories.append( history )
return histories
@pjbriggs
pjbriggs / Galactic-Engineer-nginx-conf-fragment-for-reports-with-auth
Created June 2, 2015 14:01
Fragment of nginx conf for exposing Galaxy reports including authentication
...
location ^~ /reports/ {
proxy_pass http://reports;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/galaxy-reports.htpasswd;
...
}