Skip to content

Instantly share code, notes, and snippets.

View davetang's full-sized avatar
🦀
🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀

Dave Tang davetang

🦀
🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀
View GitHub Profile
#!/usr/bin/env bash
set -euo pipefail
sudo apt-get update
sudo apt-get install -y \
ca-certificates \
curl \
gnupg \
lsb-release \
@davetang
davetang / split_search.sh
Created December 8, 2021 03:40
Run grep in parallel
#!/usr/bin/env bash
set -euo pipefail
usage() {
>&2 echo "Usage: $0 [ -l search_list ] [ -f file_to_grep ] [ -n split_num ] [ -p num_threads ]"
exit 1
}
num_param=4

Keybase proof

I hereby claim:

  • I am davetang on github.
  • I am davetang (https://keybase.io/davetang) on keybase.
  • I have a public key ASD791k70QUxQTjAu2NfaNCa4dhCxY0EnzWk-AT0uqFOSQo

To claim this, I am signing this object:

#!/bin/bash
if type -P gemini > /dev/null
then
for SEVERITY in HIGH MED LOW; do
gemini query -q "select impact_so, count(impact_so) from variants where impact_severity == \"$SEVERITY\" group by impact_so order by count(impact_so)" --header *.db > $SEVERITY.tsv
plot_gemini.R $SEVERITY.tsv
rm -f $SEVERITY.tsv
done
#!/usr/bin/env Rscript
#
# Usage: plot_gemini.R <file.tsv>
#
my_required <- c('ggplot2', 'reshape2', 'ggthemes')
for (my_package in my_required){
if(my_package %in% rownames(installed.packages()) == FALSE){
stop(paste("Please install", my_package, "first"))
}
#!/usr/bin/env perl
# Script to output names and synonyms of HPO terms
use strict;
use warnings;
my $usage = "Usage: $0 <HPO term> [HPO terms]\n";
if (scalar(@ARGV) == 0){
@davetang
davetang / text_to_hpo_term.pl
Last active March 18, 2016 04:49
Align free text to Human Phenotype Ontology terms
#!/usr/bin/env perl
# Strings (the query) present on each line of a file are matched to Human Phenotype Ontology (HPO) terms (the subject)
# If a direct match between the query and subject could not be found, a global alignment is performed
# Alignments will only take place between queries and subjects that are not longer than each
# other by a length of 5 characters (including spaces)
# For example, 'short' and 'microphones' differ by a length of 6 and will not be compared
# The terms 'short' and 'computer' will be aligned because they differ by a length of 3
# Change $threshold if you want to change the length difference threshold
@davetang
davetang / tsv_sum.pl
Last active September 4, 2015 05:26
Sums the rows and columns of a tab-delimited file
#!/usr/bin/env perl
#
# Reads a tab-delimited file with column and row names
# sums the rows and columns and outputs a tab-delimited
# file with an extra row and column for the sums
#
use strict;
use warnings;
@davetang
davetang / mutate_fasta.pl
Last active November 6, 2020 10:58
Takes a fasta file as input and randomly mutates bases
#!/usr/bin/env perl
# Takes a fasta file as input and randomly mutates bases
use strict;
use warnings;
my $usage = "Usage: $0 <infile.fa> <mutation percent> <seed>\n";
my $infile = shift or die $usage;
my $mutation = shift or die $usage;
@davetang
davetang / random_paired_end.pl
Last active August 29, 2015 14:22
A script that takes an input fasta and generates properly paired reads
#!/usr/bin/env perl
# Simple script that takes an input fasta sequence
# and generates paired end reads
use strict;
use warnings;
my $usage = "Usage: $0 <infile.fa> <read length> <number of pairs> <inner mate distance> <seed>\n";
my $fasta = shift or die $usage;