Commit ec67d25c authored by Holger Brandl's avatar Holger Brandl

Merge branch 'master' of git.mpi-cbg.de:bioinfo/ngs_tools

parents 39a010da 5eae0706
......@@ -68,54 +68,6 @@ How to report used version for a project?
-----------------------------------------
```bash
(cd ${NGS_TOOLS} && git diff --exit-code && git rev-parse HEAD) > ${PRJ_DATA}/.used_ngs_tools
```
How to tag it for a project (Deprecated)
----------------------------------------
```bash
# ensure there are no pending changes
# http://stackoverflow.com/questions/5139290/how-to-check-if-theres-nothing-to-be-committed-in-the-current-branch
git diff --exit-code
# create the tag for current branch
(cd ${NGS_TOOLS} && test -n "$project" && git diff --exit-code && git tag "${project}__$(date +'%Y%m%d')") || echo "could not tag current branch"
# and log it
git describe --tags >> ${baseDir}/.used_ngs_tools
(cd ${NGS_TOOLS} && test -n "${PRJ_NAME}" && git diff --exit-code && git rev-parse HEAD >> ${PRJ_DATA}/.used_ngs_tools ) || echo "pending changes in ngs_tools"
## since tags are not pushed by default we need to trigger the push
git push --tags
```
How to create a new version tag
-------------------------------
1. Create branch:
```
cd /Volumes/projects/bioinfo/scripts/ngs_tools/dev
git checkout -b v3.23
git push
```
1. Checkout new branch into ngs_tools as stable version
```
cd /Volumes/projects/bioinfo/scripts/ngs_tools/
newVersion=v1.1
mkdir $newVersion
cd $newVersion
git clone git-srv1:/local/git/bioinformatics .
git checkout ${newVersion}
## prevent from writing
chmod -R -w ../$newVersion
```
 
\ No newline at end of file
......@@ -149,10 +149,7 @@ rend.R -e ${NGS_TOOLS}/common/cp_enrichment.R --overlay_expr_data ../plot_score_
## version common tools
## todo make sure to stay in current directory #{ (cd ${NGS_TOOLS} && git describe --tags) } >> .used_ngs_tools
(cd ${NGS_TOOLS} && test -n "${PRJ_NAME}" && git diff --exit-code && git tag "${PRJ_NAME}__$(date +'%Y%m%d')") || echo "could not tag current branch"
# and log it
git describe --tags >> ${PRJ_DATA}/.used_ngs_tools
(cd ${NGS_TOOLS} && test -n "${PRJ_NAME}" && git diff --exit-code && git rev-parse HEAD >> ${PRJ_DATA}/.used_ngs_tools ) || echo "pending changes in ngs_tools"
########################################################################################################################
......
......@@ -618,7 +618,7 @@ deResults %>%
########################################################################################################################
#' ## Count Table Exports
# Count Table Exports
## optionally install bioconducor package
......@@ -648,7 +648,7 @@ geneDescs = transmute(geneInfo, ensembl_gene_id, gene_name = external_gene_name,
write_tsv(geneInfo, path = paste0(resultsBase, "geneInfo.txt"))
#' Export counts per replicate as double-normalized FPKMs=(read_count * 10^9)/(gene_length * library_size)
# Export counts per replicate as double-normalized FPKMs=(read_count * 10^9)/(gene_length * library_size)
fpkms = countMatrix %>%
as.data.frame %>%
rownames_to_column("ensembl_gene_id") %>%
......@@ -669,7 +669,7 @@ fpkms %>%
push_left(c("gene_name", "gene_description")) %>%
write_tsv(paste0(resultsBase, "fpkms_by_replicate.txt"))
#' Aggregate FPKMs by condition and export into tabele
# Aggregate FPKMs by condition and export into tabele
fpkms %>%
inner_join(exDesign, by = "replicate") %>%
# group_by_(.dots = c(contrastAttribute, "ensembl_gene_id")) %>%
......@@ -682,10 +682,10 @@ fpkms %>%
push_left(c("gene_name", "gene_description")) %>%
write_tsv(paste0(resultsBase, "fpkms_by_condition.txt"))
#' [FPKMs as Matrix](`r paste0(resultsBase, "fpkms_by_condition.txt")`)
# [FPKMs as Matrix](`r paste0(resultsBase, "fpkms_by_condition.txt")`)
#' Export counts per replicate as TPMs (transcript per million)
# Export counts per replicate as TPMs (transcript per million)
# calculation of tpms and generation of a wide table including gene description and the external gene name
tpms = countMatrix %>%
......@@ -706,7 +706,7 @@ tpms %>%
push_left(c("gene_name", "gene_description")) %>%
write_tsv(paste0(resultsBase, "tpms_by_replicate.txt"))
#' Also average TPMs per condition and export
# Also average TPMs per condition and export
tpms %>%
inner_join(exDesign, by = "replicate") %>%
group_by(condition, ensembl_gene_id) %>%
......@@ -733,7 +733,7 @@ deAnnot = deResults %>% left_join(geneInfo)
write_tsv(deAnnot, path = paste0(resultsBase, "de_results.txt"))
#deAnnot = read_tsv(paste0(resultsBase, "de_results.txt"))
#' [deAnnot](`r paste0(resultsBase, "de_results.txt")`)
# [de_results.txt](`r paste0(resultsBase, "de_results.txt")`)
## also export results which we'll always need for pathways overlays
deAnnot %>%
......@@ -840,19 +840,19 @@ degs %>%
write_tsv(paste0(resultsBase, "degs_by_contrast_directed.txt"))
## also export gsea inputs
deAnnot %>%
mutate(contrast = paste(condition_1, "vs", condition_2)) %>%
filter(! is.na(pvalue)) %>%
transmute(contrast, ensembl_gene_id, rank_score = - log10(pvalue)) %>% #count(is.na(rank_score))
# arrange(contrast, rank_score) %>%
write_tsv(paste0(resultsBase, "gsea__genes_by_contrast__undirected.txt"))
#deAnnot %>%
# mutate(contrast = paste(condition_1, "vs", condition_2)) %>%
# filter(! is.na(pvalue)) %>%
# transmute(contrast, ensembl_gene_id, rank_score = - log10(pvalue)) %>% #count(is.na(rank_score))
## arrange(contrast, rank_score) %>%
# write_tsv(paste0(resultsBase, "gsea__genes_by_contrast__undirected.txt"))
deAnnot %>%
mutate(contrast = paste(condition_1, "vs", condition_2)) %>%
filter(! is.na(pvalue)) %>%
transmute(contrast, ensembl_gene_id, rank_score = - log10(pvalue) * ifelse(s1_overex, 1, - 1)) %>%
# arrange(contrast, rank_score) %>%
write_tsv(paste0(resultsBase, "gsea__genes_by_contrast__directed.txt"))
#deAnnot %>%
# mutate(contrast = paste(condition_1, "vs", condition_2)) %>%
# filter(! is.na(pvalue)) %>%
# transmute(contrast, ensembl_gene_id, rank_score = - log10(pvalue) * ifelse(s1_overex, 1, - 1)) %>%
## arrange(contrast, rank_score) %>%
# write_tsv(paste0(resultsBase, "gsea__genes_by_contrast__directed.txt"))
# ## render interactive hit browser
......@@ -949,6 +949,23 @@ mat <- assay(rld) %>%
mat <- mat - rowMeans(mat)
pheatmap(mat, annotation_col = column2rownames(exDesign, "replicate") %>% select(- col_index))
session::save.session(".featcounts_deseq_mf.dat");
########################################################################################################################
#' ## Exported Data
#'
#' | File | Description |
#' |------|------|
#' | [diffex_genes.txt](diffex_genes.txt) | list of all differentially expressed genes from the DESeq analysis - That's the file you are most likely looking for! |
#' | [de_results.txt](de_results.txt) | list of all genes from the DESeq analysis |
#' | [fpkms_by_condition.txt](fpkms_by_condition.txt) | fpkm values of the different conditions |
#' | [fpkms_by_replicate.txt](fpkms_by_replicate.txt) | fpkm values of individual replicates |
#' | [tpms_by_conditon.txt](tpms_by_conditon.txt) | tpm values of the different conditions |
#' | [tpms_by_replicate.txt](tpms_by_replicate.txt) | tpm values of individual replicates |
#' | [geneInfo.txt](geneInfo.txt) | general gene information |
#'
#' Further informtion on [FPKM and TPM](http://www.rna-seqblog.com/rpkm-fpkm-and-tpm-clearly-explained/)
session::save.session(".featcounts_deseq_mf.dat");
# session::restore.session(".featcounts_deseq_mf.dat");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment