Here is the set up of my list of lists of lists: please see the development code for the read.GenBank function here
#must be connected to internet for this to work
library(ape)
library(plyr)
gi_sample<-c(336087836, 336087835, 336087834)
#use the read.GenBank function with apply because we ultimately have more than the max at one time (400)
my_output <- apply(gi_sample, 1, function(x) read.GenBank(x))
str(my_output)
List of 3
$ :List of 1
..$ 336087836:Class 'DNAbin' raw [1:606] 00 00 00 00 ...
..- attr(*, "class")= chr "DNAbin"
..- attr(*, "species")= chr "Flavobacterium_johnsoniae"
..- attr(*, "references")=List of 1
.. ..$ 336087836:List of 2
.. .. ..$ :List of 4
.. .. .. ..$ pubmedid: chr(0)
.. .. .. ..$ authors : chr "Rusznyak,A., Akob,D.M., Nietzsche,S., Eusterhues,K., Totsche,K.U., Neu,T.R., Frosch,T., Popp,J., Keiner,R., Geletneky,J., Katzs"| __truncated__
.. .. .. ..$ title : chr "Calcite mineralization by karstic cave bacteria"
.. .. .. ..$ journal : chr "Unpublished"
.. .. ..$ :List of 4
.. .. .. ..$ pubmedid: chr(0)
.. .. .. ..$ authors : chr "Rusznyak,A."
.. .. .. ..$ title : chr "Direct Submission"
.. .. .. ..$ journal : chr "Submitted (13-APR-2011) to the INSDC. Institute of Ecology, Aquatic"
$ :List of 1
..$ 336087835:Class 'DNAbin' raw [1:991] 00 00 00 00 ...
..- attr(*, "class")= chr "DNAbin"
..- attr(*, "species")= chr "Rhodococcus_fascians"
..- attr(*, "references")=List of 1
.. ..$ 336087835:List of 2
.. .. ..$ :List of 4
.. .. .. ..$ pubmedid: chr(0)
.. .. .. ..$ authors : chr "Rusznyak,A., Akob,D.M., Nietzsche,S., Eusterhues,K., Totsche,K.U., Neu,T.R., Frosch,T., Popp,J., Keiner,R., Geletneky,J., Katzs"| __truncated__
.. .. .. ..$ title : chr "Calcite mineralization by karstic cave bacteria"
.. .. .. ..$ journal : chr "Unpublished"
.. .. ..$ :List of 4
.. .. .. ..$ pubmedid: chr(0)
.. .. .. ..$ authors : chr "Rusznyak,A."
.. .. .. ..$ title : chr "Direct Submission"
.. .. .. ..$ journal : chr "Submitted (13-APR-2011) to the INSDC. Institute of Ecology, Aquatic"
$ :List of 1
..$ 336087834:Class 'DNAbin' raw [1:690] 00 00 00 00 ...
..- attr(*, "class")= chr "DNAbin"
..- attr(*, "species")= chr "Serratia_plymuthica"
..- attr(*, "references")=List of 1
.. ..$ 336087834:List of 2
.. .. ..$ :List of 4
.. .. .. ..$ pubmedid: chr(0)
.. .. .. ..$ authors : chr "Rusznyak,A., Akob,D.M., Nietzsche,S., Eusterhues,K., Totsche,K.U., Neu,T.R., Frosch,T., Popp,J., Keiner,R., Geletneky,J., Katzs"| __truncated__
.. .. .. ..$ title : chr "Calcite mineralization by karstic cave bacteria"
.. .. .. ..$ journal : chr "Unpublished"
.. .. ..$ :List of 4
.. .. .. ..$ pubmedid: chr(0)
.. .. .. ..$ authors : chr "Rusznyak,A."
.. .. .. ..$ title : chr "Direct Submission"
.. .. .. ..$ journal : chr "Submitted (13-APR-2011) to the INSDC. Institute of Ecology, Aquatic"
What I would like out of this list:
GI authors title journal
336087836 "Rusznyak,A., Akob,D.M., Nietzsche,S., Eusterhues,K., Totsche,K.U., Neu,T.R., Frosch,T., Popp,J., Keiner,R., Geletneky,J., Katzs"| __truncated__ "Calcite mineralization by karstic cave bacteria" "Unpublished"
336087835 "Rusznyak,A., Akob,D.M., Nietzsche,S., Eusterhues,K., Totsche,K.U., Neu,T.R., Frosch,T., Popp,J., Keiner,R., Geletneky,J., Katzs"| __truncated__ "Calcite mineralization by karstic cave bacteria" "Unpublished"
336087834 "Rusznyak,A., Akob,D.M., Nietzsche,S., Eusterhues,K., Totsche,K.U., Neu,T.R., Frosch,T., Popp,J., Keiner,R., Geletneky,J., Katzs"| __truncated__ "Calcite mineralization by karstic cave bacteria" "Unpublished"
I am sorely in need of an explanation of how these lists are nested. How can I access the "title" and keep the name of each list? I have tinkered with all sorts of "[]" subsetting combinations and ultimately do not understand how to read this list. I have read many beginner explanations, and am still at a loss.
This is changed from the earlier question, although the data remain the same.
Thank you!
dputis much more useful thanstr.as.data.frame(do.call(c, seqs))or some variation that includesunlist()might work for you.rapply()may be necessary, anddput()is essential.?list.flattenfromrlistlibrary