inst/scripts/tmp_filterBkpStep2.R

### Copyright (C) 2005 Institut Curie
### Author(s): Philippe Hupé (Institut Curie) 2005
### Contact: glad@curie.fr



filterBkpStep <- function(...)
  {
    UseMethod("filterBkpStep")
  }



filterBkpStep.profileCGH <- function(profileCGH, MinBkpWeight=0.35, assignGNLOut=TRUE, ...)
  {


    profileCGH <- filterBkp(profileCGH, MinBkpWeight=MinBkpWeight, assignGNLOut=assignGNLOut)
     
    fin <- 0
    maxiter <- 100
    nbiter <- 0
    


    if (is.data.frame(profileCGH$BkpInfo))
      {
        BkpInfo <- profileCGH$BkpInfo
        indexWeightToSmall <- which(BkpInfo$Weight<MinBkpWeight & BkpInfo$GNLchange==0 & BkpInfo$ZoneGNL!=2)
        indexWeightToSmall <- c(indexWeightToSmall, which(BkpInfo$Weight==0))
        indexWeightZero <- which(BkpInfo$Weight==0 & BkpInfo$GNLchange==1)        
        if (length(indexWeightToSmall)>0 || length(indexWeightZero)>0)
          {
            fin <- 0
          }
        else
          {
            fin <- 1
          }
        while (fin!=1)
          {
            nbiter <- nbiter + 1
            profileCGH <- filterBkp(profileCGH, MinBkpWeight=MinBkpWeight)
            if (is.data.frame(profileCGH$BkpInfo))
              {
                BkpInfo <- profileCGH$BkpInfo
                indexWeightToSmall <- which(BkpInfo$Weight<MinBkpWeight & BkpInfo$GNLchange==0 & BkpInfo$ZoneGNL!=2)
                indexWeightZero <- which(BkpInfo$Weight==0 & BkpInfo$GNLchange==1)
                if (length(indexWeightToSmall)>0 || length(indexWeightZero)>0)
                  {
                    fin <- 0
                  }
                else
                  {
                    fin <- 1
                  }
                if(nbiter>maxiter)
                  {
                    fin <- 1
                    print("There is something wrong in the loop calling filterBkp")
                  }
              }
            else
              {
                fin <- 1
              }
          }

      }

    return(profileCGH)
    
  }

Try the ITALICS package in your browser

Any scripts or data that you put into this service are public.

ITALICS documentation built on Nov. 8, 2020, 6:48 p.m.