You could use epost method for multiple inputs (in this case it does not appear to work for some reason with MAG ID's you have). So write a for loop to pass the ID's to efetch one at a time.
How many ID's do you have? As long as the number is not in thousands you should be fine. But if you have a ton of them then consider using an alternate method such as extracting them from nr database.
#Dependencies
library(refseqR)
# Get the protein sequence using multiple ids.
accession = c("MBN1612259.1", "MBF9061340.1")
my_aa <- refseq_AAseq(accession)
# Make a fasta file
Biostrings::writeXStringSet(x= my_aa, filepath = "mypath/aa_result")
Thank you very much. For Efetch , is there a way I can pass a file with multiple IDs as input ?
You could use
epostmethod for multiple inputs (in this case it does not appear to work for some reason with MAG ID's you have). So write aforloop to pass the ID's toefetchone at a time.is there any limit to download by efetch in one particular session?
How many ID's do you have? As long as the number is not in thousands you should be fine. But if you have a ton of them then consider using an alternate method such as extracting them from
nrdatabase.If you make a file called
lstthat contains all protein IDs, this command will save all FASTA sequences insequences.fasta.