I've been struggling with this issue for a while, and I think that there is an easy solution that I'm just not seeing. I called a function on a vector, and what is returned is a list of lists, with one list for each value in the original vector. Here is the beginning of the output of that function, showing only the first list in the list of lists:
> getGOParents(go1769308.mf)[1]
$`GO:0003824`
$`GO:0003824`$Ontology
[1] "MF"
$`GO:0003824`$Parents
is_a
"GO:0003674"
I'd like to only get the last value, "GO:0003674". Is this possible? Here is the structure of the list if it is of any help:
> str(getGOParents(go1769308.mf)[1])
List of 1
$ GO:0003824:List of 2
..$ Ontology: chr "MF"
..$ Parents : Named chr "GO:0003674"
.. ..- attr(*, "names")= chr "is_a"
The values I'm looking for are in the component $Parents, but I can't seem to access it:
> Parents(getGOParents(go1769308.mf)[1])
Error: could not find function "Parents"
>
> getGOParents(go1769308.mf)[1]$Parents
NULL
I may be misunderstanding the utility of components, and hence why I'm struggling with this.