Skip to content

Instantly share code, notes, and snippets.

@zhilongjia
zhilongjia / downloadnumber_bioc.R
Last active July 29, 2022 08:13
obtain the total number of downloads of a bioconductor package.
## Bioconductor package download
library(dplyr)
pkname="cogena"
cogena_download_tabs <- readr::read_tsv(paste0("http://bioconductor.org/packages/stats/bioc/", pkname, "/", pkname, "_stats.tab") )
print("The total downloading number of cogena: ")
dplyr::filter(cogena_download_tabs, Month=="all") %>%
select(Nb_of_downloads) %>% unlist(use.names = FALSE) %>% sum()
#####################################################
# Or via `BiocPkgTools` package
@zhilongjia
zhilongjia / search_txt_in_image.sh
Created September 10, 2021 12:55
A shell tool searching txt in lots of images (such as photoed from various slides in meetings)
#! /usr/bin/bash
# parameter parsing
while getopts ":d:t:ch" opt; do
case ${opt} in
d )
dir=$OPTARG
;;
# s )
# target=$OPTARG
@zhilongjia
zhilongjia / correlation_hclust.R
Created January 23, 2021 12:08
visulising the correltion between two views of the same samples
# visulising the correltion between two views of the same samples
# such as the first 4 features in mtcars as 1 view, the others as another view.
# as it not easy to implement using corrplot.
# the resulting figure
![clustering correlation](https://i.ibb.co/LRKsKCC/corrletion-hclust.png])
library(ComplexHeatmap)
data(mtcars)
@zhilongjia
zhilongjia / rpm.R
Last active March 27, 2017 08:47
rpm is revised to convert Rnw to Rmd for vignette, originally from https://github.com/leonawicz/ProjectManagement. Main function is convertDocs.
# @knitr template_objects
# For package 'rpm'
# data
rmd.template <-
'\n
## Introduction
ADD_TEXT_HERE
@zhilongjia
zhilongjia / GPL2BioC_annotation.R
Created September 21, 2015 13:05
Mappings between GPL and Bioconductor microarry annotation packages
# Mappings between GPL and Bioconductor microarry annotation packages
# 2015-09-21
library(GEOmetadb)
if(!file.exists('GEOmetadb.sqlite')) getSQLiteFile()
con <- dbConnect(SQLite(),'GEOmetadb.sqlite')
write.table( getBiocPlatformMap(con), file="GPL_Bioconductor.txt", sep="\t", quote=F, row.names=F)
# ref: http://www.bioconductor.org/packages/release/bioc/vignettes/GEOmetadb/inst/doc/GEOmetadb.html#mappings-between-gpl-and-bioconductor-microarry-annotation-packages
@zhilongjia
zhilongjia / bioinformatics_journal_period.R
Created September 7, 2015 23:27
Period (days) needed for a manuscript to be accepted after receievd in journals of the area of bioinformatics
#! /usr/bin/Rscript
# This script is used for getting the period (days) needed for a manuscript to be
# accepted after receievd in journals of the area of bioinformatics.
# ref: http://www.r-bloggers.com/bioinformatics-journals-time-from-submission-to-acceptance-revisited/
################################################################################
# Some bioinformatics journals