Skip to content

Instantly share code, notes, and snippets.

View davetang's full-sized avatar
πŸ¦€
πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€

Dave Tang davetang

πŸ¦€
πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€
View GitHub Profile
#!/usr/bin/env perl
use strict;
use warnings;
my $data = [];
my $t_data = [];
while(<>){
chomp;
#!/usr/bin/env perl
use strict;
use warnings;
my $usage = "Usage: $0 <bp> <seed>\n";
my $num = shift or die $usage;
my $seed = shift or die $usage;
#set seed for reproducibility
#!/usr/bin/env perl
use strict;
use warnings;
my $usage = "Usage: $0 <infile.fa> <number> <length>\n";
my $fasta = shift or die $usage;
my $num = shift or die $usage;
my $len = shift or die $usage;
@davetang
davetang / compare_list.pl
Last active August 29, 2015 14:22
Script that compares two files of IDs, that are on separate lines
#!/usr/bin/env perl
#
# Script that compares two files of IDs, that are on separate lines
# See http://stackoverflow.com/questions/2933347/comparing-two-arrays-using-perl
#
use strict;
use warnings;
use Array::Utils qw(:all);
@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;
@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 / 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 / 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
#!/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){
#!/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"))
}