Skip to content

Instantly share code, notes, and snippets.

View LeeBergstrand's full-sized avatar

Lee Bergstrand LeeBergstrand

View GitHub Profile
@LeeBergstrand
LeeBergstrand / CSVMod.py
Created February 17, 2014 01:02
A simple python script to modify any element or group of elements in a CSV file using a Regex.
#!/usr/bin/env python
# Created by: Lee Bergstrand
# Descript: A simple script that modifies the elements inside a column of a CSV by
# using a regular expression to find and replace charaters in those elements.
#
# Usage: CSVmod.py <input.csv> <output.csv> <columnNumber> <regex> <replace>
# Example: CSVmod.py myInput.csv myOutput.csv 6 ^[\t]+|[\t]$ replacement
#----------------------------------------------------------------------------------------
import csv
@LeeBergstrand
LeeBergstrand / FastaMLtoSL.py
Last active December 10, 2022 17:33
Python script that converts FASTA files with multiline sequences (wrapped) to FASTAs files with single line sequences (unwrapped).
#!/usr/bin/env python
# Created by: Lee Bergstrand
# Descript: Converts multiline FASTAs to single line FASTAs
#
# Usage: FastaMLtoSL.py <sequences.faa>
# Example: FastaMLtoSL.py mySeqs.faa
#----------------------------------------------------------------------------------------
#===========================================================================================================
#Imports:
@LeeBergstrand
LeeBergstrand / DbCAN_HMMSCAN_Parser_Problem.md
Last active March 1, 2022 09:32
dbCAN_HMMSCAN_Parser_Problem

dbCAN Hmmscan Parser Issue

I was recently reverse engineering dbCAN's shell/perl script (hmmscan-parser.sh) for parsing HMMER's hmmscan human readable text results. Unfortunately, while figuring out how this script works I found an error.

#####Orignal Script:

	#!/usr/bin/env sh
	# Yanbin Yin
	# 08/18/2011
@LeeBergstrand
LeeBergstrand / pypy.rb
Created May 28, 2014 22:21
Linuxbrew formula for installing PyPy
require 'formula'
class Pypy < Formula
homepage 'http://pypy.org/'
url 'https://bitbucket.org/pypy/pypy/downloads/pypy-2.3-linux64.tar.bz2'
version '2.3.0'
sha1 '5bf5e2b2d9a002a9d81830dfffe5fa68959a8f40'
resource 'setuptools' do
url 'https://pypi.python.org/packages/source/s/setuptools/setuptools-3.6.tar.gz'
@LeeBergstrand
LeeBergstrand / Wat.py
Created June 24, 2014 19:55
Why you should think about hidden escape characters in your code...
#!/usr/bin/env python
# Why you should think about hidden escape characters in your code...
# Only some editors show hidden characters.
Blam = ":"
print repr(Blam)
Blam = ":"
print repr(Blam)
print repr("WAT")
@LeeBergstrand
LeeBergstrand / Trim_SPAdes_FASTA
Last active August 29, 2015 14:22
Trim_SPAdes_FASTA.py
#!/usr/bin/env python
# Created by: Lee Bergstrand
# Modified by: Matt McInnes
# License: MIT
# Descript: Trims FASTAs from the assembler SPAdes by coverage to remove low coverage contigs.
# ----------------------------------------------------------------------------------------
# ===========================================================================================================
# Imports:
import argparse
This file has been truncated, but you can view the full file.
==> Downloading https://downloads.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.tar.bz2
Already downloaded: /home/lee2/.cache/Homebrew/boost-1.58.0.tar.bz2
==> Verifying boost-1.58.0.tar.bz2 checksum
tar xf /home/lee2/.cache/Homebrew/boost-1.58.0.tar.bz2
==> ./bootstrap.sh --prefix=/home/lee2/.linuxbrew/Cellar/boost/1.58.0 --libdir=/home/lee2/.linuxbrew/Cellar/boost/1.58.0/lib --without-icu --without-libraries=python,mpi
Building Boost.Build engine with toolset gcc... tools/build/src/engine/bin.linuxx86_64/b2
Unicode/ICU support for Boost.Regex?... disabled.
Generating Boost.Build configuration in project-config.jam...
Bootstrapping is done. To build, run:
@LeeBergstrand
LeeBergstrand / remove_low_seq_files.sh
Created August 21, 2016 20:43
Shell script for selecting fastq files by number of seqs.
#!/usr/bin/env bash
if [ $# -eq 0 ]
then
echo "No arguments supplied..."
echo "Please provide a minimum number of seqs per file."
exit 1
fi
MIN_LENGTH=$1
Take this part of the config for example:
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "requirements.txt" }}
          - v1-dependencies-
          
      - save_cache:
          key: v1-dependencies-{{ checksum "requirements.txt" }}
 paths: