Skip to content

Instantly share code, notes, and snippets.

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

Dave Tang davetang

🦀
🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀
View GitHub Profile
@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);
#!/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;
#!/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 $data = [];
my $t_data = [];
while(<>){
chomp;
@davetang
davetang / mandelbrot.pl
Created May 13, 2014 12:41
The Mandelbrot set is a mathematical set of points whose boundary is a distinctive and easily recognizable two-dimensional fractal shape
#!/usr/bin/perl
use warnings;
use strict;
my $BAILOUT=16;
my $MAX_ITERATIONS=1000;
my $begin = time();
#!/bin/env perl
use strict;
use warnings;
my $usage = "Usage: $0 <bam_flag>\n";
my $flag = shift or die $usage;
die "Please enter a numerical value\n" if $flag =~ /\D+/;
@davetang
davetang / split_chr.pl
Last active December 28, 2015 20:19
Script that takes as input a BED file stream and outputs the stream to its corresponding chromosome. Do not use this script in parallel.
#!/bin/env perl
use strict;
use warnings;
#hash for filehandles
my %fh = ();
#read from stream
while (<>){
@davetang
davetang / random_bed.pl
Created November 19, 2013 04:03
Randomise a BED file.
#!/bin/env perl
use strict;
use warnings;
my $usage = "Usage: $0 <infile.bed>\n";
my $infile = shift or die $usage;
my %bed = ();
@davetang
davetang / copy_directory.pl
Last active December 28, 2015 09:29
Perl script that takes two directory paths, one old and one new, compares the two and copies directories in the old to the new if it doesn't exist.
#!/bin/env perl
use strict;
use warnings;
my $usage = "Usage: $0 <old_dir> <new_dir>\n";
my $old = shift or die $usage;
my $new = shift or die $usage;
my %current = ();
@davetang
davetang / psl_to_bed_best_score.pl
Last active April 9, 2021 13:55
A more documented version of my psl_to_bed_best_score.pl script at http://davetang.org/wiki/tiki-index.php?page=Blat.
#!/usr/bin/env perl
use strict;
use warnings;
=head1 NAME
This scripts converts a psl file into a bed file written by Dave Tang.
=head1 SYNOPSIS