Created
August 3, 2018 15:42
-
-
Save MattOates/b983d9cb97886861b5c10f89715f9431 to your computer and use it in GitHub Desktop.
So running the below with the pathological case ftp://ftp.ncbi.nlm.nih.gov/genomes/Homo_sapiens/ARCHIVE/BUILD.37.3/CHR_01/hs_ref_GRCh37.p5_chr1.fa.gz
This file contains 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 { | |
FIRST { next } | |
chomp $line; | |
$out_file.print($line); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment