I want to query the molecular weight of multiple proteins from R given uniprot ids. I thought of using biomaRt or UniProt.ws, but didn't see which field I should query.

There are online tools performing the calculation given a uniprot ID (PIR, ExPASy), but you have to manually enter the input and save the output.

I want the MW that appears in UniProt when looking in "Sequences" under Mass (for example for the entry http://www.uniprot.org/uniprot/Q9Z2Y8)
You can get this information from the [TogoWS REST service][1], starting from UniProt ID. For example, using PROSC_MOUSE (which is the ID, Q9Z2Y8 is the *accession*):

```
library(rjson)
library(RCurl)

u <- getURL("http://togows.dbcls.jp/entry/uniprot/PROSC_MOUSE.json")
j <- fromJSON(u)

j[[1]]$sq$MW
# [1] 30049
```

Conversion from accession to ID should be easy using R/biomaRt (search Biostar for numerous examples).

 [1]: http://togows.dbcls.jp/site/en/rest.html