Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ensembl-gh-mirror
ensembl
Commits
5809543b
Commit
5809543b
authored
Aug 03, 2009
by
Steve Trevanion
Browse files
get duplicates if requested, chr Y hack
parent
dca80434
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
30 deletions
+33
-30
modules/Bio/EnsEMBL/Utils/ConversionSupport.pm
modules/Bio/EnsEMBL/Utils/ConversionSupport.pm
+33
-30
No files found.
modules/Bio/EnsEMBL/Utils/ConversionSupport.pm
View file @
5809543b
...
...
@@ -1122,6 +1122,9 @@ sub _by_chr_num {
Arg[1] : (optional) Int $cutoff - the cutoff in bp between small and
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;
foreach my $block_size (keys %{ $chr_slices }) {
print "Chromosomes with blocksize $block_size: ";
...
...
@@ -1144,40 +1147,40 @@ sub _by_chr_num {
=cut
sub
split_chromosomes_by_size
{
my
$self
=
shift
;
my
$cutoff
=
shift
||
5000000
;
my
$slice_adaptor
=
$self
->
dba
->
get_SliceAdaptor
;
my
$top_slices
;
if
(
$self
->
param
('
chromosomes
'))
{
foreach
my
$chr
(
$self
->
param
('
chromosomes
'))
{
push
@
{
$top_slices
},
$slice_adaptor
->
fetch_by_region
('
chromosome
',
$chr
);
}
}
else
{
$top_slices
=
$slice_adaptor
->
fetch_all
('
chromosome
');
my
$self
=
shift
;
my
$cutoff
=
shift
||
5000000
;
my
$dup
=
shift
||
0
;
my
$slice_adaptor
=
$self
->
dba
->
get_SliceAdaptor
;
my
$top_slices
;
if
(
$self
->
param
('
chromosomes
'))
{
foreach
my
$chr
(
$self
->
param
('
chromosomes
'))
{
push
@
{
$top_slices
},
$slice_adaptor
->
fetch_by_region
('
chromosome
',
$chr
);
}
}
else
{
$top_slices
=
$slice_adaptor
->
fetch_all
('
chromosome
',
undef
,
0
,
$dup
);
}
my
(
$big_chr
,
$small_chr
,
$min_big_chr
,
$min_small_chr
);
foreach
my
$slice
(
@
{
$top_slices
})
{
if
(
$slice
->
length
<
$cutoff
)
{
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
;
}
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
(
$big_chr
,
$small_chr
,
$min_big_chr
,
$min_small_chr
);
foreach
my
$slice
(
@
{
$top_slices
})
{
next
if
(
$slice
->
length
eq
10000
);
#hack for chrY pseudoslice
if
(
$slice
->
length
<
$cutoff
)
{
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
;
}
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
;
$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
;
return
$chr_slices
;
}
=head2 log
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment