Skip to content

Instantly share code, notes, and snippets.

View jdblischak's full-sized avatar

John Blischak jdblischak

View GitHub Profile
@jdblischak
jdblischak / rename.py
Created September 2, 2014 18:36
Quick example of renaming files in nested directory structure
# Renames all files using name of directory.
# e.g. sample_name_1/s_1_sequence.txt.gz -> sample_name_1_s_1_sequence.txt.gz
import glob
import shutil
filepaths = glob.glob("sample_name_*/s_*_sequence.txt.gz")
new_names = [x.replace("/", "_") for x in filepaths]
[shutil.copyfile(x[0], x[1]) for x in zip(filepaths, new_names)]
@jdblischak
jdblischak / batch-install.sh
Last active August 29, 2015 14:23
Testing pysam installation with Python3
#!/bin/bash
for VERSION in 3.3.6 3.4.0 3.4.1 3.4.2 3.4.3
do
bash install-python.sh $VERSION
bash install-pysam.sh $VERSION
done
@jdblischak
jdblischak / build-r.sh
Created December 1, 2016 16:10
Install local copy of R from source
#!/bin/bash
# Install local copy of R from source.
# To run:
# bash build-r.sh >& log.txt
# Version of R to install (must be part of the R 3.0 series)
VERSION=3.3.2
# Directory to install R. If not already present, creates bin, lib and share
@jdblischak
jdblischak / conda-forge-cran.R
Last active October 31, 2017 22:02
Helper script to identify conda-forge R packages that have more recent versions released on CRAN
#!/usr/bin/env conda-execute
# Helper script to identify conda-forge R packages that have more recent
# versions released on CRAN.
#
# Usage:
#
# conda execute conda-forge-cran.R
#
# or
@jdblischak
jdblischak / snake-group-meeting.py
Last active November 9, 2017 17:42
Example Snakefile for group meeting presentation
# Example Snakemake pipeline
#
# This example snakefile performs the following steps:
#
# * Downloads an Excel file
# * Converts the file to CSV format
# * Plots a result
# * Creates a summary report
#
# LICENSE: CC0. Do what you want with the code, but it has no guarantees.
@jdblischak
jdblischak / README.md
Last active May 29, 2018 22:08
snakemake_vmem_usage

Testing Snakemake virtual memory usage

John Blischak 2014-05-14

Multiple users have observed that submitting jobs via Snakemake requires much more memory than is necessary to run the command (e.g. mailing list post, [Bitbucket issue][issue]).

@jdblischak
jdblischak / README.md
Last active March 29, 2019 02:40
kallisto vs. Subread for yeast RNA-seq analysis

Comparing speed for yeast RNA-seq analysis - kallisto vs. Subread

Introduction

[kallisto][] is a new method for processing RNA-seq data. By pseudoaligning reads to a transcriptome instead of aligning reads to a genome, the quantification step is much faster. While the computational speedup will be huge for projects with many samples and/or with organisms with large genomes, I was curious how much time would be saved using [kallisto][] on a small RNA-seq project for an organism with a smaller genome. To perform this comparison, I downloaded 6 fastq files from a recent yeast RNA-seq study on GEO. I chose [Subread][subread] as the comparison method because it performs read alignment but is optimized for quickly obtaining gene counts (it soft clips reads instead of trying to map exact exon-exon boundaries).

@jdblischak
jdblischak / gpl-stats.R
Created July 26, 2019 16:12
Do CRAN packages that depend on the stats package use a copyleft license?
#!/usr/bin/env Rscript
# Do CRAN packages that depend on the stats package use a copyleft license?
# https://twitter.com/cimentadaj/status/1154420408508043264
Sys.Date()
## [1] "2019-07-26"
library(stringr)
calc3 <- function(sets)
{
sets <- check_sets(sets)
set_lengths <- vapply(sets, length, 0)
set_order <- order(set_lengths)
sets <- sets[set_order]
set_lengths <- set_lengths[set_order]
n_sets <- length(sets)
set_names <- names(sets)
@jdblischak
jdblischak / description-fields-reserved.txt
Last active June 17, 2021 15:05
R's DESCRIPTION fields documented in Writing R Extensions
Additional_repositories
Author
Authors@R
Biarch
BugReports
BuildVignettes
Built
ByteCompile
Classification/ACM
Classification/ACM-2012