This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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+/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use warnings; | |
use strict; | |
my $BAILOUT=16; | |
my $MAX_ITERATIONS=1000; | |
my $begin = time(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env perl | |
use strict; | |
use warnings; | |
print "My very first Gist on GitHub!\n"; | |
exit(0); | |
__END__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#install if necessary | |
install.packages('gtools') | |
#load library | |
library(gtools) | |
#urn with 3 balls | |
x <- c('red', 'blue', 'black') | |
#pick 2 balls from the urn with replacement | |
#get all permutations | |
permutations(n=3,r=2,v=x,repeats.allowed=T) | |
# [,1] [,2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#use chr22 as an example | |
#how many entries on the negative strand of chr22? | |
table(bam_df$rname == 'chr22' & bam_df$flag == 16) | |
# FALSE TRUE | |
#3875997 24413 | |
#function for checking negative strand | |
check_neg <- function(x){ | |
if (intToBits(x)[5] == 1){ | |
return(T) |
OlderNewer