[Biojava-l] RichLocation.Tools.merge(Collection members) method
Mark Schreiber
markjschreiber at gmail.com
Wed Mar 5 02:20:52 UTC 2008
Just to follow up...
Has there been a fix checked in for this?
- Mark
On Mon, Mar 3, 2008 at 4:41 PM, Richard Holland <holland at ebi.ac.uk> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Arnaud - you are correct.
>
> cheers,
> Richard
>
>
>
> Arnaud Kerhornou wrote:
> > Hi everyone,
> >
> > I don't think the RichLocation.Tools.merge(Collection members) method is
> > doing it right.
> >
> > e.g. Input:
> > biojavax:join:[1157624..1158025,1158025..1158420,1158420..1158893]
> > Expected output:1157624..1158895
> >
> > But I get: join:[1157624..1158420,1158420..1158894]
> >
> > I think the code should have the extra line: parent = union;
> > just after c=p; statement line 18 (See source code below),
> > otherwise it doesn't take into account the newly generated location.
> >
> > Is that right ?
> >
> > Thanks
> > Arnaud
> >
> > Source code:
> >
> > 1 public static Collection merge(Collection members) {
> > 2 // flatten them out first so we don't end up recursing
> > 3 List membersList = new ArrayList(flatten(members));
> > 4 // all members are now singles so we can use single vs
> > single union operations
> > 5 if (membersList.size()>1) {
> > 6 for (int p = 0; p < (membersList.size()-1); p++) {
> > 7 RichLocation parent =
> > (RichLocation)membersList.get(p);
> > 8 for (int c = p+1; c < membersList.size(); c++) {
> > 9 RichLocation child =
> > (RichLocation)membersList.get(c);
> > 10 RichLocation union =
> > (RichLocation)parent.union(child);
> > 11 // if parent can merge with child
> > 12 if (union.isContiguous()) {
> > 13 // replace parent with union
> > 14 membersList.set(p,union);
> > 15 // remove child
> > 16 membersList.remove(c);
> > 17 // check all children again
> > 18 c=p;
> > 19 }
> > 20 }
> > 21 }
> > 22 }
> > 23 return membersList;
> > 24 }
> > _______________________________________________
> > Biojava-l mailing list - Biojava-l at lists.open-bio.org
> > http://lists.open-bio.org/mailman/listinfo/biojava-l
> >
>
> - --
> Richard Holland (BioMart)
> EMBL EBI, Wellcome Trust Genome Campus,
> Hinxton, Cambridgeshire CB10 1SD, UK
> Tel. +44 (0)1223 494416
>
> http://www.biomart.org/
> http://www.biojava.org/
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFHy7m04C5LeMEKA/QRAj05AJ9SBrv6yz8qvhwbmTrLZVfmwBuHTACgiq57
> +J0EpviSyp2Qq00m4A8xLUA=
> =re75
> -----END PGP SIGNATURE-----
>
>
> _______________________________________________
> Biojava-l mailing list - Biojava-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biojava-l
>
More information about the Biojava-l
mailing list