- No performance benchmark.
- Python ⟿
PEP-8
- Nim ⟿
NEP1
- Python ⟿
3.7
- Nim ⟿
0.19
- No Ofuscation, no Code-Golf.
This is to compare elegant, simple, expressive code.
function sort_vcf { | |
grep "^#" ${1} | |
grep -v "^#" ${1} | sort -V -k1,1 -k2,2n | |
} |
function ls_snapshot { | |
if [[ -z $1 ]]; then | |
n_backup=1 | |
else | |
n_backup=${1} | |
fi; | |
search="" | |
original_path=$(pwd -P) |
import scholarly | |
search_results = scholarly.search_pubs_query("CeNDR") | |
top = next(search_results) | |
assert top.bib["title"] == "CeNDR, the Caenorhabditis elegans natural diversity resource" | |
citations = list(top.get_citedby()) | |
for i in citations: | |
print("\t".join(i.bib["title"], i.bib["author"], i.bib.get("eprint"))] |
# A double bar || OR in R "short circuits" | |
# The || operator will skip evaluating the second argument if the first argument is TRUE. | |
{ print("left"); TRUE } || { print("right"); TRUE } # Prints left | |
{ print("left"); FALSE } || { print("right"); TRUE } # Prints left, right | |
# The && operator will skip evaluating the second argument if the first argument is TRUE. | |
{ print("left"); TRUE } && { print("right"); TRUE } # Prints left, right | |
{ print("left"); FALSE } && { print("right"); TRUE } # Prints right | |
# Both arguments will be evaluated, even though the first one is TRUE |
conda activate primary-env | |
function extract_gts() { | |
i=${1} | |
patient=$(echo ${i} | egrep -o "LTX[0-9]+" | head -n 1) | |
sample=$(echo ${i} | cut -f 5 -d "/") | |
vcf2tsv -g ${i} | \ | |
awk -v patient=${patient} -v fname=${i} -v OFS="\t" -v sample=${sample} 'NR == 1 { print "patient", "sample", "fname", $0 } NR > 1 { print patient, sample, fname, $0 }' | \ | |
awk '!arr[$0]++' > gl_genotypes/${patient}.tsv | |
} |
function excel() { | |
tmp=`mktemp` | |
out=${1} | |
cat ${out} > $tmp | |
open -a "Microsoft Excel" $tmp | |
} |
#!/usr/bin/env nextflow | |
@Grab(group='commons-io', module='commons-io', version='2.6') | |
import org.apache.commons.io.FilenameUtils; |
# Shortcut for going to work directories | |
# Usage: gw <workdir pattern> | |
# Replace the work directory below as needed | |
# Where workdir pattern is something like "ab/afedeu" | |
function gw { | |
path=`ls --color=none -d /path/to/work/directory/$1*` | |
cd $path | |
} | |
# Go work that fetches work dir from .nextflow.log |
uint32.high # High value for uint32
uint32.low # Low value for uint32