Guest User

Untitled

a guest
Jun 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. #! /usr/bin/env perl
  2. use strict;
  3. use warnings FATAL => 'all';
  4. use Data::Dumper::Concise;
  5. use Log::Log4perl ':easy';
  6.  
  7. Log::Log4perl->easy_init;
  8.  
  9. # try stuff here ...
  10. use File::Spec::Functions qw( catfile );
  11. use IO qw( Dir File );
  12. use Text::CSV_XS;
  13.  
  14. #
  15. # get the maid_ids ...
  16. my $dir = IO::Dir->new( $ENV{regeneron_designs} );
  17. my %maid_id = ();
  18. while ( defined( my $file = $dir->read ) ) {
  19. $maid_id{$1} = $file if $file =~ m/^(\d+)\.gb$/;
  20. }
  21. $dir->close;
  22. INFO "maid id count: ", scalar keys %maid_id;
  23.  
  24. #
  25. # get the coordinates with maid ids ...
  26. my $csv = Text::CSV_XS->new( { sep_char => "\t", eol => $/ } );
  27. my $io = IO::File->new( $ENV{ko_coordinates} );
  28. my %project_id = ();
  29. $csv->column_names(qw( project_id chromosome start end bac_id ));
  30. while ( my $row = $csv->getline_hr($io) ) {
  31. $project_id{ $row->{project_id} } = $row
  32. if exists $maid_id{ $row->{project_id} };
  33. }
  34. $io->close;
  35. INFO "projects with maid ids: ", scalar keys %project_id;
  36.  
  37. #
  38. # print some file names ...
  39. INFO Dumper [
  40. map {
  41. $project_id{$_}{file}
  42. = catfile( $ENV{regeneron_designs}, $_ . ".gb" );
  43. $project_id{$_};
  44. } ( keys %project_id )[ 0 .. 5 ]
  45. ];
  46.  
  47. exit 0;
Add Comment
Please, Sign In to add comment