Skip to content

Instantly share code, notes, and snippets.

@dbolser-ebi
dbolser-ebi / test.sql
Last active May 23, 2016 11:25
Can I create the last two queries automatically?
ensrw@mysql-eg-prod-2.ebi.ac.uk:4239 (triticum_aestivum_variation_31_84_2)
> SELECT * FROM variation_set_structure;
+---------------------+-------------------+
| variation_set_super | variation_set_sub |
+---------------------+-------------------+
| 11 | 1 |
| 11 | 2 |
| 11 | 3 |
| 12 | 4 |
@dbolser-ebi
dbolser-ebi / some.pl
Created May 11, 2016 14:28
Memory usage a go go
#!/usr/bin/env perl
use 5.14.0;
use warnings;
use autodie qw(:all);
use DBI;
my $dsn =
i=0
while read -r file; do
if (( i++ >= 3 )); then
wait $jobpid
fi
base=${file/*rnaseq\//}
echo $base
@dbolser-ebi
dbolser-ebi / Test Variations . pl
Created March 4, 2016 15:53
Using the Perl Variation API with attached VCF for Rice
#!/bin/env perl
use strict;
use warnings;
use Bio::EnsEMBL::Registry;
## Notes
## See this blog post (compile and make Tabix!):
DROP PROCEDURE IF EXISTS test.QueryTablesByName;
DELIMITER //
CREATE DEFINER=`ensrw`@`%` PROCEDURE `QueryTablesByName`(
tableName VARCHAR(255),
query TEXT
)
BEGIN
DROP PROCEDURE IF EXISTS test.RunQueryByDatabaseQuery;
DELIMITER //
CREATE DEFINER=`ensrw`@`%` PROCEDURE `RunQueryByDatabaseQuery`(
myQuery TEXT,
databaseQuery TEXT
)
BEGIN
#!/usr/bin/env perl
use strict;
use warnings;
die "pass a fasta and a vcf\n"
unless @ARGV == 2;
my $fsa = $ARGV[0];
my $vcf = $ARGV[1];
mysql-staging-2-ensrw hordeum_vulgare_core_30_83_2 -Ne '
SELECT CONCAT(">", name, char(10), sequence)
FROM temp_name INNER JOIN seq_region USING (name)
INNER JOIN dna USING (seq_region_id)' \
> Data/Hv_IBSC_PGSB_v2/bac_assemblies/morex.fasta
#!/usr/bin/env perl
use strict;
use warnings;
use Bio::EnsEMBL::Registry;
Bio::EnsEMBL::Registry->
load_registry_from_db(
-host => 'mysql-eg-prod-3.ebi.ac.uk',
@dbolser-ebi
dbolser-ebi / what?
Last active November 30, 2015 22:29
> SELECT COUNT(DISTINCT species_set_id)
FROM plantsx INNER JOIN species_set USING (genome_db_id)
INNER JOIN method_link_species_set USING (species_set_id) WHERE method_link_id = 401
GROUP BY method_link_id;
+--------------------------------+
| COUNT(DISTINCT species_set_id) |
+--------------------------------+
| 43 |
+--------------------------------+
1 row in set (0.01 sec)