This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Retrieve multiple FASTA from UniProt using R

I have a huge list of UniProt protein accession numbers and I need to retrieve the FASTA sequences from UniProt website. Is there any R script for doing that? I know I can do it from UniProt website but this will be used for further developing script for downstream mass spec analysis.

r uniprot fasta

Yes I can download whole proteome from Example Retrieval Uniprot. But I want to use different uniprot identifiers like ..................

ids <- c("P62754", "Q8K094", "Q64337")

I am using R 3.6.1 which doesn't support BioConductor. What to do?
> install.packages("bioconductor")
Installing package into ‘C:/Users/Gita/Documents/R/win-library/3.6’ (as ‘lib’ is unspecified)
Warning in install.packages :   package ‘bioconductor’ is not available (for R version 3.6.1)

BioConductor is a repository, not a package. The Rcpi link above has clear install instructions:

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("Rcpi")

1 answer

Install Rcpi (I suggest using conda, as it can be a bit of a pain to install) and then, under R:

library( Rcpi )
fastas <- getFASTAFromUniProt( c( "P62754", "Q8K094", "Q64337" ) )
write( x, "uniprot.fasta" )

Log in to answer this question.