Question: nested loop to overlap two genomic ranges lists?

0

cpc5 •

**50**wrote:Hi all,

I want to create a matrix that lists number of overlaps between two lists. So the rows would be one list and the columns would be the other.

this is what I have to far:

```
for (i in length(list.1)) {
for (j in length(list.2)) {
table <- table(countOverlaps(list.1[[i]], list.2[[j]], type='any', maxgap=0)) }}
```

but I am only getting one overlap

I have tried:

```
x <- lapply(list.1, function(x,y) {table(countOverlaps(x,y,type="any", maxgap=0))}, list.2)
```

but the numbers do not match when I do an individual test

any clues?

thanks in advance

Shouldn't it be

`for(i in c(1:length(list.1)) {`

?1.1kyes! I forgot to add the 1 in

50