array @lines
is the key to this type of % hash
Hg 00117 HG00119 NA 20828
And so on for many other samples I have shown just three below for example.
Use strict; Use warnings; Use Data: Dump; Open (FILE, 'input.txt'); Chomp (my @ lines = (& lt; FILE & gt;)); Close (file); My% hash; $ Hash {$ _} = [Globe ("$ _ * .bum")] for @ lines; DD% hash;
This will let me print arrays of my green:
( "Hg 00117", [ "Hg 00ll7kmapkliminaa.biwakjibiar .exmember20120522 .bam_herc2_data.bam "," Hg200117.mpa.limeena.bew.GBR.Lovakawara201201123.bm_herc2_fase 1.bm "," hg00117.map.limeena.bewa.gb.law_cartage20120522.bm_hercr2_data. Bam "," Hg 00ll7kmap KilluminakmosaikkGBRkexomek20ll04llkbam_herc2_phaselkbam "]," HG00ll9 "[" HG00ll9kmappedkILLUMINAkbwakGBRkexomek20l20522kbam_herc2_datakbam " "Hg00ll9kmapdkillumina. Bvkgbrklo_kvrejk20l0ll23kbm_herk2_fselkbm", "Hg00ll9kmapdkilliminakbvkgbrklo_kvr ge.20120522.bam_herc2_data.bam "," Hg 00ll9kmapkiluminakmosaikkjibiar.aksdomber Kl04llkbam_herkr 2_fej 1. bam ",]," NA20828 ", [" NA20828.mapped.ILLUMINA.bwa.TSI. Aksomek20l2l2llkbm_herk2_detakbm "," N20828kmapdkilluminakbvktsiklo_kvrejk20l0ll23kbm_herk2_fselkbm "," N20828kmapdkilluminakbvktsiklo_kvrejk20l304l5kbm_herk2_detakbm "," NA20828.mapped.illumina.mosaik.TSI.exome.20110411.bam_herc2_phase1.bam ",],)
I want each element prefix arrays with input =
, so they look like this
( "HG00117", [ "input = HG00117.mapped.ILLUMINA.bwa.GBR.exome.20120522.bam_herc2_data.bam" "input = Hg 00,117 .map.limeena.bv.g Br.law_carge20101123.bm_herka2_fage 1.bm "," INPUT = HG00117.map.limeen.e.b.va.GBR.love_cartage20120522.bm_hercr2_data.bm "," INPUT = HG00117.map.lumina mosaik.GBR.exome.20110411. bam_herc2_phase1.bam ",]," HG00119 ", [" input = HG00119.mapped.ILLUMINA.bwa.GBR.exome.20120522.bam_herc2_data.bam "" input = HG00119.mapped.ILLUMINA .bwa.GBR.low_coverage.20101123. bam_herc2_phase1.bam "" input = HG00119.mapped.ILLUMINA.bwa.GBR.low_coverage.20120522.bam_herc2_data.bam "" input = HG00119.mapped.illumina.mosaik.GBR.exome .20110411.bam_herc2_phase1.bam ",]," N20828 ", [" input = N20828kmapdkilluminakbvktsi.aksmek20l2l2 Llkbm_herk2_detakbm "," input = N20828kmapdkilliminakbvktsiklo_kvrejk20l0ll23kbm_herk2_fselkbm "," INPUT = NA20828.mapped.il Liminakbvktsiklo_kvrejk20l304l5kbm_herk2_detakbm "," Input = N20828kmapdkilluminakmosakktsi.aksomek20ll04llkbm_herk2_fselkbm "]
I tried regex and grep
but anything seems to work, I feel that I'm confused with the scope of foreach
I also change the name of Tried the
function, but it does not work.
Therefore, repeating each element - you really need two ends for the 'top level' One - hash value (which are array references)
Then with each array reference, repeat between people who make a transformational application.
foreach my $ array_ref (value% hash) {foreach my $ oldfilename (@ $ array_ref) {$ element = ~ s / ^ / INPUT = /; }}
Or do you really want to change the filenames to disk ? If so, you can use it (I do not think that this is what you want)
foreach my $ array_ref (values% hash) {foreach my $ oldfilename (@ $ Array_ref) {rename $ old Eiffel, 'INPUT =' $ Oldfilename}}
No comments:
Post a Comment