From 9fdfa56839b9f47a83e45d4056d45569c3b7b5db Mon Sep 17 00:00:00 2001 From: Naama Menda Date: Mon, 1 Nov 2010 08:59:14 -0400 Subject: [PATCH] this should be the right query for recursive children --- lib/CXGN/Chado/Cvterm.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/CXGN/Chado/Cvterm.pm b/lib/CXGN/Chado/Cvterm.pm index b92e421..cda1c2b 100644 --- a/lib/CXGN/Chado/Cvterm.pm +++ b/lib/CXGN/Chado/Cvterm.pm @@ -721,11 +721,11 @@ sub get_children { sub get_recursive_children { my $self=shift; - my $q = "SELECT distinct(cvtermpath.object_id), cvterm_relationship.type_id + my $q = "SELECT distinct(cvtermpath.subject_id), cvterm_relationship.type_id FROM cvtermpath JOIN cvterm_relationship USING (subject_id) JOIN cvterm ON (cvtermpath.object_id = cvterm_id) - WHERE cvtermpath.subject_id =? AND cvterm.is_obsolete=0 AND pathdistance<0 "; + WHERE cvtermpath.object_id =? AND cvterm.is_obsolete=0 AND pathdistance>0 "; my $sth = $self->get_dbh()->prepare($q); $sth->execute($self->get_cvterm_id() ); @@ -1459,14 +1459,14 @@ sub get_recursive_loci { my $self=shift; my $query = "select distinct locus_id from cvtermpath join cvterm on (cvtermpath.object_id = cvterm.cvterm_id or cvtermpath.subject_id = cvterm.cvterm_id) join phenome.locus_dbxref using (dbxref_id ) join phenome.locus using (locus_id) where (cvtermpath.object_id = ?) and locus_dbxref.obsolete = 'f' and locus.obsolete = 'f' "; - my $sth=$self->get_dbh()->prepare($query);; + my $sth=$self->get_dbh()->prepare($query); my @loci; $sth->execute($self->get_cvterm_id() ); while ( my ($locus_id) = $sth->fetchrow_array() ) { my $locus= CXGN::Phenome::Locus->new($self->get_dbh(), $locus_id); push @loci, $locus; } - + return @loci; } -- 2.11.4.GIT