Skip to content

Commit 200fe3c

Browse files
committed
Addidng parallel clustering to the density module
1 parent b9d4835 commit 200fe3c

File tree

6 files changed

+69
-13
lines changed

6 files changed

+69
-13
lines changed

HotSpot3D-1.5.0.tar.gz

8.39 MB
Binary file not shown.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Usage
1010

1111
Stable: v0.6.0
1212

13-
Beta: up to v1.4.1
13+
Beta: up to v1.5.0
1414
1515
Author: Beifang Niu, John Wallis, Adam D Scott, Sohini Sengupta, & Amila Weerasinghe
1616

bin/hotspot3d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use strict;
99
use warnings;
1010

11-
our $VERSION = 'V1.4.1';
11+
our $VERSION = 'V1.5.0';
1212

1313
use Carp;
1414
use FileHandle;

dist.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = HotSpot3D
22
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
3-
version = 1.4.1
3+
version = 1.5.0
44
license = Perl_5
55
copyright_holder = McDonnell Genome Institute at Washington University
66
copyright_year = 2017

lib/TGI/Mutpro/Main/Cluster.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,6 +1459,8 @@ Usage: hotspot3d cluster [options]
14591459
--weight-header .maf file column header for mutation weight, default: weight (used if vertex-type = weight)
14601460
--parallel Parallelization for structure and subunit dependent runs (none or local), default: none
14611461
--max-processes Set if using parallel type local (CAUTION: make sure you know your max CPU processes)
1462+
--gene-list-file Choose mutations from the genes given in this list
1463+
--structure-list-file Choose mutations from the structures given in this list
14621464
14631465
--help this message
14641466

lib/TGI/Mutpro/Main/Density.pm

Lines changed: 64 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ my $SHORTESTDISTANCE = "shortest";
2929
my $AVERAGEDISTANCE = "average";
3030
my $INDEPENDENT = "independent";
3131
my $DEPENDENT = "dependent";
32+
my $LOCAL = "local";
33+
my $NONE = "none";
3234

3335
sub new {
3436
my $class = shift;
@@ -86,13 +88,45 @@ sub process {
8688

8789
#####################################################
8890

89-
my $pairwiseFN = "$this->{'distance_measure'}.$this->{pairwise_file_name_only}";
90-
9191
# print "distance matrix\n";
9292
# print Dumper $distance_matrix;
9393
# print "mutations\n";
9494
# print Dumper $mutations;
9595

96+
$this->densityClustering( $mutations, $distance_matrix );
97+
98+
my $numStructure = scalar keys %{ $distance_matrix };
99+
print "Density-based clusters are being calculated for $numStructure structures.\n\n";
100+
101+
}
102+
103+
#####
104+
# Functions
105+
#####
106+
107+
sub densityClustering {
108+
my ( $this, $mutations, $distance_matrix ) = @_;
109+
110+
print STDOUT "HotSpot3D::Cluster::Density::densityClustering\n";
111+
112+
if ( $this->{'parallel'} eq $LOCAL ) {
113+
$this->localParallelDensityClustering( $mutations , $distance_matrix );
114+
#} elsif ( $this->{'parallel'} eq $BSUB ) {
115+
# $this->bsubParallelNetworkClustering( $clusterings , $mutations , $distance_matrix );
116+
} else {
117+
$this->noParallelDensityClustering( $mutations , $distance_matrix );
118+
}
119+
return;
120+
}
121+
122+
sub localParallelDensityClustering {
123+
my ( $this , $mutations , $distance_matrix ) = @_;
124+
125+
my $pairwiseFN = "$this->{'distance_measure'}.$this->{pairwise_file_name_only}";
126+
print STDOUT "\tParallel clustering over structures with up to ".$this->{'max_processes'}." processes\n";
127+
my $pm = Parallel::ForkManager->new( $this->{'max_processes'} );
128+
129+
DATA_LOOP:
96130
foreach my $structure ( keys %{$distance_matrix} ) { # run the density calculation for each available structure
97131
#print "Structure= $structure\n";
98132
# name output files as *.$pdbID.structure.*
@@ -105,21 +139,41 @@ sub process {
105139
$this->MainOPTICS( $structure , $distance_matrix, $mutations ); # perform OPTICS for the first time
106140
$this->RunSuperClustersID(); # perform Clustering for the reference run
107141

108-
print "Reference run: Done.\nStart probability calculation\n";
142+
print "Reference run: Done.\nStart probability calculation for $structure\n";
109143

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

112-
print "\nProbability Calculation is Done.\n\n";
146+
print "\nProbability Calculation is Done for $structure.\n\n";
113147
}
148+
$pm->wait_all_children;
114149

115-
my $numStructure = scalar keys %{ $distance_matrix };
116-
print "Density-based clusters are being calculated for $numStructure structures.\n\n";
117-
150+
return;
118151
}
119152

120-
#####
121-
# Functions
122-
#####
153+
sub noParallelDensityClustering {
154+
my ( $this , $mutations , $distance_matrix ) = @_;
155+
print "Serially clustering over structures\n";
156+
157+
my $pairwiseFN = "$this->{'distance_measure'}.$this->{pairwise_file_name_only}";
158+
foreach my $structure ( keys %{$distance_matrix} ) { # run the density calculation for each available structure
159+
#print "Structure= $structure\n";
160+
# name output files as *.$pdbID.structure.*
161+
$this->{pairwise_file_name_only} = "$structure.Structure.$pairwiseFN";
162+
163+
# call the SetOfNodes hash for each structure
164+
$this->{"CurrentSetOfNodes"} = $distance_matrix->{$structure};
165+
166+
###### Reference run: start
167+
$this->MainOPTICS( $structure , $distance_matrix, $mutations ); # perform OPTICS for the first time
168+
$this->RunSuperClustersID(); # perform Clustering for the reference run
169+
170+
print "Reference run: Done.\nStart probability calculation for $structure\n";
171+
172+
$this->getClusterProbabilities( $structure , $distance_matrix, $mutations ); # perform cluster-membership probability calculation
173+
174+
print "\nProbability Calculation is Done for $structure.\n\n";
175+
}
176+
}
123177

124178
sub MainOPTICS {
125179
my $this = shift;

0 commit comments

Comments
 (0)