Skip to content

Instantly share code, notes, and snippets.

View dbolser's full-sized avatar
💭
Reversing the polarity

Dan Bolser dbolser

💭
Reversing the polarity
View GitHub Profile
SELECT
s.name
FROM
seq_region s
INNER JOIN
seq_region_attrib USING (seq_region_id)
INNER JOIN
coord_system c USING (coord_system_id)
LEFT JOIN
assembly ON seq_region_id = asm_seq_region_id
ensrw@mysql-eg-staging-2.ebi.ac.uk:4275 (oryza_sativa_core_22_75_7)
> SELECT COUNT(*) FROM exon_transcript;
+----------+
| COUNT(*) |
+----------+
| 248445 |
+----------+
1 row in set (0.00 sec)
> SELECT COUNT(*), COUNT(DISTINCT exon_id), COUNT(DISTINCT transcript_id) FROM exon_transcript;
+----------+-------------------------+-------------------------------+
| COUNT(*) | COUNT(DISTINCT exon_id) | COUNT(DISTINCT transcript_id) |
+----------+-------------------------+-------------------------------+
| 248445 | 248445 | 248445 |
+----------+-------------------------+-------------------------------+
1 row in set (0.00 sec)
> SELECT COUNT(*), SUM(exon_id is null), COUNT(DISTINCT exon_id), COUNT(DISTINCT transcript_id) FROM exon_transcript;
DROP TABLE IF EXISTS test_et;
CREATE TABLE test_et (
exon_id int unsigned NOT NULL,
transcript_id int unsigned NOT NULL,
rank int NOT NULL,
##
PRIMARY KEY (exon_id, transcript_id, rank)#,
#KEY exon (exon_id),
#KEY transcript ( transcript_id)
);
for module in \
ensembl \
ensembl-compara \
ensembl-funcgen \
ensembl-rest \
ensembl-tools \
ensembl-variation
do
if [ ! -d "$module" ]; then
echo "Checking out $module ($branch)"
@dbolser
dbolser / gist:dc76ac3de2f56e7472f5
Last active August 29, 2015 14:01
Convert intron-style GFF to exon-style GFF with Perl
#! perl
use strict;
use warnings;
die "pass an intron-style GFF for me to calcualte exons over\n"
unless @ARGV;
## Tracking variables
my $prev_type = 'dumped';
<?php
/**
* @file
* Apache Solr external index module - example module for using external data.
*/
/**
* implements hook_apachesolr_query_alter().
*/
function apachesolr_external_index_apachesolr_query_alter(DrupalSolrQueryInterface $query) {
#!perl
use strict;
use warnings;
## Easy manipulation of sets of integers (arbitrary intervals)
use Set::IntRange;
## Create two sets to play with
my $set_len = 1000000000;
diff --git a/modules/Bio/EnsEMBL/EGPipeline/Xref/UniProtLoader.pm b/modules/Bio/EnsEMBL/EGPipeline/Xref/UniProtLoader.pm
index ceec266..739fd31 100644
--- a/modules/Bio/EnsEMBL/EGPipeline/Xref/UniProtLoader.pm
+++ b/modules/Bio/EnsEMBL/EGPipeline/Xref/UniProtLoader.pm
@@ -196,6 +196,10 @@ sub add_uniprot_xrefs {
sub store_uniprot_xrefs {
my ( $self, $ddba, $tid, $uniprots, $gene_id, $gene_attribs ) = @_;
+
+ my $n = 0;
21:13 < dbolser_> On another issue... I'm usign LWP::Simple to grab this:
https://letstalkbitcoin.com/api/v1/forum/threads, which is
"Content-Type:application/json", however, when I decode_json
(using JSON), I get the error: malformed JSON string, neither
array, object, number, string or atom, at character offset 0
(before "\x{ef}\x{bb}\x{bf}{"...") at ./get_and_load_data.plx
line 24
21:14 < dngor> Maybe it's compressed.
21:14 < mauke> no, UTF-8 BOM
21:14 < mauke> a.k.a. malformed JSON