Skip to content

Instantly share code, notes, and snippets.

@pjbriggs
pjbriggs / make_nibs.sh
Created January 21, 2013 15:54
Example script for generating sequence alignment files (.nib) using faToNib submitted to a Grid Engine cluster
#!/bin/sh
#
# make_nibs.sh
#
chroms=`ls chr*.fa`
for chrom in $chroms; do
echo $chrom
nib=${chrom%.*}.nib
qsub -cwd -V -b y faToNib $chrom $nib
done
@pjbriggs
pjbriggs / report_barcodes.py
Created January 24, 2013 11:20
Count and report the index sequences (aka barcode tags) in an Illumina FASTQ file
#!/bin/env python
#
# Count and report the barcode tags in a fastq file from Illumina
# sequencing platform
#
import sys
import FASTQFile
fastq_file = sys.argv[1]
tags = {}
for read in FASTQFile.FastqIterator(fastq_file):
@pjbriggs
pjbriggs / usage.sh
Created January 30, 2013 12:40
Report disk usage under specified directory (largest subdirectories and largest files)
#!/bin/sh
#
# Report disk usage
#
# Usage: usage.sh DIR
#
if [ $# -eq 0 ] ; then
echo "Usage: $0 DIR"
exit
fi
@pjbriggs
pjbriggs / make_bw_files.sh
Created May 2, 2013 11:26
Utility script to create bigWig files from phastCons wig data files. Needs the chromosome sizes which can be obtained by doing e. "fetchChromSizes mm9 > mm9chromSizes". For each .data file in the specified directory, runs wigToBigWig to generate corresponding .bw file.
#!/bin/sh
#
CHROMSIZE_FILE=$1
if [ -z "$CHROMSIZE_FILE" ] ; then
echo "Usage: $0 CHROMSIZE_FILE [ DATA_DIR ]"
exit
fi
if [ -z "$2" ] ; then
DATA_DIR=`pwd`
else
@pjbriggs
pjbriggs / clean_rtf_to_fasta.sh
Created May 22, 2013 11:15
Hacky script for converting fasta files munged by some other program into RTF files back to fasta format (used for frog data). Probably output file will need some additional corrections by hand.
#!/bin/sh
#
if [ -z "$1" ] || [ -z "$2" ] ; then
echo "Usage: $0 IN.rtf OUT.fasta"
exit 1
fi
if [ ! -e "$1" ] ; then
echo "Input file $1 not found"
exit 1
fi
@pjbriggs
pjbriggs / sorting.py
Created July 22, 2013 12:29
Script to explore the use of different types of sort keys, including "natural sort order"
# Compare effects of using different sort keys
import os
import locale
import re
class SortKeys:
natural_sort_digits = re.compile(r'(\d+)')
@classmethod
def default(self,filename):
@pjbriggs
pjbriggs / load_urls.py
Created July 2, 2014 13:26
Open multiple arbitrary URLs automatically in a webbrowser
#!/bin/env python
#
# Open multiple arbitrary URLs in a webbrowser
import optparse
import webbrowser
import time
import sys
if __name__ == '__main__':
p = optparse.OptionParser(usage="%prog [-f FILE] [-b BROWSER] [-p INTERVAL] "
"[URL [URL,...]]",
@pjbriggs
pjbriggs / proftpd.conf-extract
Last active January 19, 2016 05:23
Extract from proftpd.conf for handling SHA1 and PBKDF2 encryption
ServerName "Galaxy FTP File Upload"
ServerType standalone
DefaultServer on
PidFile /var/run/proftpd/proftpd-galaxy.pid
# Port 21 is the standard FTP port.
Port 21
# Don't use IPv6 support by default.
UseIPv6 off
@pjbriggs
pjbriggs / check_gtf_exon_coverage.py
Created April 1, 2015 10:06
Given a GTF file, check that for each exon entry the associated features 'CDS', 'stop_codon' and 'start_codon' are consistent and specify the same range of bases as # their "parent" exon
#!/bin/env python
#
# Check exon coverage in a GTF file
# Peter Briggs UoM, March 2015
#
# Purpose
# -------
# Given a GTF file, check that for each exon entry the
# associated features 'CDS', 'stop_codon' and 'start_codon'
# are consistent and specify the same range of bases as
@pjbriggs
pjbriggs / Galactic-Engineer-GALAXY_SLOTS-job_conf-fragment.xml
Last active August 29, 2015 14:19
Galactic Engineer/GALAXY_SLOTS: job_conf.xml fragment
<destinations default="dynamic">
...
<!-- DRMAA runner for job using 4 cores -->
<destination id="sge_smp_4" runner="drmaa">
<param id="nativeSpecification">-R y -V -j n -pe smp.pe 4</param>
</destination>
...