Skip to content

getOscillationDrews() not counting oscillations that reach the end of the chromosome #22

@alvaro-and

Description

@alvaro-and

Hi, thank you for the amazing package!

I encountered some behaviour in getOscillationDrews() that may not be intended.

This is related to the loop in lines 25-33:

 for(j in 3:length(currseg)) {
                    if(currseg[j] == prevval & currseg[j] != currseg[j-1]) {
                        count = count+1
                    } else {
                        oscCounts = c(oscCounts,count)
                        count = 0
                    }
                    prevval = currseg[j-1]
                }

As it is at the moment, if the last segment of a chromosome is part of an oscillation, then count gets updated but oscCounts does not, leading to this oscillation not being counted in the final output. Is this behaviour intended?
Otherwise, I would suggest updating this part of the code:

 for(j in 3:length(currseg)) {
                    if(currseg[j] == prevval & currseg[j] != currseg[j-1]) {
                        count = count+1
                        if (j == length(currseg)) {
                                      oscCounts = c(oscCounts, count)
                                      count = 0
                        }
                    } else {
                        oscCounts = c(oscCounts,count)
                        count = 0
                    }
                    prevval = currseg[j-1]
                }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions