in reply to Load table with row/column names
ALTERNATE INTERPRETATION OF OP's DESIRES; namely, that cristianro87 wants to summarize ALL the data elements:
#!/usr/bin/perl use warnings; use strict; use 5.016; # 1087978 while (<DATA>) { my ($chrom, $pos, $id, $ref, $alt, $qual); if ($_ =~ /#CHROM.+/ ) { # title "Load table with row/co +lumn names" next; # does NOT match "access the el +ements" example } elsif ( $_ eq '' ) { last; } else { ($chrom, $pos, $id, $ref, $alt, $qual) = split; # desired out: [chr1][1092482][REF] = T say "[$chrom] [$pos] [REF] = " . $alt; } } =head execution C:\>1087978.pl [chr1] [1092344] [REF] = T [chr1] [1092367] [REF] = T [chr1] [1092400] [REF] = C [chr1] [1092424] [REF] = G [chr1] [1092461] [REF] = A [chr1] [1092470] [REF] = G [chr1] [1092482] [REF] = C [chr1] [1093235] [REF] = A [chr1] [1093245] [REF] = T =cut __DATA__ #CHROM POS ID REF ALT QUAL chr1 1092344 . G T 79.54 chr1 1092367 . C T 148.50 chr1 1092400 . G C 90.54 chr1 1092424 . A G 93.14 chr1 1092461 . G A 105.30 chr1 1092470 . T G 103.06 chr1 1092482 . T C 104.33 chr1 1093235 . G A 16.08 chr1 1093245 . C T 244.75
Far simpler: no hashes but possibly (caveat here ->) a simple-minded interp of an unclear SOPW.
|
|---|