Skip to content

Commit

Permalink
Merge branch 'develop' version 1.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
iimog committed Mar 3, 2017
2 parents 7335706 + 04ce627 commit ceab4df
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 10 deletions.
2 changes: 2 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ The font is from [[fontlibrary.org]]:
- [[https://fontlibrary.org/en/font/ranchers][Ranchers]] ([[http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL][SIL Open Font License]])
** Changes
[[https://travis-ci.org/molbiodiv/bcgTree][https://travis-ci.org/molbiodiv/bcgTree.svg?branch=master]]
*** v1.0.9 <2017-03-03 Fr>
- Add parameters --min-proteomes and --all-proteomes (#21)
*** v1.0.8 <2016-09-07 Mi>
- Set default bootstraps to 100
- Add description for reproduction of results in paper
Expand Down
Binary file modified bcgTreeGUI/bcgTree.jar
Binary file not shown.
24 changes: 22 additions & 2 deletions bcgTreeGUI/src/bcgTree/gui/BcgTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
Expand All @@ -44,7 +45,7 @@

public class BcgTree extends JFrame {
private static final long serialVersionUID = 1L;
public static final String VERSION = "1.0.8";
public static final String VERSION = "1.0.9";
private static final int DEFAULT_TEXTFIELD_COLUMNS = 30;

public static void main(String[] args) {
Expand Down Expand Up @@ -74,6 +75,8 @@ public static void main(String[] args) {
private JTextField randomSeedXTextField;
private JTextField randomSeedPTextField;
private JTextField hmmfileTextField;
private JSpinner minProteomesSpinner;
private JCheckBox allProteomesCheckbox;

public BcgTree(){
self = this;
Expand Down Expand Up @@ -208,7 +211,7 @@ public void actionPerformed(ActionEvent e) {
}

private JPanel getAdvancedSettingsPanel(){
JPanel advancedSettingsPanel = new JPanel(new GridLayout(5, 2));
JPanel advancedSettingsPanel = new JPanel(new GridLayout(7, 2));
advancedSettingsPanel.add(new JLabel("--bootstraps"));
bootstrapSpinner = new JSpinner(new SpinnerNumberModel(10, 1, 1000, 1));
advancedSettingsPanel.add(bootstrapSpinner);
Expand All @@ -224,6 +227,18 @@ private JPanel getAdvancedSettingsPanel(){
advancedSettingsPanel.add(new JLabel("--hmmfile"));
hmmfileTextField = new JTextField(System.getProperty("user.dir")+"/../data/essential.hmm", DEFAULT_TEXTFIELD_COLUMNS);
advancedSettingsPanel.add(hmmfileTextField);
advancedSettingsPanel.add(new JLabel("--min-proteomes"));
minProteomesSpinner = new JSpinner(new SpinnerNumberModel(2, 1, 10000, 1));
advancedSettingsPanel.add(minProteomesSpinner);
advancedSettingsPanel.add(new JLabel("--all-proteomes"));
allProteomesCheckbox = new JCheckBox();
allProteomesCheckbox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
minProteomesSpinner.setEnabled(!allProteomesCheckbox.isSelected());
}
});
advancedSettingsPanel.add(allProteomesCheckbox);
return advancedSettingsPanel;
}

Expand Down Expand Up @@ -255,6 +270,11 @@ public void actionPerformed(ActionEvent e) {
writer.println("--bootstraps="+bootstrapSpinner.getValue());
writer.println("--threads="+threadsSpinner.getValue());
writer.println("--hmmfile=\""+hmmfileTextField.getText()+"\"");
if(allProteomesCheckbox.isSelected()){
writer.println("--all-proteomes");
} else {
writer.println("--min-proteomes="+minProteomesSpinner.getValue());
}
String pSeed = randomSeedPTextField.getText();
if(! pSeed.equals("")){
writer.println("--raxml-p-parsimonyRandomSeed="+pSeed);
Expand Down
36 changes: 31 additions & 5 deletions bin/bcgTree.pl
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,23 @@ =head1 OPTIONS

$options{'outdir=s'} = \( my $opt_outdir="bcgTree" );

=item [--help]
=item [--help]
show help
=cut

$options{'help|h|?'} = \( my $opt_help );

=item [--version]
=item [--version]
show version number of bcgTree and exit
=cut

$options{'version'} = \( my $opt_version );

=item [--check-external-programs]
=item [--check-external-programs]
Check if all of the required external programs can be found and are executable, then exit.
Report table with program, status (ok or !fail!) and path.
Expand Down Expand Up @@ -138,6 +138,30 @@ =head1 OPTIONS

=back
=item [--min-proteomes=<INT>]
Minimum number of proteomes in which a gene must occur in order to be kept. Default: 2
All genes with less hits are discarded prior to the alignment step.
This option is ignored if --all-proteomes is set.
=cut

$options{'min-proteomes=i'} = \( my $opt_min_proteomes = 2 );

=back
=item [--all-proteomes]
Sets --min-proteomes to the total number of proteomes supplied. Default: not set
All genes that do not hit all of the proteomes are discarded prior to the alignment step.
If set --min-proteomes is ignored.
=cut

$options{'all-proteomes'} = \( my $opt_all_proteomes = 0 );

=back
=item [--hmmfile=<PATH>]
Path to HMM file to be used for hmmsearch. Default: <bcgTreeDir>/data/essential.hmm
Expand Down Expand Up @@ -204,6 +228,7 @@ =head1 CODE
);

my $L = Log::Log4perl::get_logger();
$opt_min_proteomes = 0+(keys %{$opt_proteome}) if($opt_all_proteomes);
my $bcgTree = bcgTree->new({
'proteome' => $opt_proteome,
'outdir' => $opt_outdir,
Expand All @@ -216,7 +241,8 @@ =head1 CODE
'bootstraps' => $opt_bootstraps,
'hmmfile' => $opt_hmmfile,
'raxml-p' => $opt_raxml_p,
'raxml-x' => $opt_raxml_x
'raxml-x' => $opt_raxml_x,
'min-proteomes' => $opt_min_proteomes
});
$bcgTree->check_existence_of_fasta_files();
$bcgTree->rename_fasta_headers();
Expand All @@ -239,7 +265,7 @@ sub check_external_programs{
my $result = 'ok';
if(! -X $path){
$result = '!fail!';
$fail = 1;
$fail = 1;
}
printf "%-10s%6s\t%s\n", $p, $result, $path;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/bcgTree.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use File::Path qw(make_path);
use File::Spec;
use Fasta::Parser;

our $VERSION = '1.0.8';
our $VERSION = '1.0.9';

my $L = Log::Log4perl::get_logger();

Expand Down Expand Up @@ -152,13 +152,13 @@ sub collect_best_hmm_hits{
$count++;
}
$L->info("Wrote $count ids for gene $g");
if($count < 2){
if($count < $self->{'min-proteomes'}){
$L->warn("Gene $g only present in $count proteome - removing from further analyses");
delete $gene_id_map{$g};
}
close OUT or $L->logdie("Error closing $out/$g.ids. $!");
}
# Add the remaining list of genes to the object
# Add the remaining list of genes to the object
$self->{genes} = [keys %gene_id_map];
$L->logdie("Not a single gene is present in more than one proteome - Exiting") if((keys %gene_id_map) < 1);
# Write absence presence list
Expand Down

0 comments on commit ceab4df

Please sign in to comment.