GithubHelp home page GithubHelp logo

Comments (2)

blajoie avatar blajoie commented on August 16, 2024

Sorry for the delay - yes that does not sound correct. Boundaries should only be local minima, not maximia. Have you since solved your problem? If you can share your input/output I can try to take a look - though this code is now quite stale and is no longer maintained.

from crane-nature-2015.

yezhengSTAT avatar yezhengSTAT commented on August 16, 2024

Hello, I simply wrote an R code to extract local minimum and continue with other analysis without outputing the boundaries. The input file is attached if it is helpful.
rep1.Uni.chr1.ICE_matrix.is520001.ids320001.insulation.txt

`TADstrength <- function(TADdelta){
## input is two column TADdelta frame: delta and indicator
## return is the TAD boundary strength vector
i <- 1
end <- dim(TADdelta)[1]
max <- 0
min <- 1000000
extremeList <- NULL
strengthList <- NULL
binList <- NULL
while(i<=end){
if(!(is.na(TADdelta$deltaSquare[i])) & TADdelta$deltaSquare[i] == 1){ ## skip beginning NA 0 and peak
while(TADdelta$deltaSquare[i] == 1){
if(max < TADdelta$delta[i])
max <- TADdelta$delta[i]
i <- i + 1
if(i > end | is.na(TADdelta$deltaSquare[i]))
break

        }

        extremeList <- c(extremeList, max)
        max <- 0
        
        if(i > end | is.na(TADdelta$deltaSquare[i]))
            break
           
        binList <- c(binList, i-1)
        while(TADdelta$deltaSquare[i] == -1){
            if(min > TADdelta$delta[i])
                min <- TADdelta$delta[i]
            i <- i + 1
            if(i > end | is.na(TADdelta$deltaSquare[i]))
                break
        }
        extremeList <- c(extremeList, min)
        min <- 10000000
        if(i > end | is.na(TADdelta$deltaSquare[i]))
            break
           
    }else{
        i <- i + 1
    }

}

for(i in seq(1, length(extremeList), by=2)){
    strengthList <- c(strengthList, (extremeList[i] - extremeList[i+1]))
}
return(list(strengthList=strengthList, binList=binList))

}`

from crane-nature-2015.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.