[Bioc-devel] Python Z trees to hclust

Bernat Gel Moreno bge| @end|ng |rom |gtp@c@t
Thu Nov 14 11:25:22 CET 2019

Hi Peter,

Thanks for the advice and pointers to the relevant files. After reading 
the Fortran code and thinking about it I ended up coding from scratch my 
own pure R function to set the plotting order of an hclust object. It 
might not be as fast as the Fortran implementation, but it works pretty 
well and as far as I can tell the resulting order is exactly the same to 
the original hclust code. If anyone is interested it's available at the 
CopyNumberPlots package at 


El 8/3/19 a las 8:41 PM, Peter Langfelder escribió:
> Hi Bernat,
> my advice may not be that useful, but it may be better than the
> silence so far...
> Regarding the ordering of objects in hclust, if you're willing to do a
> bit of hacking, have a look at the stats::hclust function; you will
> see that the ordering is computed by a call to Fortran function
> hcass2. That function could be used or perhaps adapted (it uses an
> additional step that you will probably need to skip) to give you the
> ordering. If you're good at understanding Fortran code, you may even
> be able to re-write it directly in R.
> Peter
> On Tue, Jul 30, 2019 at 12:39 AM Bernat Gel Moreno <bgel using igtp.cat> wrote:
>> Hi,
>> For one of our packages (CopyNumberPlots) we'll need to read 10X CNV
>> data in H5 format. I've read in everything I need except for the cell
>> clustering tree. It's in a format called Z format produced by SciPy
>> hierarchical clustering. The format itself is relatively easy to parse
>> and not so different from hclust return objects so it would be possible
>> to create a small function to translate the Z notation into an hclust
>> object, if needed, but I'll need to figure out the "order" vector, since
>> it's not present in Z.
>>     - Is the Z to hclust function available in any other package? Or
>> something equivalent to that?
>>     - If I end up transforming it by hand in a custom function, Is there
>> a function somewhere to compute the order vector in an hclust object?
>> Thanks
>> Bernat
>> _______________________________________________
>> Bioc-devel using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/bioc-devel

More information about the Bioc-devel mailing list