Skip to content

Instantly share code, notes, and snippets.

@JEEN
Created October 5, 2016 00:56
Show Gist options
  • Save JEEN/ed0ad619c7f6e4918c02275874e15cf1 to your computer and use it in GitHub Desktop.
Save JEEN/ed0ad619c7f6e4918c02275874e15cf1 to your computer and use it in GitHub Desktop.
for-yim.pl
use strict;
use warnings;
use JSON::XS;
use Text::CSV_XS;
use Data::Printer;
my $csv = Text::CSV_XS->new({ binary => 1, sep => "\t" });
open my $code_fh, "<", $ARGV[0] or die $!;
#open my $codon_fh, "<", $ARGV[1] or die $!;
my %code_map = ();
while(my $row = $csv->getline($code_fh)) {
my ($code, $c) = @{ $row };
$code_map{$code} = $c;
}
$code_map{"---"} = "*";
$csv= Text::CSV_XS->new({ binary => 1, sep => " " });
my %data = ();
open my $codon_fh, "<", $ARGV[1] or die $!;
while(my $row = $csv->getline($codon_fh)) {
my ($code, $c1, $c2, $c3, $c4) = @{ $row };
next if $c4 > 0.15;
print join("\t", $code, $c1, $c4)."\n";
# if (my $c = $code_map{$code}) {
# $data{$c}{$c1} = $c4;
# }
}
#print JSON::XS->new->encode(\%data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment