Hi:
perl -e 'print "hello world!\n"'
A simple filter:
perl -ne 'print if /REGEX/'
Filter out blank lines (in place):
Hi:
perl -e 'print "hello world!\n"'
A simple filter:
perl -ne 'print if /REGEX/'
Filter out blank lines (in place):
| #!/usr/bin/env python3 | |
| """ | |
| Running this script is (intended to be) equivalent to running the following Snakefile: | |
| include: "pipeline.conf" # Should be an empty file | |
| shell.prefix("set -euo pipefail;") | |
| rule all: | |
| input: |
| Category | State | SGE Letter Code |
|---|---|---|
| Pending | pending | qw |
| Pending | pending, user hold | qw |
| Pending | pending, system hold | hqw |
| Pending | pending, user and system hold | hqw |
| Pending | pending, user hold, re-queue | hRwq |
| Pending | pending, system hold, re-queue | hRwq |
| #!/usr/bin/env python3 | |
| import json | |
| import sys | |
| def merge(inputs): | |
| """ Merges the data in the given input handles and returns the result """ | |
| assert len(inputs) > 1 | |
| record_ids = set() |
| # This function sorts the matrix for better visualization of mutual exclusivity across genes | |
| memoSort <- function(M) { | |
| geneOrder <- sort(rowSums(M), decreasing=TRUE, index.return=TRUE)$ix; | |
| scoreCol <- function(x) { | |
| score <- 0; | |
| for(i in 1:length(x)) { | |
| if(x[i]) { | |
| score <- score + 2^(length(x)-i); | |
| } | |
| } |
| pigz -d -c in.fastq.gz | | |
| | awk 'BEGIN {LN=0; } { if (LN == 1 || LN == 3) { print substr($0, 0, 26) } else { print $0 } ; if (LN == 3) { LN = 0 } else { LN++ } }' \ | |
| | pigz -c - > out.fastq.gz |
| def splitDataFrameList(df,target_column,separator): | |
| ''' df = dataframe to split, | |
| target_column = the column containing the values to split | |
| separator = the symbol used to perform the split | |
| returns: a dataframe with each entry for the target column separated, with each element moved into a new row. | |
| The values in the other columns are duplicated across the newly divided rows. | |
| ''' | |
| def splitListToRows(row,row_accumulator,target_column,separator): | |
| split_row = row[target_column].split(separator) |
| # | |
| # This script calculates the depth of coverage and breadth of coverage for a given bam. | |
| # Outputs a dictionary containing the contig/chromosome names and the depth and breadth of coverage for each | |
| # and for the entire genome. | |
| # | |
| # If you optionally specify the name of the mitochondrial chromosome (e.g. mtDNA, chrM, chrMT) | |
| # The script will also generate breadth and depth of coverage for the nuclear genome AND the ratio | |
| # of mtDNA:nuclearDNA; which can act as a proxy in some cases for mitochondrial count within an individual. | |
| # | |
| # Author: Daniel E. Cook |
Python version of the MATLAB code in this Stack Overflow post: http://stackoverflow.com/a/18648210/97160
The example shows how to determine the best-fit plane/surface (1st or higher order polynomial) over a set of three-dimensional points.
Implemented in Python + NumPy + SciPy + matplotlib.