how to calculate the uncover region

how to calculate the uncover region

am 13.09.2011 13:54:40 von Lemon

I have some segments start and end position on a reference sequence, I
want to calculate the uncoverage region for the reference;

for example: reference sequence length= 100,

name [start,end]
segment 1 [1,20]
segment 2 [2,28]
segment 3 [50,100]
segment 4 [5,38]

so uncover region = [38,49]


now I already have %pos{start}=end structure for those segment
position, could somebody give a good method?


--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: how to calculate the uncover region

am 13.09.2011 14:38:19 von Shlomi Fish

Hi Lemon,

On Tue, 13 Sep 2011 04:54:40 -0700 (PDT)
Lemon wrote:

> I have some segments start and end position on a reference sequence, I
> want to calculate the uncoverage region for the reference;
>=20
> for example: reference sequence length=3D 100,
>=20
> name [start,end]
> segment 1 [1,20]
> segment 2 [2,28]
> segment 3 [50,100]
> segment 4 [5,38]
>=20
> so uncover region =3D [38,49]
>=20
>=20
> now I already have %pos{start}=3Dend structure for those segment
> position, could somebody give a good method?
>=20

I suggest you merge overlapping segments into big meta-segments using a sor=
ted
array, one by one, and then see the uncovered regions between two adjacent
meta-segments.

Regards,

Shlomi Fish=20

--=20
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
Rethinking CPAN - http://shlom.in/rethinking-cpan

Khisanth =3D~ s/must sleep/must give Botje all my money/ .
â€=94 Freenodeâ€=99s #perl

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: how to calculate the uncover region

am 13.09.2011 16:55:19 von Peter Scott

On Tue, 13 Sep 2011 04:54:40 -0700, Lemon wrote:

> I have some segments start and end position on a reference sequence, I
> want to calculate the uncoverage region for the reference;
>=20
> for example: reference sequence length=3D 100,
>=20
> name [start,end]
> segment 1 [1,20]
> segment 2 [2,28]
> segment 3 [50,100]
> segment 4 [5,38]
>=20
> so uncover region =3D [38,49]
>=20
>=20
> now I already have %pos{start}=3Dend structure for those segment positi=
on,
> could somebody give a good method?

By the usual definition the uncovered region is [39,49]. Here's an=20
approach:

$ cat differ
#!/usr/local/bin/perl
use strict;
use warnings;

use Set::IntSpan; # http://search.cpan.org/perldoc?Set%3A%3AIntSpan

my ($diff, @sets) =3D map { Set::IntSpan->new( $_ ) }
qw(1-100 1-20 2-28 50-100 5-38);
$diff -=3D $_ for @sets;
print "$diff\n";

$ ./differ
39-49

--=20
Peter Scott
http://www.perlmedic.com/ http://www.perldebugged.com/
http://www.informit.com/store/product.aspx?isbn=3D0137001274
http://www.oreillyschool.com/certificates/perl-programming.p hp

--=20
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/