1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| use Bio::SeqIO;
use Bio::Seq::Quality;
my $file = 'file.fastq';
my $in = Bio::Seq::Quality->new(-file => $file , '-format' => 'fastq');
my %hash;
my $nb_seq++;
while ( my $seq = $in->next_seq() ){
$nb_seq++;
$hash{$seq->seq} = $seq->id ;
}
####parser le fichier des identifiants
open (DATA, "identifiant_file") || die("Impossible d'ouvrir le fichier: $! ");
my $nb=0;
my @tab;
while ( my $ligne = <DATA> ) {
chomp $ligne;
my ( $id, $mot) = split /\s+/, $ligne;
$nb++;
$tab[$nb][1]=$id;
}
##récupérer fastq
open(FILE, '>final.fastq') || die "pbe: $!";
foreach my $seq (keys %hash){
for(my $i=1; $i<= $nb; $i++){
if($hash{$seq} eq $tab[$i][1]){
print (FILE "$hash{$seq}\n$seq\n");
last;
}
}
}
close (FILE); |