[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Packaging r-bioc-simpleaffy



On Tue, Feb 22, 2011 at 10:34:41PM +0000, Tony Travis wrote:
> If you want me to name some important Bioconductor packages I use
> then I suggest "simpleaffy" and its dependencies:
> 
>   http://bioconductor.org/packages/2.6/bioc/html/simpleaffy.html

Out of curiosity, I hacked a script (quick and dirty) that gathers
dependancy information from the Packages file of Steffen's cran2deb
repository[1] and draws a dependency graph that can be processed
with dot. An example output is attached.[2] It also gives some stats
on stderr about how many packages depend on a package. Dunno whether
or not this is useful, though.

Dashed entries are BioConductor packages, solid ones are from CRAN.
>From the later, only r-cran-rsqlite is not yet in Debian. In order
to package r-bioc-simpleaffy, one CRAN package and 11 BioConductor
packages need to be packaged. One could start from the source
packages created by cran2deb. I'm not a user of BioConductor myself
but if there are a few people willing to work on that, I'd volunteer
to help with reviews and uploads. The packages should be beginner
friendly, so maybe someone would like to pick those up?!

Best regards,
Manuel

[1] http://master.dermacloud.uni-luebeck.de/cran2deb/rep/dists/testing/main/binary-amd64/Packages
[2] Created by calling: perl bioc-depends.pl r-bioc-simpleaffy | dot -Tpdf -or-bioc-simpleaffy.pdf
#!/usr/bin/perl

use strict;
use warnings;

use List::MoreUtils qw(uniq);

my $package = shift @ARGV or die "Missing package";

my @nodes;
my @edges;

&find_deps($package, \@nodes, \@edges);

@nodes = sort uniq @nodes;
@edges = sort uniq @edges;

&print_dot(\@nodes, \@edges);
&print_stats(\@edges);



### SUBROUTINES ###

sub find_deps
{
    my $p = shift;
    my $nodes = shift;
    my $edges = shift;

    my $deps = `grep-dctrl -w -P '$p' -sDepends Packages`;

    push @$nodes, $p;

    chomp $deps;

    $deps =~ s/^Depends: //;

    # Consider alternatives as seperate dependencies
    $deps =~ s/ ?\|/,/g;

    # Kill versions
    $deps =~ s/\(.+\)//g;

    foreach my $d (split ', ', $deps)
    {
	if ($d =~ /^r-(cran|bioc)/)
	{
	    # This filters everything that is not from CRAN or
	    # Bioconductor. To get all depedencies, move the next
	    # line to the outer loop.
	    push @$edges, "\"$p\" -> \"$d\";\n";

	    unless (grep($_ eq $d, @$nodes)) {
		&find_deps($d, $nodes, $edges);
	    }
	}
    }
}

sub print_stats
{
    my $edges = shift;
    my %numdep;

    foreach my $e (@$edges) {
	$e = $1 if $e =~ /-> "(.+)"/;
	$numdep{$e}++;
    }

    foreach my $n (reverse sort { $numdep{$a} <=> $numdep{$b} } keys %numdep) {
	print STDERR "$numdep{$n} $n\n";
    }
}

sub print_dot
{
    my $nodes = shift;
    my $edges = shift;

    print "digraph biocdep {\n";
    foreach my $n (@$nodes) {
	printf "\"%s\" [style=%s];\n", $n, ($n =~ /^r-bioc-/) ? 'dashed' : 'solid';
    }
    foreach (@$edges) { print; }
    print "}\n";
}

Attachment: r-bioc-simpleaffy.pdf
Description: Adobe PDF document


Reply to: