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
#!perl
use strict;
use warnings;
=pod
Script to grab the peptide sequence of a given ID from the DB
=cut
#!/usr/bin/env perl
$| = 1;
use strict;
use warnings;
use autodie;
use feature 'say';
use Class::Load 'load_class';
use Cwd 'cwd';
Here is the error I'm seeing:
dmb@percy:AMDAPP$ bfgminer -n
[2013-07-24 11:57:07] Error -1001: clGetPlatformsIDs failed (no OpenCL SDK installed?)
[2013-07-24 11:57:07] clDevicesNum returned error, no GPUs usable
[2013-07-24 11:57:07] 0 GPU devices max detected
dmb@percy:AMDAPP$ bfgminer --version
bfgminer 3.1.3
@dbolser
dbolser / Crappy OpenCL installer from AMD
Created July 24, 2013 11:12
This is the 'installer' that OpenCL bundles with from AMD
#!/usr/bin/perl
use Tie::File;
if(-e "AMDAPPlog.txt") {
unlink("AMDAPPlog.txt");
}
$pkg_name="AMD-APP-SDK-v2.8.1.0-RC";
$version_appsdk="v2.8.1.0";
open(OUTPUT_LOG,'>', "AMD_APPSDK_v2.8.1.0.log");
my $steps =1;
@dbolser
dbolser / gist:5797661
Created June 17, 2013 15:13
Format to convert...
Example input...
#
# More information on reference human assembly build 36:
# http://www.ncbi.nlm.nih.gov/projects/mapview/map_search.cgi?taxid=9606&build=36
#
# rsid chromosome position genotype
rs4477212 1 72017 AA
rs3094315 1 742429 AA
rs3131972 1 742584 GG
@dbolser
dbolser / project_features_generic.pl
Last active December 11, 2015 03:28
My attempted script.
#!/usr/bin/env perl
# Projects generic features ... hopefully
use strict;
use warnings;
use Data::Dumper;
use Bio::EnsEMBL::Registry;
> EXPLAIN SELECT COUNT(DISTINCT feature_stable_id), COUNT(DISTINCT feature_stable_id, somatic) FROM transcript_variation ;
+----+-------------+----------------------+-------+---------------+---------------------+---------+------+----------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+----------------------+-------+---------------+---------------------+---------+------+----------+-------------+
| 1 | SIMPLE | transcript_variation | index | NULL | somatic_feature_idx | 132 | NULL | 64279473 | Using index |
+----+-------------+----------------------+-------+---------------+---------------------+---------+------+----------+-------------+
> EXPLAIN SELECT COUNT(DISTINCT feature_stable_id), COUNT(DISTINCT feature_stable_id, somatic) FROM transcript_variation IGNORE INDEX (somatic_feature_idx);
+----+-------------+----------------------+------+---------------+------+-------
DELIMITER $$
DROP PROCEDURE IF EXISTS GetAllDistinctValuesByColumnName$$
CREATE PROCEDURE GetAllDistinctValuesByColumnName (ColName VARCHAR(255))
BEGIN
DECLARE no_more_tables INT DEFAULT 0;
DECLARE my_table VARCHAR(255);
DELIMITER //
CREATE PROCEDURE GetAllValues(ColName VARCHAR(255))
BEGIN
SELECT
COLUMN_NAME, TABLE_NAME
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
TABLE_SCHEMA = DATABASE()
static function isNodeNotEmpty( $node ) {
return trim( $node[0] ) != '';
}
static function filterEmptyNodes( $nodes ) {
if ( !is_array( $nodes ) ) return $nodes;
return array_filter( $nodes, "self::isNodeNotEmpty" );
}