Genetics

 view release on metacpan or  search on metacpan

doc/Update.html  view on Meta::CPAN

  Argument  : The Genetics::Object::Subject object to be updated.
  Returns   : 1 on success, undef otherwise. 
  Scope     : Public
  Comments  : If Subject.kindredID is modified, the approprate updates are also 
              made to KindredSubject.  In other words, the reciprocal 
              relationships Kindred->Subjects and Subject->Kindred are kept in 
              synch.</PRE>
<P>
<H2><A NAME="updatekindred">updateKindred</A></H2>
<PRE>
  Function  : Update a Genetics::Object::Kindred object in the database.
  Argument  : The Genetics::Object::Kindred object to be updated.
  Returns   : 1 on success, undef otherwise. 
  Scope     : Public
  Comments  : If the set of Subjects contained in a Kindred is modified, 
              the approprate updates are also made to the Subject.kindredID 
              field of each of the Subjects.  In other words, the reciprocal 
              relationships Kindred-&gt;Subjects and Subject-&gt;Kindred are kept 
              in synch.  This only applies to primary Kindreds, of course.</PRE>
<P>
<H2><A NAME="updatemarker">updateMarker</A></H2>
<PRE>
  Function  : Update a Genetics::Object::Marker object in the database.
  Argument  : The Genetics::Object::Marker object to be updated.
  Returns   : 1 on success, undef otherwise. 
  Scope     : Public</PRE>
<P>
<H2><A NAME="updatesnp">updateSNP</A></H2>
<PRE>
  Function  : Update a Genetics::Object::SNP object in the database.
  Argument  : The Genetics::Object::SNP object to be updated.
  Returns   : 1 on success, undef otherwise. 
  Scope     : Public</PRE>
<P>
<H2><A NAME="updategenotype">updateGenotype</A></H2>
<PRE>
  Function  : Update a Genetics::Object::Genotype object in the database.
  Argument  : The Genetics::Object::Genotype object to be updated.
  Returns   : 1 on success, undef otherwise.
  Scope     : Public</PRE>
<P>
<H2><A NAME="updatestudyvariable">updateStudyVariable</A></H2>
<PRE>
  Function  : Update a Genetics::Object::StudyVariable object in the database.
  Argument  : The Genetics::Object::StudyVariable object to be updated.
  Returns   : 1 on success, undef otherwise.
  Scope     : Public
  Comments  : StudyVariable.format cannot be modified.</PRE>
<P>
<H2><A NAME="updatephenotype">updatePhenotype</A></H2>
<PRE>
  Function  : Update a Genetics::Object::Phenotype object in the database.
  Argument  : The Genetics::Object::Phenotype object to be updated.
  Returns   : 1 on success, undef otherwise.
  Scope     : Public
  Comments  : 
</PRE>
<PRE>

=cut</PRE>
<P>sub updatePhenotype {
  my($self, $pt) = @_ ;
  my($id, $actualType, $sth, $active, $date, $svFormat, $valueFieldName, $aaListPtr) ;
  my $dbh = $self-&gt;{dbh} ;
</P>
<PRE>

  $DEBUG and carp &quot; -&gt;[updatePhenotype] $pt&quot; ;</PRE>
<PRE>
  $id = $pt-&gt;field(&quot;id&quot;) ;
  ( $actualType ) = $dbh-&gt;selectrow_array(&quot;select objType from Object 
                                           where id = $id&quot;) ;
  if ( $actualType ne &quot;Phenotype&quot;) {
    carp &quot; -&gt;[updatePhenotype] Object with ID = $id is not a Phenotype!&quot; ;
    return(undef) ;
  }
  # Object
  $self-&gt;_updateObjAssocData($pt) ;
  # Phenotype
  if ( defined($active = $pt-&gt;field(&quot;isActive&quot;)) ) {
    $sth = $dbh-&gt;prepare( &quot;update Phenotype 
                           set isActive = ? 
                           where ptID = ?&quot; ) ;
    $sth-&gt;execute($active, $id) ;
    $sth-&gt;finish() ;
  }
  if ( defined($date = $pt-&gt;field(&quot;dateCollected&quot;)) ) {
    $sth = $dbh-&gt;prepare( &quot;update Phenotype 
                           set dateCollected = ? 
                           where ptID = ?&quot; ) ;
    if ($date eq &quot;DELETE&quot;) {
      $sth-&gt;execute(undef, $id) ;
    } else {
      $sth-&gt;execute($date, $id) ;
    }
    $sth-&gt;finish() ;
  }
  ( $svFormat ) = $dbh-&gt;selectrow_array( &quot;select format from StudyVariable, Phenotype 
                                          where ptID = $id 
                                          and Phenotype.svID = StudyVariable.studyVariableID&quot; ) ;
  $valueFieldName = lc($svFormat) . &quot;Value&quot; ;
  $sth = $dbh-&gt;prepare( &quot;update Phenotype 
                         set $valueFieldName = ? 
                         where ptID = ?&quot; ) ;
  $sth-&gt;execute($pt-&gt;field(&quot;value&quot;), $id) ;
  $sth-&gt;finish() ;
  # Phenotype AssayAttributes
  if ( defined ($aaListPtr = $pt-&gt;field(&quot;AssayAttrs&quot;)) ) {
    $self-&gt;_updateAssayAttrs($aaListPtr, &quot;Phenotype&quot;, $id) ;
  }
</PRE>
<PRE>

  $DEBUG and carp &quot; -&gt;[updatePhenotype] End.&quot; ;</PRE>
<PRE>
  return(1) ;
}</PRE>
<P>
<H2><A NAME="updatefrequencysource">updateFrequencySource</A></H2>
<PRE>
  Function  : Update a Genetics::Object::FrequencySource object in the database.



( run in 3.386 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )