Have you tried just doing parents <- elementMetadata(gffsub)$Parent). Anyway, you're not creating an actual dataframe, which would seem to be the root of your problem.
Thanks for the code modification Ying. After running it, I got the following warning messages (five times - presumably one for each of my 5 samples):
Warning messages:
1: In .Seqinfo.mergexy(x, y) :
Each of the 2 combined objects has sequence levels not in the other:
- in 'x': Chromosome
- in 'y': NC_016810.1
Make sure to always combine/compare objects based on the same reference
genome (use suppressWarnings() to suppress this warning).
That's just a warning so you can ignore it if you want. what it says is that your aligns might not all be mapped to the same reference because one of your files has reads in chromosome NC_016810.1 while another does not.
uhh, I actually have no clue what you are trying to do here, are you sure there is something in ids? the warning earlier had something to do with either seqlevels in your bams but not gff or the other way around. what you needed to do was check to make sure that the bams were all aligned to the same reference and the chromosomes in that reference were the same format as the chromosomes in the gff file.
From your code it almost seems like you are just trying to do a bunch of things without understanding why things work or don't.. You should put more thinking into what you are trying to do and what the machine is doing and where things break down so you get the error. From the first post your errors/problems all seem like not understanding what your R code is doing
Have you tried just doing
parents <- elementMetadata(gffsub)$Parent)
. Anyway, you're not creating an actual dataframe, which would seem to be the root of your problem.as a sidenote,
mcols()
will do the same thing aselementMetadata()
Thanks guys!
I have tried mcols and Parents <- elementMetadata(gffsub)$Parent;
Going further using the following code threw errors (obviously because countDF = NULL):
cross posted on SE: http://seqanswers.com/forums/showthread.php?t=35329
Post is no longer on SE: http://seqanswers.com/forums/showthread.php?t=35329