Skip to content

Instantly share code, notes, and snippets.

View ShixiangWang's full-sized avatar
🀄
Open Source Better Science

Shixiang Wang (王诗翔) ShixiangWang

🀄
Open Source Better Science
View GitHub Profile
@ShixiangWang
ShixiangWang / clean.sh
Last active September 23, 2021 06:17
download-images-from-block-site
#!/usr/bin/env bash
# identify and remove broke images
# with imageMagick
for i in $(ls -d train/cat/* train/fish/* val/cat/* val/fish/* test/cat/* test/fish/*); do
identify $i > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "file $i is broken, removing it"
rm $i
fi
#!/bin/bash
# function Extract for common file formats
function extract {
if [ -z "$1" ]; then
# display usage if no parameters given
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
else
if [ -f "$1" ] ; then
NAME=${1%.*}
@ShixiangWang
ShixiangWang / product-info.csv
Created August 28, 2018 15:00 — forked from renkun-ken/product-info.csv
Demo data of products
id name type class released
T01 SupCar toy vehicle yes
T02 SupPlane toy vehicle no
M01 JeepX model vehicle yes
M02 AircraftX model vehicle yes
M03 Runner model people yes
M04 Dancer model people no
@ShixiangWang
ShixiangWang / tcga_replicateFilter.R
Last active November 1, 2023 07:25
A R function used to Filter TCGA Replicate Samples
#---------------------------------------------------
# Filter TCGA Replicate Samples
# Author: ShixiangWang <w_shixiang@163.com>
# ooooooo
# The filter rule following broad institute says:
#
# In many instances there is more than one aliquot for a given combination of individual, platform, and data type. However, only one aliquot may be ingested into Firehose. Therefore, a set of precedence rules are applied to select the most scientifically advantageous one among them. Two filters are applied to achieve this aim: an Analyte Replicate Filter and a Sort Replicate Filter.
#
# Analyte Replicate Filter
# The following precedence rules are applied when the aliquots have differing analytes. For RNA aliquots, T analytes are dropped in preference to H and R analytes, since T is the inferior extraction protocol. If H and R are encountered, H is the chosen analyte. This is somewhat arbitrary and subject to change, since it is not clear at present whether H or R is the better protocol. If there are multiple aliquots as
@ShixiangWang
ShixiangWang / groupSurvival.R
Last active January 21, 2020 13:24
two R functions used to separate continuous variable into two group for survival analysis, then plot the result.
library(survival)
library(survminer)
groupSurvival <- function(df, event="OS_IND", time="OS", var=NULL, time.limit=NULL, interval=c("open","close"),
method=c("quartile", "mean", "median", "percent", "custom"), percent=NULL,
step=20, custom_fun=NULL, group1="High", group2="Low"){
#'@param df a data.frame at leaset including three column which refer to survival info and variable used to
#' set group.
#'@param event The status indicator, normally 0=alive, 1=dead. Other choices are TRUE/FALSE (TRUE = death) or 1/2 (2=death).
#'For interval censored data, the status indicator is 0=right censored, 1=event at time, 2=left censored, 3=interval censored.
@ShixiangWang
ShixiangWang / new_post.R
Last active December 26, 2019 13:04
Easily create a Rmd file and transform it to markdown using R commands
################
## 用rmd写博客 ##
################
# 作者:王诗翔
# 更新日期:2018-02-12
#>>>>>> new_rmd_post 函数 <<<<<<<<<<
# 写好模板文档后,你可以用这个函数来创建Rmarkdown文档
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
# ---------------------------
# Accessing the material
# https://tinyurl.com/bioc2017-ELMER
# ---------------------------
library("Bioc2017.TCGAbiolinks.ELMER")
Biobase::openVignette("Bioc2017.TCGAbiolinks.ELMER")
# ---------------------------
# Section 1:
# Aims:
@ShixiangWang
ShixiangWang / gist:a49818115256f7d8a38c43482a12d0e9
Created January 9, 2018 05:55 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@ShixiangWang
ShixiangWang / Genome_Informatics_2017_software.csv
Created December 27, 2017 01:15 — forked from seandavi/Genome_Informatics_2017_software.csv
Software list mined from twitter feed for CSHL Genome Informatics meeting, 2017
url name user type
https://bioconductor.org/packages/regioneR regioneR NA Bioconductor
https://bioconductor.org/packages/karyoploteR karyoploteR NA Bioconductor
https://bioconductor.org/packages/metavizr metavizr NA Bioconductor
https://bioconductor.org/packages/IsoformSwitchAnalyzeR IsoformSwitchAnalyzeR NA Bioconductor
https://cran.rstudio.com/packages/UpSetR UpSetR NA CRAN
https://github.com/pachterlab/sleuth sleuth pachterlab github
https://github.com/nekrut/lab_site lab_site nekrut github
https://github.com/bernatgel/karyoploter_tutorial karyoploter_tutorial bernatgel github
https://bitbucket.org/biobakery/metaphlan2 metaphlan2 biobakery github