This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(XML) | |
| address="Boston" | |
| url = paste( "http://www.google.com/ig/api?weather=", URLencode(address), sep="" ) | |
| xml = xmlTreeParse(url, useInternalNodes=TRUE) # take a look at the xml output: | |
| # Get the required informations: | |
| condition=xpathSApply(xml,"//xml_api_reply/weather/current_conditions/condition",xmlGetAttr,"data") | |
| temp_c=xpathSApply(xml,"//xml_api_reply/weather/current_conditions/temp_c",xmlGetAttr,"data") | |
| humidity=xpathSApply(xml,"//xml_api_reply/weather/current_conditions/humidity",xmlGetAttr,"data") | |
| cat( paste("The Weather in ", address, " is ", condition, ". The temperature is ", temp_c, "°C. Humidity is ", humidity, "%.") ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(XML) | |
| address="Boston" | |
| url = paste( "http://www.google.com/ig/api?weather=", URLencode(address), sep="" ) | |
| xml = xmlTreeParse(url, useInternalNodes=TRUE) # take a look at the xml output: | |
| # Get the required informations: | |
| condition=xpathSApply(xml,"//xml_api_reply/weather/current_conditions/condition",xmlGetAttr,"data") | |
| temp_c=xpathSApply(xml,"//xml_api_reply/weather/current_conditions/temp_c",xmlGetAttr,"data") | |
| humidity=xpathSApply(xml,"//xml_api_reply/weather/current_conditions/humidity",xmlGetAttr,"data") | |
| cat( paste("The Weather in ", address, " is ", condition, ". The temperature is ", temp_c, "°C. Humidity is ", humidity, "%.") ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source("http://bioconductor.org/biocLite.R") #adds bioconductor site as a package source | |
| BiocLite(“pheatmap”) #downloads and install pheatmap package from bioconductor | |
| library(pheatmap) #loads pheatmap package | |
| install.packages(“RColorBrewer”) #donwnloads and installs a package with useful color themes | |
| Library(RColorBrewer) #load RcolorBrewer package | |
| #LOAD DATA | |
| data=read.delim(“KO-WT-OV-3way.sig.batch.exprs.xls”) #read in expression values for significantly correlated probesets | |
| data=data[,1:6] #subsets data remove the gene symbols, names or EntrezIDs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## 2012-05-08 - first draft | |
| ## 2012-05-14 - got rid of repetitive parts of script | |
| ## added RNA-seqQC prep | |
| ###jnhutchinson | |
| ###bash script to run tophat alignments for WP-rna-seq | |
| ###hard coded | |
| #basedataDir ---untrimmed | |
| # ---trimmed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(plyr) | |
| library(Rsamtools) | |
| library(GenomicRanges) | |
| library(Biostrings) | |
| library(knitr) | |
| matcher <- function(pattern, x) { | |
| ind = gregexpr(pattern, x)[[1]] | |
| start = as.numeric(ind) | |
| end = start + attr(ind, "match.length")- 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <style type="text/css"> | |
| table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode { | |
| margin: 0; padding: 0; vertical-align: baseline; border: none; } | |
| table.sourceCode { width: 100%; } | |
| td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; } | |
| td.sourceCode { padding-left: 5px; } | |
| code > span.kw { color: #007020; font-weight: bold; } | |
| code > span.dt { color: #902000; } | |
| code > span.dv { color: #40a070; } | |
| code > span.bn { color: #40a070; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### KNITR SETUP | |
| ```{r setup, echo=FALSE} | |
| opts_chunk$set(tidy=TRUE, cache=FALSE, highlight=TRUE, figalign="center", warning=FALSE, error=FALSE, message=FALSE, fig.height=11, fig.width=11) | |
| ``` | |
| ### EXAMPLE CHUNK | |
| ```{r libraries} | |
| library(ggplot2) | |
| library(xtable) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wait.on.lsf() { ## wait on jobs{ | |
| n=`bjobs -P $projectID | awk 'NR>1' | wc -l` | |
| while [ $n -ne 0 ] | |
| do | |
| n=`bjobs -P $projectID | awk 'NR>1' | wc -l` | |
| # number of running | |
| echo "Running: "`bjobs -P $projectID | grep RUN | wc -l` | |
| # number of pending | |
| echo "Pending: "`bjobs -P $projectID | grep PEND | wc -l` | |
| sleep 60 ##raising this to 120 will cause LSF to drop the script |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Rory's kickass annotated dataframe function | |
| annotate_df = function(d) { | |
| require(biomaRt) | |
| ensembl = useMart('ensembl', dataset = ensembl_gene) | |
| a = getBM(attributes=c(filter_type, gene_symbol, "description"), | |
| filters=c(filter_type), values=d[, 'id'], | |
| mart=ensembl) | |
| m = merge(d, a, by.x='id', by.y=filter_type) | |
| return(m) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # annotations | |
| heatmap.annots <- pData(mic.norm.eset)[,c("ID", "study", "stage", "gender")] | |
| heatmap.annots <- as.data.frame(apply(heatmap.annots, 2, unlist)) | |
| row.names(heatmap.annots) <- heatmap.annots$ID | |
| heatmap.annots$ID <- NULL | |
| # annotation colors | |
| study_colors <- c("#FF0000","#00FF00", "#0000FF", cbPalette ) | |
| names(study_colors) <- unique(unlist(pd$study)) | |
| stage_colors <- c("white", "darkgrey", "black") | |
| names(stage_colors) <- unique(unlist(pd$stage)) |
OlderNewer