BufferOverflow error
Created by: Schmurf87
Hi, I have a code which is trying to retrieve each 2690 phase 3 samples.cram from 1000 genomes ftp to get their coverage (and analyse it before going to the next sample).
Here is the function which have the purpose to retrieve coverage for a given sample and chromosome:
sub loadingSampleCov {
my $chr = shift;
my $sample = shift;
my $sam = Bio::DB::HTS->new(-bam => 'ftp://ftp.1000genomes.ebi.ac.uk/vol1/'.$sample->adresse,
);
my $coverage = \$sam->get_features_by_location(-type=>'coverage',-seq_id=>$chr);
#return $coverage;
}
For example, the "$sample->adresse" could be equal to "ftp/data_collections/1000_genomes_project/data/CEU/NA12828/alignment/NA12828.alt_bwamem_GRCh38DH.20150718.CEU.low_coverage.cram".
The code I ran simply loop on each sample and call the above function, like that:
my $progress = Term::ProgressBar->new(scalar(@samples));
my $c = 0;
for my $sample(@samples){
$c++;
print "$c: sample ".$sample->id."\n";
loadingSampleCov($chr, $sample);
$progress->update($_);
print ".. Done ! \n";
}
Unfortunatly, when arrives the 339 sample, the script throws the following error.
I tried to remove the 339 sample (NA11840) from the list of sample but the script still throws the same error at the new 339 sample.
I ran this code on a 16GB computer, and the max ram (see the end of the error message, under the Maximum resident set size (kbytes) line) is 5.5GB, which is not limitant.
Maybe there is a way to empty the buffer after each sample, in order to avoid this error...
Thank you in advance for your help.