- Convert multipage PDF into single page PNG files with GhostScript
gs -o /path/to/output_page_%03d.png -sDEVICE=png16m -r150 /path/to/input.pdf
- Convert multiple single-page PDF files into one multi-page PDF file
gs -o /path/to/output_page_%03d.png -sDEVICE=png16m -r150 /path/to/input.pdf
#!/bin/bash | |
# PROBLEM: want to preseve the terminal output from bowtie2, but also copy the stderr from bowtie into a separate file | |
# SOLUTION: use `tee` along with some bash stream redirection to copy the stderr stream to a new file AND print it on the terminal | |
# set files and places | |
tmp_fastq1="$HOME/projects/SmithLab_PARCLIP/14Q-sample1_R1_mini.fastq" | |
tmp_fastq2="$HOME/projects/SmithLab_PARCLIP/14Q-sample1_R2_mini.fastq" | |
tmp_outdir="$HOME/projects/SmithLab_PARCLIP/test_bowtie2" |
[source]
This manual page is for Mac OS X version 10.9
If you are running a different version of Mac OS X, view the documentation locally:
In Terminal, using the man(1) command
Reading manual pages
paste this inside your script for debugging, to start a Python interactive terminal shell session at that point in the script, super useful for debugging since it lets you explore the Python environment and access objects and variables as they are at that point in the script.
import readline # optional, will allow Up/Down/History in the console
import code
vars = globals().copy()
vars.update(locals())
Here are some handy commands for connecting to servers and copying files about. These are all for Linux terminal / bash shell
Do cool things with ssh; log in & run command, find files in dir
# log into server
ssh username@server.edu -Y
# -X Enables X11 forwarding. <- use this to enable X11 graphical windows, but this will eventually time out & you'll lose the X11 connection
# -Y Enables trusted X11 forwarding. <- this one preserves your X11 connection while you're logged in
package main | |
import ( | |
"fmt" | |
// "compress/gzip" | |
gzip "github.com/klauspost/pgzip" | |
"bufio" | |
"os" | |
"log" | |
) |
#!/usr/bin/env python3 | |
# do an action in parallel across multiple threads in Python | |
# example: get the average of lists of numbers | |
# references; | |
# https://stackoverflow.com/questions/8533318/multiprocessing-pool-when-to-use-apply-apply-async-or-map | |
# https://e2eml.school/multiprocessing.html | |
# https://docs.python.org/3.7/library/multiprocessing.html#multiprocessing.pool.Pool.apply_async |
You can use IGV to automatically & programmatically load genomic datasets and take snapshots of regions of interest. This is very handy and helps you avoid taking many screenshots manually.
Manual page here:
http://software.broadinstitute.org/software/igv/batch
These commands are also available:
http://software.broadinstitute.org/software/igv/PortCommands
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
Convert SLURM squeue output to JSON format | |
""" | |
import subprocess as sp | |
import json | |
process = sp.Popen(['squeue', '-o', '%all'], stdout = sp.PIPE, stderr = sp.PIPE, shell = False, universal_newlines = True) | |
proc_stdout, proc_stderr = process.communicate() |