Skip to content

Instantly share code, notes, and snippets.

@sestaton
sestaton / fmtDetailValue_Ontology_term.js
Created May 12, 2016 20:58
create GO term links for jbrowse
fmtDetailValue_Ontology_term : function(goterm) {
if (typeof goterm != 'string') {
return goterm;
}
var dbid = goterm.split(':');
var prefix = '';
switch (dbid[0]) {
case 'GO':
prefix = 'http://amigo.geneontology.org/amigo/medial_search?q=GO:';
break;
@sestaton
sestaton / fmtDetailValue_Dbxref.js
Last active July 4, 2018 04:56
create dbxref links for jbrowse
fmtDetailValue_Dbxref : function(dbxref) {
if (typeof dbxref != 'string') {
return dbxref;
}
var dbid = dbxref.split(':');
var prefix = '';
switch (dbid[0]) {
case 'InterPro':
prefix = 'http://www.ebi.ac.uk/interpro/entry/';
break;
@sestaton
sestaton / fetch_by_seq.pl
Last active February 11, 2016 11:59
Fetch FASTA records by sequence
#!/usr/bin/env perl
use strict;
use warnings;
use File::Basename;
my $usage = "perl ".basename($0)." seqsi.fas seqsj.fas > seqs_out.fas";
my $infilei = shift or die $usage;
my $infilej = shift or die $usage;
@sestaton
sestaton / biostars163769.pl
Last active November 17, 2015 15:44
minimal genbank to fasta conversion
use strict;
use warnings;
my ($def, $seq);
while (<>) {
if (/^DEFINITION\s+(\S+.*)$/) {
$def = $1;
}
if (/^ORIGIN/) {
@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 / 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 / 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 / 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 / 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 / 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 (<>) {