Skip to content
Snippets Groups Projects
Commit 5809543b authored by Steve Trevanion's avatar Steve Trevanion
Browse files

get duplicates if requested, chr Y hack

parent dca80434
No related branches found
No related tags found
No related merge requests found
...@@ -1122,6 +1122,9 @@ sub _by_chr_num { ...@@ -1122,6 +1122,9 @@ sub _by_chr_num {
Arg[1] : (optional) Int $cutoff - the cutoff in bp between small and Arg[1] : (optional) Int $cutoff - the cutoff in bp between small and
large chromosomes large chromosomes
Arg[2] : (optional) Boolean to include duplicate regions, ie PAR or not
(default is no)
Example : my $chr_slices = $support->split_chromosomes_by_size; Example : my $chr_slices = $support->split_chromosomes_by_size;
foreach my $block_size (keys %{ $chr_slices }) { foreach my $block_size (keys %{ $chr_slices }) {
print "Chromosomes with blocksize $block_size: "; print "Chromosomes with blocksize $block_size: ";
...@@ -1144,40 +1147,40 @@ sub _by_chr_num { ...@@ -1144,40 +1147,40 @@ sub _by_chr_num {
=cut =cut
sub split_chromosomes_by_size { sub split_chromosomes_by_size {
my $self = shift; my $self = shift;
my $cutoff = shift || 5000000; my $cutoff = shift || 5000000;
my $dup = shift || 0;
my $slice_adaptor = $self->dba->get_SliceAdaptor; my $slice_adaptor = $self->dba->get_SliceAdaptor;
my $top_slices; my $top_slices;
if ($self->param('chromosomes')) { if ($self->param('chromosomes')) {
foreach my $chr ($self->param('chromosomes')) { foreach my $chr ($self->param('chromosomes')) {
push @{ $top_slices }, $slice_adaptor->fetch_by_region('chromosome', $chr); push @{ $top_slices }, $slice_adaptor->fetch_by_region('chromosome', $chr);
}
} else {
$top_slices = $slice_adaptor->fetch_all('chromosome');
} }
} else {
$top_slices = $slice_adaptor->fetch_all('chromosome',undef,0,$dup);
}
my ($big_chr, $small_chr, $min_big_chr, $min_small_chr); my ($big_chr, $small_chr, $min_big_chr, $min_small_chr);
foreach my $slice (@{ $top_slices }) { foreach my $slice (@{ $top_slices }) {
if ($slice->length < $cutoff) { next if ($slice->length eq 10000); #hack for chrY pseudoslice
if (! $min_small_chr or ($min_small_chr > $slice->length)) { if ($slice->length < $cutoff) {
$min_small_chr = $slice->length; if (! $min_small_chr or ($min_small_chr > $slice->length)) {
} $min_small_chr = $slice->length;
# push small chromosomes onto $small_chr }
push @{ $small_chr }, $slice; # push small chromosomes onto $small_chr
} push @{ $small_chr }, $slice;
if (! $min_big_chr or ($min_big_chr > $slice->length) && $slice->length > $cutoff) {
$min_big_chr = $slice->length;
}
# push _all_ chromosomes onto $big_chr
push @{ $big_chr }, $slice;
} }
if (! $min_big_chr or ($min_big_chr > $slice->length) && $slice->length > $cutoff) {
$min_big_chr = $slice->length;
}
# push _all_ chromosomes onto $big_chr
push @{ $big_chr }, $slice;
}
my $chr_slices;
$chr_slices->{int($min_big_chr/150)} = $big_chr if $min_big_chr;
$chr_slices->{int($min_small_chr/150)} = $small_chr if $min_small_chr;
my $chr_slices; return $chr_slices;
$chr_slices->{int($min_big_chr/150)} = $big_chr if $min_big_chr;
$chr_slices->{int($min_small_chr/150)} = $small_chr if $min_small_chr;
return $chr_slices;
} }
=head2 log =head2 log
......
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