Bonjour à tous,
J'ai écris le code ci dessous de façon à parcourir un fichier fait comme ceci :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
chromosome	strand	read_start	read_end	genome_reference_type	barcode	read_sequence
chr2L	+	5123	5152	g	AACC	TTATGCGCGAGTAGTGCCAACATATTGTGA
chr2L	+	5506	5519	g	ATCC	ATAATGACTGCCTT
chr2L	+	5506	5522	g	CTCA	ATAATGACTGCCTTTCA
chr2L	+	5552	5579	g	GAGT	AATGACAATGCACGACATAGAGAGAAAG
chr2L	+	5552	5579	g	GAGT	AATGACAATGCACGACATAGAGAGAAAG
chr2L	+	5552	5579	g	GAGT	AATGACAATGCACGACATAGAGAGAAAG
chr2L	+	5552	5579	g	GAGT	AAGGACAAAGCACGACATAGAGAGAAAG
et de me donner la sequence qui se retrouve le plus grand nombre de fois pour chaque (chr,start,stop,sens,barcode).

Donc pour l'exemple ci dessus :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
chr2L	+	5123	5152	g	AACC	TTATGCGCGAGTAGTGCCAACATATTGTGA
chr2L	+	5506	5519	g	ATCC	ATAATGACTGCCTT
chr2L	+	5506	5522	g	CTCA	ATAATGACTGCCTTTCA
chr2L	+	5552	5579	g	GAGT	AATGACAATGCACGACATAGAGAGAAAG
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
#!/usr/bin/perl
use strict;
use warnings;
use Carp qw(confess);
use Getopt::Long;
 
my $AF_class;
my $AF_out;
my %hash;
 
GetOptions("file=s" => \$AF_class);
#, "out=s" => \$AF_out
 
 
open(my $fh,'<',$AF_class) or die "$AF_class : $!\n\n";
#open(my $fh_out,'>',$AF_out) or die "$AF_out : $!\n\n";
 
while (<$fh>){
	chomp;
	if ($_ =~ m/^chr\d/ || $_ =~ m/^chrX/ || $_ =~ m/^chrY/ || $_ =~ m/^chrU/  ){
		my($chr,$strand,$start,$stop,$gt,$barcode,$sequence)= split /\t/,$_;
		if ($gt eq 'g'){
			$hash{join(';',$chr,$start,$stop,$strand,$barcode)}{$sequence}++;
		}		
	}
}
 
foreach my $v (sort keys(%hash)){
	foreach my $seq (keys %{$hash{$v}}){
		foreach my $nb (keys %{$hash{$v}{$seq}}){
			print "$v\t$seq\t$nb\n";
		}
	}
 
}
close($fh);
Mais j'obtiens l'erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
Can't use string ("1") as a HASH ref while "strict refs" in use at Sread.pl line 30, <$fh> line 4449753.
Quelqu'un peut m'aider ?