Skip to content

Instantly share code, notes, and snippets.

@sestaton
sestaton / build_ecolopy.sh
Last active August 29, 2015 13:57
build deps for GMPY2 and install Ecolopy
#!/bin/bash
## Location for local build of gmpy2 and deps
cd apps
mkdir gmpy2 && cd gmpy2
## Download and compile gmp
wget https://ftp.gnu.org/gnu/gmp/gmp-5.1.3.tar.bz2 && tar xjf gmp-5.1.3.tar.bz2
cd gmp-5.1.3
./configure --prefix=/home/jmblab/statonse/apps/gmpy2
@sestaton
sestaton / testdefined.pl
Last active August 29, 2015 14:05
show the difference between defined and exists
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
my %hash = (
id => undef,
id2 => 2,
);
@sestaton
sestaton / blast2MSP.pl
Last active August 29, 2015 14:05
Convert a tab-delimited blast report to RECON MSP format
#!/usr/bin/env perl
use strict;
use warnings;
my $usage = "blastn -outfmt 6 ... | $0 - > blast_msp_recon.txt\n-OR-\n".
"$0 blasttable.bln > blast_msp_recon.txt\n";
die $usage if !@ARGV;
while (<>) {
@sestaton
sestaton / biostars123787.pl
Last active August 29, 2015 14:11
biostars123787.pl - print numeric Fasta records
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
use Bio::SeqIO;
use List::MoreUtils qw(any);
my @ids = (1, 5, 10);
my $num = 0;
@sestaton
sestaton / biostars125994.pl
Last active August 29, 2015 14:13
biostars125994.pl - align all files in a directory
#!/usr/bin/env perl
use strict;
use warnings;
use File::Find;
use Bio::Tools::Run::Alignment::Clustalw;
my $dir = 'genes';
my @files;
find( sub {
@sestaton
sestaton / seqanswers163784.sh
Last active August 29, 2015 14:18
trim sra files and repair the reads
#!/bin/bash
## fetch the archive
wget ftp://ftp-trace.ncbi.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/SRR156/SRR1561197/SRR1561197.sra
## extract the pairs
fastq-dump -F --split-files ./SRR1561197.sra
## trim
fastq_quality_filter -i SRR1561197_1.fastq -q 28 -p 100 -Q33 -o SRR1561197_1_filt.fastq
@sestaton
sestaton / biostars140225.pl
Created May 1, 2015 16:30
benchmark sting formatting
#!/usr/bin/env perl
use 5.020;
use strict;
use warnings;
use Benchmark qw(:all);
my $seq = "ATCG" x 25e6; # 100Mb string
my $count = 10;
@sestaton
sestaton / custom_num_subtype.pl
Last active August 29, 2015 14:20
small test for creating custom moose types
package test::role;
use Moose::Role;
use Moose::Util::TypeConstraints;
subtype 'ModNum'
=> as 'Num'
=> where { /\_/ || /\d+/ };
coerce 'ModNum',
@sestaton
sestaton / transposome_install.sh
Last active October 31, 2015 00:31
install perlbrew, perl, cpanminus, and transposome on a system with a broken wget
#!/bin/bash
##NB: Follow these instructions for installing Transposome: http://sestaton.github.io/Transposome
## What follows is to help users on really old Linux systems with a broken wget and no admin privileges.
export PERLBREW_ROOT=$HOME/perl5/perlbrew
export PERLBREW_HOME=$HOME/.perlbrew
# install perlbrew and patchperl
echo "Downloading perlbrew..."
@sestaton
sestaton / biostars95834.pl
Last active November 13, 2015 17:37
biostars95834.pl - parse blasttable
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
while (<DATA>) {
chomp;
my ($query, $subject, $percent_identity, $alignment_length, $mistmatches,
$gap_openings, $q_start, $q_end, $s_start, $s_end, $e_value, $bit_score) = split /\t/;