Extract genomic features from an TxDb object
Tuesday, 26 April 2016
Ubuntu 16.04 Set Up Menu Bar in Terminal and Open New Terminal as Tab
Cited from Missing menus on fresh boots or restarts on ubuntu sessions
mkdir -p .config/autostart
gedit .config/autostart/menus.desktop
and copy the following into this file.
"""
[Desktop Entry]
Type=Application
Exec=initctl restart unity-panel-service
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=menus
Comment=Show me the menus
X-GNOME-Autostart-Delay=
"""
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Open Gnome Terminal in New Tab in Ubuntu 15.04
mkdir -p .config/autostart
gedit .config/autostart/menus.desktop
and copy the following into this file.
"""
[Desktop Entry]
Type=Application
Exec=initctl restart unity-panel-service
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=menus
Comment=Show me the menus
X-GNOME-Autostart-Delay=
"""
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Open Gnome Terminal in New Tab in Ubuntu 15.04
Monday, 25 April 2016
The Differences Between "<-" and "="
Cited from Difference between assignment operators in R
To reduce ambiguity, we should use either <- or = as assignment operator, and only use = as named-parameter specifier for functions.
In conclusion, for better readability of R code, I suggest that we only use <- for assignment and = for specifying named parameters.
To reduce ambiguity, we should use either <- or = as assignment operator, and only use = as named-parameter specifier for functions.
In conclusion, for better readability of R code, I suggest that we only use <- for assignment and = for specifying named parameters.
Thursday, 21 April 2016
Wednesday, 20 April 2016
R Finding Out Package Version
Cited from How to find out which package version is loaded in R?
sessionInfo()
packageVersion("GetoptLong")
sessionInfo()
packageVersion("GetoptLong")
Monday, 18 April 2016
Split a Bed File Based on Chromosome
Cited from Splitting a `.bed` file based on chromosomes into 'chromosomeName.bed'
awk 'BEGIN{FS="\t"; OFS="\t"} {f = $1 ".bed"; print > f}' input.bed
awk 'BEGIN{FS="\t"; OFS="\t"} {f = $1 ".bed"; print > f}' input.bed
Friday, 15 April 2016
Wednesday, 13 April 2016
Bash: set -x
Cited from find: What's up with basename and dirname?
set -x shows how the expansion works and what the final command is.
set -x shows how the expansion works and what the final command is.
Monday, 11 April 2016
Non-standard Evaluation in R (Meta-programming)
Cited from Non-standard evaluation
substitute() looks at a function argument and instead of seeing the value, it sees the code used to compute the value. substitute() returns an expression.
substitute() works because function arguments are represented by a special type of object called a promise. A promise captures the expression needed to compute the value and the environment in which to compute it.
substitute() is often paired with deparse(). That function takes the result of substitute(), an expression, and turns it into a character vector.
One important feature of deparse() to be aware of when programming is that it can return multiple strings if the input is too long.
eval() takes an expression and evaluates it in the specified environment.
quote(). It captures an unevaluated expression like substitute(), but doesn’t do any of the advanced transformations that can make substitute() confusing. quote() always returns its input as is.
So if you only provide one argument, it will evaluate the expression in the current environment. This makes eval(quote(x)) exactly equivalent to x, regardless of what x is.
eval()’s second argument need not be limited to an environment: it can also be a list or a data frame.
=====================================
Cited from Tips on non-standard evaluation in R
In fact, eval(expr, envir, enclos) basically follows the following logic to evaluate a quoted expression:
Non standard evaluation from another function in R
substitute() looks at a function argument and instead of seeing the value, it sees the code used to compute the value. substitute() returns an expression.
substitute() works because function arguments are represented by a special type of object called a promise. A promise captures the expression needed to compute the value and the environment in which to compute it.
substitute() is often paired with deparse(). That function takes the result of substitute(), an expression, and turns it into a character vector.
One important feature of deparse() to be aware of when programming is that it can return multiple strings if the input is too long.
eval() takes an expression and evaluates it in the specified environment.
quote(). It captures an unevaluated expression like substitute(), but doesn’t do any of the advanced transformations that can make substitute() confusing. quote() always returns its input as is.
So if you only provide one argument, it will evaluate the expression in the current environment. This makes eval(quote(x)) exactly equivalent to x, regardless of what x is.
eval()’s second argument need not be limited to an environment: it can also be a list or a data frame.
=====================================
Cited from Tips on non-standard evaluation in R
In fact, eval(expr, envir, enclos) basically follows the following logic to evaluate a quoted expression:
- If envir is an environment, then evaluate expr in envir by looking for symbols all the way along envir and its parent environments until found.
- If envir is a list, then evaluate expr given the symbols defined in the list; Whenever a symbol is not found in the list, the function will go to enclos environment to find along the chain until found.
- If a symbol is not found until the empty environment (the only environment having no parent) is reached, an error occurs.
Non standard evaluation from another function in R
Friday, 8 April 2016
Thursday, 7 April 2016
Tab "\t" in Bash
Cited from Bash Join Command
$'\t' for the tab character, not just -t \t. Bash does not interpret \t unless in $' ' quotes.
join -t $'\t' ...
$'\t' for the tab character, not just -t \t. Bash does not interpret \t unless in $' ' quotes.
join -t $'\t' ...
Wednesday, 6 April 2016
Java Installation and Update
sudo apt-get install openjdk-8-jre
Tuesday, 5 April 2016
Saturday, 2 April 2016
What does "canonical" mean in biology?
Most likely, "canonical" in biology means "consensus".
Cited from Canonical sequence
"A canonical sequence is a sequence of DNA, RNA, or amino acids that reflects the most common choice of base or amino acid at each position."
Cited from Canonical sequence
"A canonical sequence is a sequence of DNA, RNA, or amino acids that reflects the most common choice of base or amino acid at each position."
Subscribe to:
Posts (Atom)