Skip to content
Snippets Groups Projects
Commit 6e84e5a2 authored by Marek Szuba's avatar Marek Szuba
Browse files

RGDParser: switch from getline_hr() to getline()+bind_columns()

getline_hr() creates a new hashref for every row so even Text::CSV
authors themselves recommend using a combination of bind_columns() with
getline() instead.
parent 74a69505
No related branches found
No related tags found
1 merge request!445Merge the output of the 2018 xref sprint
......@@ -87,7 +87,7 @@ sub run {
$line = $rgd_io->getline;
}
$csv->parse($line);
$csv->column_names( $csv->fields );
my @column_names = $csv->fields();
# Columns we want
# GENE_RGD_ID => 0,
# SYMBOL => 1,
......@@ -100,8 +100,11 @@ sub run {
my $ensembl_count = 0;
my $mismatch = 0;
my $syn_count = 0;
my $cols; # Digested columns from CSV
while ( $cols = $csv->getline_hr($rgd_io) ) {
my $cols = {}; # Digested columns from CSV
$csv->bind_columns( \@{$cols}{@column_names} );
while ( $csv->getline($rgd_io) ) {
next
if exists $cols->{GENE_RGD_ID} &&
( $cols->{GENE_RGD_ID} eq q{} || !defined $cols->{GENE_RGD_ID} );
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment