References:
- http://www.analytictech.com/mb876/handouts/distance_and_correlation.htm
- http://bioconductor.org/help/publications/books/bioinformatics-and-computational-biology-solutions/
Code:
| #!/usr/bin/env python | |
| # encoding: utf8 | |
| """ | |
| merge_lanes.py | |
| Kamil Slowikowski | |
| July 17, 2015 | |
| Broad Technology labs provides sequencing data in a directory structure like | |
| this: |
| #!/usr/bin/env bash | |
| # toggle-trackpoint.sh | |
| set -uoe pipefail | |
| # xinput list | |
| # ⎡ Virtual core pointer id=2 [master pointer (3)] | |
| # ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] | |
| # ⎜ ↳ SynPS/2 Synaptics TouchPad id=14 [slave pointer (2)] |
| (* | |
| Put this script in: | |
| /Users/USERNAME/Library/Scripts/ | |
| Download and install FastScripts to assign this script to a keyboard shortcut: | |
| http://www.red-sweater.com/fastscripts/ | |
| Source: http://apple.stackexchange.com/a/49546/123845 |
| #!/usr/bin/env bash | |
| # make_aspera_manifest.sh | |
| # Kamil Slowikowski | |
| # | |
| # Make a manifest file suitable for Aspera. | |
| # | |
| # Example | |
| # ------- | |
| # | |
| # Suppose we wish to send a folder full of files called "data". We want |
| #!/usr/bin/env bash | |
| # sra-paired.sh | |
| # Kamil Slowikowski | |
| # April 23, 2014 | |
| # | |
| # Check if an SRA file contains paired-end sequencing data. | |
| # | |
| # See documentation for the SRA Toolkit: | |
| # http://www.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=toolkit_doc&f=fastq-dump |
| #!/usr/bin/env python | |
| """ | |
| pathway_genes.py | |
| Kamil Slowikowski | |
| kslowikowski@mgh.harvard.edu | |
| Updated 2021-03-22 | |
| Usage |
| #' Get the variance explained by principal components | |
| #' @param plist A list with class "prcomp" containing: sdev, rotation, x. | |
| variance_explained <- function(plist) { | |
| rotation <- as.data.frame(plist$rotation) | |
| variance <- plist$sdev ^ 2 | |
| data.frame( | |
| Component = factor(1:ncol(rotation), levels = 1:ncol(rotation)), | |
| Variance = variance / sum(variance), | |
| CumulativeVariance = ( cumsum(variance) / sum(variance) ) | |
| ) |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
| <xsl:output omit-xml-declaration="yes" /> | |
| <!-- | |
| Transform biosample XML to TSV. | |
| Usage: xsltproc biosample2tsv.xsl input.xml > output.tsv | |
| --> | |
| <xsl:template match="/">GEO<xsl:text>	</xsl:text>Title<xsl:text>	</xsl:text>CellLine<xsl:text>	</xsl:text>CellType<xsl:text>	</xsl:text>CdnaMethod<xsl:text> </xsl:text> | |
| <xsl:for-each select="//BioSample"> |
| # 1. Install biomart. | |
| source("http://bioconductor.org/biocLite.R") | |
| biocLite("biomaRt") | |
| # 2. Load biomart. | |
| library(biomaRt) | |
| # 3. Get symbols for Ensembl IDs |