Entering edit mode
David Rossell
▴
100
@david-rossell-3353
Last seen 10.3 years ago
Hi, the pileup function seems to stop doing the pileup after the first
few
sequences. For instance, if I test the function with my first 10
sequences
it works fine:
> start <- position(aln1)[sel][1:10]; fraglength <-
width(aln1)[sel][1:10];
dir1 <- str1[1:10]
> puprova <-
pileup(start=start,fraglength=fraglength,chrlength=chrlength["chr2L"],
dir=dir1)
> sum(puprova)
[1] 193
I manually checked that the result is correct. Then I repeat the
process
with the first 50 sequences
> sel <- chromosome(aln1)=="chr2L"
> str1 <-
factor(strand(aln1)[sel],levels=c('-','+'),labels=c('-','+'))
> start <- position(aln1)[sel][1:50]; fraglength <-
width(aln1)[sel][1:50];
dir1 <- str1[1:50]
> puprova <-
pileup(start=start,fraglength=fraglength,chrlength=chrlength["chr2L"],
dir=dir1)
> sum(puprova)
[1] 754
So far so good, but now if I repeat the process with the first 100
sequences
the pileup has not incorporated any new information.
> start <- position(aln1)[sel][1:100]; fraglength <-
width(aln1)[sel][1:100]; dir1 <- str1[1:100]
> puprova <-
pileup(start=start,fraglength=fraglength,chrlength=chrlength["chr2L"],
dir=dir1)
> sum(puprova)
[1] 754
Same if I use the full chromosome chr2L
> start <- position(aln1)[sel]; fraglength <- width(aln1)[sel]; dir1
<- str1
> puprova <-
pileup(start=start,fraglength=fraglength,chrlength=chrlength["chr2L"],
dir=dir1)
> sum(puprova)
[1] 754
As you can see below there are many more sequences in chromosome chr2L
> table(chromosome(aln1))
chr2L chr2LHet chr2R chr2RHet chr3L chr3LHet chr3R
chr3RHet
903343 526 978985 3898 200033 8135 639261
6096
chr4 chrM chrU chrUextra chrX chrXHet chrYHet
6246 3241 11115 15711 106300 1028 111
There's also a minor bug that returns an error if the argument 'dir'
to
'pileup' is a factor with levels(dir)=c('+','-'), the routine requires
the
levels to be ('-','+') in this exact order. Simple fixing the
levels(dir)==
c('-','+') for an levels(dir) %in% c('-','+') should fix the issue.
Also,
notice that readAligned typically returns a factor with levels
('-','+','*')
and this causes an error in pileup.
Thank you, take care,
David
[[alternative HTML version deleted]]