Attention une mise à jour du serveur va être effectuée le lundi 17 mai entre 13h et 13h30. Cette mise à jour va générer une interruption du service de quelques minutes.


parent 2c80a925
package Genomes;
###### AUTHOR
# Copyright 2019 Pierre-Antoine (Rollat-)Farnier (
###### LICENCE
## This program is a free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program.
# If not, see <>
use strict;
use warnings FATAL => "all";
use List::Util qw(min max);
# Will contain all chromosome information
our %authorized_chromosomes;
our @ordered_chromosomes;
sub configureReference {
print "## Configuration of the reference contigs ##\n";
my ($option_hash) = @_;
my $genome_fasta_index = $$option_hash{"files"}{"reference_contigs"}.".fai";
my $format = "genome fasta index"; # Only for error messages
if (-e $genome_fasta_index) {
print "- Index file : ".$genome_fasta_index."\n";
open(my $genome_fai_fh, "<", $genome_fasta_index) or die(Errors::formatFileOpeningError($format, $genome_fasta_index));
my $chromosome_order = 0;
foreach my $line (<$genome_fai_fh>) {
my @elements = Files::megaSplit($line);
if(!(defined($elements[0])) || !(defined($elements[1]))) {
die(Errors::badlyFormattedFile($genome_fasta_index, $format));
my $chromosome = $elements[0];
push @ordered_chromosomes, $chromosome;
$authorized_chromosomes{$chromosome}{"length"} = $elements[1];
$authorized_chromosomes{$chromosome}{"order"} = $chromosome_order;
} else {
die(Errors::inexistentFormatFile($genome_fasta_index, $format));
print "\n";
sub dieIfNonexistentChromosome {
my ($chromosome) = @_;
die Errors::unknownChromosome($chromosome);
sub getGenomicContext {
my ($genome, $chromosome, $start, $end) = @_;
my $context = `samtools faidx $genome $chromosome:$start-$end`;
sub prepareGenomicContextGetting {
my ($chromosome, $start, $end, $genome, $distance_5p, $distance_3p) = @_;
# Start determination - Cannot be inferior to 0
$start = max(0, $start - $distance_5p);
# End determination - Cannot be superior to chromosome length
$end = min($end,$Genomes::authorized_chromosomes{$chromosome}{"length"});
my $context = getGenomicContext($genome, $chromosome, $start, $end);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment