Skip to content

Commit

Permalink
biotree: --trim-tips: modify output tree by using groups instead of OTUs
Browse files Browse the repository at this point in the history
  • Loading branch information
Weigang Qiu committed Jan 1, 2024
1 parent 591b993 commit e6ec472
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/biodb
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ sub export_orth_bbss {

sub export_orth_set {
my $rep = $opts{'orth-set'};
my $complete_set = 78; # number of old genomes (31) + num of U19 genomes (47), as of Oct 8, 2023
my $complete_set = 50; # number of old genomes (31) + num of U19 genomes (47), as of Oct 8, 2023
my $ref_strain_id = 100;
my $dbh = db_connect();
my $sth0 = $dbh->prepare("SELECT cdhit_id, count(*) FROM v_synteny WHERE rep_id = 1 AND pseudo IS NULL AND seq_err IS NULL GROUP BY cdhit_id HAVING count(cdhit_id) = ?");
my $sth0 = $dbh->prepare("SELECT cdhit_id, count(*) FROM v_synteny WHERE rep_id = ? AND pseudo IS NULL AND seq_err IS NULL GROUP BY cdhit_id HAVING count(cdhit_id) > ?");
my $sth1 = $dbh->prepare("SELECT a.locus, a.seq, b.strain_id FROM orf a, v_synteny b WHERE a.cdhit_id = ? AND a.locus = b.locus");
my $sth2 = $dbh->prepare("SELECT locus, cdhit_id FROM v_synteny WHERE strain_id = ? AND cdhit_id IS NOT NULL");
my $sth3 = $dbh->prepare("SELECT a.strain_id, a.strain_name, b.species_name FROM strain a, species b WHERE a.species_id = b.species_id");
Expand All @@ -234,7 +234,7 @@ sub export_orth_set {
}

my @out;
$sth0->execute($complete_set);
$sth0->execute($rep, $complete_set);
while (my ($fam, $ct) = $sth0->fetchrow_array() ) {
$sth1->execute($fam);
my $outfile = "orthFam_" . $refs{$fam} . ".nuc";
Expand Down
5 changes: 5 additions & 0 deletions lib/Bio/BPWrapper/TreeManipulations.pm
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ sub trim_tips {
print STDERR $_, "\t", $otu_sets{$_}, "\n";
}

foreach my $nd ($tree->get_nodes()) {
next unless $nd->is_Leaf;
$nd->id("trim_" . $otu_sets{$nd->id});
}

$print_tree = 1;
}

Expand Down

0 comments on commit e6ec472

Please sign in to comment.