jeudi 2 avril 2015

How to randomly pair items in a list

I have a list of Accession numbers that i want to pair randomly using a Perl script below and i keep getting errors.HELP!!


!/usr/bin/perl -w


use List::Util qw(shuffle);


my $file = 'randomseq_acc.txt';


my @identifiers = map { (split /\n/)[1] } ;


chomp @identifiers;


Shuffle them and put in a hash


@identifiers = shuffle @identifiers;


my %pairs = (@identifiers);


print the pairs


for (keys %pairs) { print "$_ and $pairs{$_} are partners\n";


The accession numbers in the file randomseq_acc.txt are: 1094711 1586007 2XFX_C Q27031.2 P22497.2 Q9TVU5.1 Q4N4N8.1 P28547.2 P15711.1 AAC46910.1 AAA98602.1 AAA98601.1 AAA98600.1 EAN33235.2 EAN34465.1 EAN34464.1 EAN34463.1 EAN34462.1 EAN34461.1 EAN34460.1





Aucun commentaire:

Enregistrer un commentaire