Skip to content

Instantly share code, notes, and snippets.

View andrewyatz's full-sized avatar

Andrew Yates andrewyatz

  • EMBL-EBI
  • Cambridge, UK
View GitHub Profile
@andrewyatz
andrewyatz / gist:715849
Created November 25, 2010 20:09
Reallllyyy dumb way of doing secret santa
public enum P {
PERSON('[email protected]', true),
OTHER('[email protected]', true),
EH('[email protected]', true),
private final String email
private final Boolean satan
private P(String email, Boolean satan) {
@andrewyatz
andrewyatz / SqlHelperBenchmark.pl
Created January 14, 2011 16:08
An attempt at showing what the impact of using callbacks are. In most versions of perl this is minimal
use strict;
use warnings;
use Bio::EnsEMBL::Gene;
use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::Utils::SqlHelper;
use Benchmark qw(cmpthese);
Bio::EnsEMBL::Registry->load_registry_from_db(
-HOST => 'mysql.ebi.ac.uk',
@andrewyatz
andrewyatz / storable_and_compress.pl
Created February 16, 2011 15:09
A way of plugging a storable call into a compress call & then ripping this back out @ the other end
use strict;
use warnings;
use Data::Dumper; # Not required
use Storable qw(nfreeze thaw);
use IO::Compress::Gzip qw(gzip $GzipError); # qw() imports only for functional
use IO::Uncompress::Gunzip qw(gunzip $GunzipError); # qw() imports only for functional
#Just doing some quick obj hacks
my $v = bless({ b => bless({ a => 1, c => [qw(x y z)]}, 'My::A') }, 'My::B');
@andrewyatz
andrewyatz / list_synteny.pl
Last active October 5, 2022 15:39
A way of printing synteny regions to screen or file from an ensembl or ensembl genomes resource
#!/bin/env perl
use strict;
use warnings;
use Getopt::Long;
use Pod::Usage;
use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::Utils::Scalar qw(wrap_array);
use IO::String;
@andrewyatz
andrewyatz / dicty_introns.pl
Created February 22, 2011 14:05
An Ensembl script for finding all the available introns for a single Gene for each of its transcripts & printing them to screen
=head1 LICENSE
Copyright (c) 1999-2011 The European Bioinformatics Institute and
Genome Research Limited. All rights reserved.
This software is distributed under a modified Apache license.
For license details, please see
http://www.ensembl.org/info/about/code_licence.html
@andrewyatz
andrewyatz / gist:849606
Created March 1, 2011 18:29
How to deadlock MySQL
-- Setup the following schema
CREATE TABLE `seq` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(11) NOT NULL,
`value` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_idx` (`name`)
) ENGINE=InnoDB;
@andrewyatz
andrewyatz / spawn_reap.pl
Created March 2, 2011 21:54
Spawning, selecting STDOUT/STDERR & reaping an external process in Perl
use strict;
use warnings;
use IPC::Open3;
use IO::Select;
my $debug = 1;
my $cmd = 'do something on the system';
my ($in_fh, $out_fh, $err_fh);
@andrewyatz
andrewyatz / extracting_seqregions.pl
Created March 14, 2011 10:31
Code which looks for sequence regions in the Aedes database from Ensembl Metazoa
use strict;
use warnings;
use Bio::EnsEMBL::Registry;
Bio::EnsEMBL::Registry->load_registry_from_db(
-host=>'mysql.ebi.ac.uk',
-user=>'anonymous',
-port=>4157,
-db_version => 61
@andrewyatz
andrewyatz / eg_insdc_accessions.pl
Created March 28, 2011 10:15
Searching for an INSDC accession using the EBI Search for Ensembl Genomes species which have not had their contig level sequences mapped to an INSDC accession
use strict;
use warnings;
use Bio::EnsEMBL::Registry;
use SOAP::Lite;
# Use the import below if you want to see more information from webservices
# otherwise use the one above
# use SOAP::Lite +trace => 'debug';
my $species = 'aedes aegypti';
@andrewyatz
andrewyatz / downloading_dicty_introns.pl
Created April 5, 2011 09:22
An example script for downloading & storing introns from an Ensembl database (Dictyostelium discoideum)
use strict;
use warnings;
use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::DBSQL::DBConnection;
use Bio::EnsEMBL::Utils::SqlHelper;
#Load all DBs from Ensembl Genomes
Bio::EnsEMBL::Registry->load_registry_from_db(
-HOST => 'mysql.ebi.ac.uk',
-PORT => 4157,