Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make the example modencode faceted tracksel use the modencode data in…
… CSV format
- Loading branch information
Showing
3 changed files
with
1,892 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env perl | ||
use strict; | ||
use warnings; | ||
use autodie ':all'; | ||
use 5.10.0; | ||
|
||
use JSON 2; | ||
|
||
my $data = from_json( do { local $/; open my $f, '<', $ARGV[0]; scalar <$f> } ); | ||
|
||
my @fields = qw( technique factor target principal_investigator submission label category type Developmental-Stage organism key ); | ||
|
||
say join ',', map "\"$_\"", @fields; | ||
|
||
for my $item ( @{$data->{items}} ) { | ||
$item->{key} = $item->{label}; | ||
no warnings 'uninitialized'; | ||
for my $track ( @{$item->{Tracks}} ) { | ||
$item->{label} = $track; | ||
say join ',', map "\"$_\"", @{$item}{@fields}; | ||
} | ||
} |
Oops, something went wrong.