This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import NamedTuple | |
| import json | |
| class NamedTupleJSONEncoder(json.JSONEncoder): | |
| def encode(self, o): | |
| print(f"Encoding {type(o)}") | |
| return super().encode(o) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE patient ( | |
| name text, | |
| administrative_gender uuid references concept.concept_cid, | |
| ethnicity uuid references concept.concept_cid, | |
| phenotypic_sex_cid uuid references concept.concept_cid, | |
| ); | |
| -- Parametric trigger for validating concept FK against sets of codesystems | |
| -- concept_ind_codesystem(concept_field_name, array_of_codesystems) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl6 | |
| sub character_differences(Str $str1, Str $str2) { | |
| $str1.comb Z~~ $str2.comb | |
| } | |
| sub hamming_distance(Str $str1, Str $str2) { | |
| my @differences = character_differences($str1, $str2); | |
| return @differences.grep(* == False).elems; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Time: <span id="clockDisplay"></span> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| say "Ohai!"; | |
| for ^10 -> $stuff { | |
| say $stuff if $stuff.is-prime; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use Stats; | |
| sub bench($name, &code) { | |
| my ($start,$end); | |
| my @times; | |
| for 1..100 { | |
| $start = now; | |
| code(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use Terminal::Width; | |
| sub is-mandelbrot(Complex $z0, int $max=100) { | |
| my Complex $z = $z0; | |
| for ^$max -> $n { | |
| return $n if ($z.abs() > 2e0); | |
| $z = $z**2 + $z0; | |
| } | |
| return $max; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl6 | |
| use Compress::Zlib; | |
| use IO::String; | |
| my $DATA_DIR = %*ENV<DATA_DIR> // '/Users/matt/data/reference/GRCh37/sequence/dna'; | |
| for dir($DATA_DIR).grep(/chr\d+\.fa\.gz/) -> $file { | |
| my $out_file = $file.IO.extension('txt', :2parts).open(:w); | |
| my $chromosome = IO::String.new(buffer=>gzslurp($file)); | |
| for $chromosome.lines -> $line { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl6 | |
| use Compress::Zlib; | |
| use IO::String; | |
| my $DATA_DIR = %*ENV<DATA_DIR> // '/Users/matt/data/reference/GRCh37/sequence/dna'; | |
| for dir($DATA_DIR).grep(/chr\d+\.fa\.gz/) -> $file { | |
| my $out_file = $file.IO.extension('txt', :2parts).open(:w); | |
| my $chromosome = IO::String.new(buffer=>gzslurp($file)); | |
| for $chromosome.lines -> $line { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl6 | |
| use Compress::Zlib; | |
| use IO::String; | |
| my $DATA_DIR = %*ENV<DATA_DIR> // '/Users/matt/data/reference/GRCh37/sequence/dna'; | |
| for dir($DATA_DIR).grep(/chr\d+\.fa\.gz/) -> $file { | |
| my $out_file = $file.IO.extension('txt', :2parts).open(:w); | |
| my $chromosome = IO::String.new(buffer=>gzslurp($file)); | |
| for $chromosome.lines -> $line { |