WORK IN PROGRESS!
We benchmarked the following operations (all operations got timed
with system.time()):
| Creative Commons Legal Code | |
| CC0 1.0 Universal | |
| CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE | |
| LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN | |
| ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS | |
| INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES | |
| REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS | |
| PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM |
| # Shell function to subsample to a fixed number of alignments, | |
| # requiring the sambamba and samtools suites to be available. | |
| # see https://www.biostars.org/p/76791/ | |
| function SubSample { | |
| local FACTOR=$(samtools idxstats $1 | cut -f3 | \ | |
| awk -v COUNT=$2 'BEGIN {total=0} {total += $1} END {print COUNT/total}') | |
| if [[ $FACTOR > 1 ]] | |
| then | |
| echo '[ERROR]: Requested number of reads exceeds total read count in' $1 '-- exiting' && exit 1 |
There's not a complete hook system designed in Bash when compared with other modern shells. PROMPT_COMMAND variable is used as a hook in Bash, which is equivalent to precmd hook in ZSH, fish_prompt in Fish. For the time being, ZSH is the only shell I've known that has a chpwd hook builtin.
PROMPT_COMMAND
If set, the value is interpreted as a command to execute before the printing of each primary prompt ($PS1).
https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Bash-Variables
# Author: Boris Steipe (ORCID: 0000-0002-1134-6758)
# License: (c) Author (2019) + MIT
# Date: 2019-01-17I recently contributed to Siegfried Köstlmeier's qrandom package and overlooked to update the package MD5 file. That got me thinking - these files are actually not mentioned in Writing R Extensions, and they are not mentioned in Hadley Wickham's R Packages either. We find them in the wild - but I did not find an explicit source regarding their format. In fact, there is a puzzled post from 2016 by Matthew Lueder on Stack Overflow "What is the MD5 file in R packages used for? How is it generated?" ... and the sole answer on the page misunderstood the question.
| #!/bin/bash | |
| CLEAR='\033[0m' | |
| RED='\033[0;31m' | |
| function usage() { | |
| if [ -n "$1" ]; then | |
| echo -e "${RED}👉 $1${CLEAR}\n"; | |
| fi | |
| echo "Usage: $0 [-n number-of-people] [-s section-id] [-c cache-file]" |
| fn main() { | |
| let rng = 0..30; | |
| let rng_even_cubed = rng.filter(|n| is_even(*n)) | |
| .map(|n| n * n * n) | |
| .collect::<Vec<i32>>(); | |
| println!("{:?}", rng_even_cubed); | |
| } | |
| fn is_even(n: i32) -> bool { | |
| n % 2 == 0 |
| # | |
| # Original solution via StackOverflow: | |
| # http://stackoverflow.com/questions/35802939/install-only-available-packages-using-conda-install-yes-file-requirements-t | |
| # | |
| # | |
| # Install via `conda` directly. | |
| # This will fail to install all | |
| # dependencies. If one fails, | |
| # all dependencies will fail to install. |
We would like to position Conda as a language-agnostic package manager, but at present it maintains a distinct bias towards Python. Given its origins this was expected and, frankly, reasonable. Nevertheless, as we begin to use it to subsume other packaging ecosystems, such as CRAN, NPM, Ruby Gems, etc., we are going to want to overcome this history; and one key challenge is to address naming conflicts across platforms.
| ## This will allow you to use dplyr functions with Bioconductor's | |
| ## S4Vectors::DataFrame class. They simply call "as.data.frame" on | |
| ## DataFrame objects and then pass them to the methods for | |
| ## "data.frame". Note that this entails conversion of S4 vector | |
| ## columns to primitive vectors. No attempt is made to convert the | |
| ## results back to DataFrame, since such a conversion would not | |
| ## restore S4 vector columns that were converted to primitive vectors. | |
| library(S4Vectors) | |
| library(dplyr) |