Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env perl
- use strict;
- use warnings FATAL => 'all';
- use Data::Dumper::Concise;
- use Log::Log4perl ':easy';
- Log::Log4perl->easy_init;
- # try stuff here ...
- use File::Spec::Functions qw( catfile );
- use IO qw( Dir File );
- use Text::CSV_XS;
- #
- # get the maid_ids ...
- my $dir = IO::Dir->new( $ENV{regeneron_designs} );
- my %maid_id = ();
- while ( defined( my $file = $dir->read ) ) {
- $maid_id{$1} = $file if $file =~ m/^(\d+)\.gb$/;
- }
- $dir->close;
- INFO "maid id count: ", scalar keys %maid_id;
- #
- # get the coordinates with maid ids ...
- my $csv = Text::CSV_XS->new( { sep_char => "\t", eol => $/ } );
- my $io = IO::File->new( $ENV{ko_coordinates} );
- my %project_id = ();
- $csv->column_names(qw( project_id chromosome start end bac_id ));
- while ( my $row = $csv->getline_hr($io) ) {
- $project_id{ $row->{project_id} } = $row
- if exists $maid_id{ $row->{project_id} };
- }
- $io->close;
- INFO "projects with maid ids: ", scalar keys %project_id;
- #
- # print some file names ...
- INFO Dumper [
- map {
- $project_id{$_}{file}
- = catfile( $ENV{regeneron_designs}, $_ . ".gb" );
- $project_id{$_};
- } ( keys %project_id )[ 0 .. 5 ]
- ];
- exit 0;
Add Comment
Please, Sign In to add comment