Skip to content

Commit

Permalink
Addidng parallel clustering to the density module
Browse files Browse the repository at this point in the history
  • Loading branch information
amilacsw committed Mar 7, 2017
1 parent b9d4835 commit 200fe3c
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 13 deletions.
Binary file added HotSpot3D-1.5.0.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Usage

Stable: v0.6.0

Beta: up to v1.4.1
Beta: up to v1.5.0
Author: Beifang Niu, John Wallis, Adam D Scott, Sohini Sengupta, & Amila Weerasinghe

Expand Down
2 changes: 1 addition & 1 deletion bin/hotspot3d
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use strict;
use warnings;

our $VERSION = 'V1.4.1';
our $VERSION = 'V1.5.0';

use Carp;
use FileHandle;
Expand Down
2 changes: 1 addition & 1 deletion dist.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = HotSpot3D
author = Beifang Niu, John Wallis, Adam D Scott, Sohini Sengupta, Amila Weerasinghe, & Matthew H Bailey from McDonnell Genome Institute of Washington University at St. Louis
version = 1.4.1
version = 1.5.0
license = Perl_5
copyright_holder = McDonnell Genome Institute at Washington University
copyright_year = 2017
Expand Down
2 changes: 2 additions & 0 deletions lib/TGI/Mutpro/Main/Cluster.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1459,6 +1459,8 @@ Usage: hotspot3d cluster [options]
--weight-header .maf file column header for mutation weight, default: weight (used if vertex-type = weight)
--parallel Parallelization for structure and subunit dependent runs (none or local), default: none
--max-processes Set if using parallel type local (CAUTION: make sure you know your max CPU processes)
--gene-list-file Choose mutations from the genes given in this list
--structure-list-file Choose mutations from the structures given in this list
--help this message
Expand Down
74 changes: 64 additions & 10 deletions lib/TGI/Mutpro/Main/Density.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ my $SHORTESTDISTANCE = "shortest";
my $AVERAGEDISTANCE = "average";
my $INDEPENDENT = "independent";
my $DEPENDENT = "dependent";
my $LOCAL = "local";
my $NONE = "none";

sub new {
my $class = shift;
Expand Down Expand Up @@ -86,13 +88,45 @@ sub process {

#####################################################

my $pairwiseFN = "$this->{'distance_measure'}.$this->{pairwise_file_name_only}";

# print "distance matrix\n";
# print Dumper $distance_matrix;
# print "mutations\n";
# print Dumper $mutations;

$this->densityClustering( $mutations, $distance_matrix );

my $numStructure = scalar keys %{ $distance_matrix };
print "Density-based clusters are being calculated for $numStructure structures.\n\n";

}

#####
# Functions
#####

sub densityClustering {
my ( $this, $mutations, $distance_matrix ) = @_;

print STDOUT "HotSpot3D::Cluster::Density::densityClustering\n";

if ( $this->{'parallel'} eq $LOCAL ) {
$this->localParallelDensityClustering( $mutations , $distance_matrix );
#} elsif ( $this->{'parallel'} eq $BSUB ) {
# $this->bsubParallelNetworkClustering( $clusterings , $mutations , $distance_matrix );
} else {
$this->noParallelDensityClustering( $mutations , $distance_matrix );
}
return;
}

sub localParallelDensityClustering {
my ( $this , $mutations , $distance_matrix ) = @_;

my $pairwiseFN = "$this->{'distance_measure'}.$this->{pairwise_file_name_only}";
print STDOUT "\tParallel clustering over structures with up to ".$this->{'max_processes'}." processes\n";
my $pm = Parallel::ForkManager->new( $this->{'max_processes'} );

DATA_LOOP:
foreach my $structure ( keys %{$distance_matrix} ) { # run the density calculation for each available structure
#print "Structure= $structure\n";
# name output files as *.$pdbID.structure.*
Expand All @@ -105,21 +139,41 @@ sub process {
$this->MainOPTICS( $structure , $distance_matrix, $mutations ); # perform OPTICS for the first time
$this->RunSuperClustersID(); # perform Clustering for the reference run

print "Reference run: Done.\nStart probability calculation\n";
print "Reference run: Done.\nStart probability calculation for $structure\n";

$this->getClusterProbabilities( $structure , $distance_matrix, $mutations ); # perform cluster-membership probability calculation

print "\nProbability Calculation is Done.\n\n";
print "\nProbability Calculation is Done for $structure.\n\n";
}
$pm->wait_all_children;

my $numStructure = scalar keys %{ $distance_matrix };
print "Density-based clusters are being calculated for $numStructure structures.\n\n";

return;
}

#####
# Functions
#####
sub noParallelDensityClustering {
my ( $this , $mutations , $distance_matrix ) = @_;
print "Serially clustering over structures\n";

my $pairwiseFN = "$this->{'distance_measure'}.$this->{pairwise_file_name_only}";
foreach my $structure ( keys %{$distance_matrix} ) { # run the density calculation for each available structure
#print "Structure= $structure\n";
# name output files as *.$pdbID.structure.*
$this->{pairwise_file_name_only} = "$structure.Structure.$pairwiseFN";

# call the SetOfNodes hash for each structure
$this->{"CurrentSetOfNodes"} = $distance_matrix->{$structure};

###### Reference run: start
$this->MainOPTICS( $structure , $distance_matrix, $mutations ); # perform OPTICS for the first time
$this->RunSuperClustersID(); # perform Clustering for the reference run

print "Reference run: Done.\nStart probability calculation for $structure\n";

$this->getClusterProbabilities( $structure , $distance_matrix, $mutations ); # perform cluster-membership probability calculation

print "\nProbability Calculation is Done for $structure.\n\n";
}
}

sub MainOPTICS {
my $this = shift;
Expand Down

0 comments on commit 200fe3c

Please sign in to comment.