Ranking altmetrics: DIY

In the previous post Network effects: on alternative metrics I presented the top 10 articles by altmetric for repository downloads in April 2015 as recorded by IRUS-UK. This is a quick post on how to do it for any set of DOIs.

IRUS-UK provides a rich data set currently comprising 84 UK repositories with a total of more than 36 million unique item downloads recorded, and if you are an IRUS participant you can easily derive data for your own repository.

Log-in to the portal at http://www.irus.mimas.ac.uk/ via UK Access Management Federation and navigate to Statistics Reports, Article Report 4, limit the date range you are interested in, select your repository – I’m actually using White Rose Research Online here as a consortium of 3 major research institutions (Leeds, Sheffield, York)- and output as CSV:

Screenshot from IRUS-UK
Screenshot from IRUS-UK

Use MS Excel to filter blanks and other gubbins from the DOI column and cut and paste the resulting list into a Google sheet.

Now you need the script below, kindly provided by the founder of altmetric.com Euan Adie, Tools -> Script editor -> Blank project, just cut and paste and save the project:

function ALTMETRIC_SCORE(input) {
var response = UrlFetchApp.fetch(“http://api.altmetric.com/v1/doi/” + input, {muteHttpExceptions: true});
var data = response.getContentText(“UTF-8”);
if (data.length <= 10) {return 0;}
var json = JSON.parse(data);
return Math.floor(json.score);


Now return to your Google Sheet and simply type the formula into the first cell of column B referencing the equivalent cell in column A:

1. Type the formula into the first cell as =ALTMETRIC_SOURCE(A2)
1. Type the formula into the first cell as =ALTMETRIC_SCORE(A2)

Now you just need to drag the formula into every cell in column B – using the handle in the bottom right corner – to run against the corresponding cell with a DOI in column A.

HOWEVER, unfortunately you can’t just do thousands or even hundreds at a time as it will upset Google’s rate limiter and you will get increasing numbers of cells screaming ERROR! so you need to do them in batches of about 100 at a time:

Drag formula into all cells in column B
2. Drag formula into all cells in column B
3. Script will run for each cell in column A
3. Script will run for each cell in column A
4. Don't drag to the next batch of cells until data is loaded
4. Don’t drag to the next batch of cells until data is loaded

Once this is done, which can be painstaking with several thousand records, you can use Sort sheet Z-A to rank highest to lowest.

WARNING – if you do this with the column containing the live formula it will run again for all cells at once and throw hundreds of errors which is what the painstaking process was meant to avoid…so copy and paste values only into the next column and sort on that! It is likely that there will be some ERRORS and you can run the formula again in another column though some of them may just be dud DOIs.

And there they are, all records downloaded from WRRO (with DOIs*) since that repository joined IRUS in October 2013 ranked highest to lowest by altmetric *some of the records excluded by the initial filter on DOI may in fact have a DOI of course that isn’t available from IRUS (or presumably the originating repository) so to be really thorough you might try to track them down!

Finally, altmetric donuts can be embedded easily using code provided at http://api.altmetric.com/embeds.html so here are the top ten from WRRO:

  1. Lin, J, Pan, D, Davis, SJ, Zhang, Q, He, K, Wang, C, Streets, DG, Wuebbles, DJ and Guan, D (2014) China’s international trade and air pollution in the United States. Proceedings of the National Academy of Sciences of the United States of America, 111 (5). 1736 – 1741. ISSN 0027-8424

    DOI lookup(Available OA from publisher website: licence unclear)
    Total downloads from WRRO: 1*
    (* Full text not actually in WRRO, didn’t think IRUS counted links and also seems unlikely that only ever linked once.)

  2. Brienen, RJW, Phillips, OL, Feldpausch, TR, Gloor, E, Baker, TR, Lloyd, J, Lopez-Gonzalez, G, Monteagudo-Mendoza, A, Malhi, Y, Lewis, SL, Vásquez Martinez, R, Alexiades, M, Álvarez Dávila, E, Alvarez-Loayza, P, Andrade, A, Aragão, LEOC, Araujo-Murakami, A, Arets, EJMM, Arroyo, L, Aymard C, GA, Bánki, OS, Baraloto, C, Barroso, J, Bonal, D, Boot, RGA, Camargo, JLC, Castilho, CV, Chama, V, Chao, KJ, Chave, J, Comiskey, JA, Cornejo Valverde, F, da Costa, L, de Oliveira, EA, Di Fiore, A, Erwin, TL, Fauset, S, Forsthofer, M, Galbraith, DR, Grahame, ES, Groot, N, Hérault, B, Higuchi, N, Honorio C, E, Keeling, H, Killeen, TJ, Laurance, WF, Laurance, S, Licona, J, Magnussen, WE, Marimon, BS, Marimon-Junior, BH, Mendoza, C, Neill, DA, Nogueira, EM, Núñez, P, Pallqui Camacho, NC, Parada, A, Pardo-Molina, G, Peacock, J, Peña-Claros, M, Pickavance, GC, Pitman, NCA, Poorter, L, Prieto, A, Quesada, CA, Ramírez, F, Ramírez-Angulo, F, Restrepo, Z, Roopsind, A, Rudas, A, Salomão, RP, Schwarz, M, Silva, N, Silva-Espejo, JE, Silveira, M, Stropp, J, Talbot, J, ter Steege, H, Teran-Aguilar, J, Terborgh, J, Thomas-Caesar, R, Toledo, M, Torello-Raventos, M, Umetsu, RK, van der Heijden, GMF, van der Hout, P, Guimarães Vieira, IC, Vieira, SA, Vilanova, E, Vos, VA and Zagt, RJ (2015) Long-term decline of the Amazon carbon sink. Nature, 519 (7543). 344 – 348. ISSN 0028-0836

    DOI lookup(Access restricted from publisher website)
    Total downloads from WRRO: 2*
    (* embargoed from WRRO – unclear how can have any downloads.)

  3. Bond, TC, Doherty, SJ, Fahey, DW, Forster, PM, Berntsen, T, DeAngelo, BJ, Flanner, MG, Ghan, S, Kärcher, B, Koch, D, Kinnell, S, Kondo, Y, Quinn, PK, Sarofim, MC, Schultz, MG, Schulz, M, Venkataraman, C, Zhang, H, Zhang, S, Bellouin, N, Guttikunda, SK, Hopke, PK, Jacobson, MZ, Kaiser, JW, Klimont, Z, Lohmann, U, Schwarz, JP, Shindell, D, Storelvmo, T, Warren, G and Zender, CS (2013) Bounding the role of black carbon in the climate system: A scientific assessment. Journal of Geophysical Research: Atmospheres, 118 (11). 5380 – 5552.

    DOI lookup(Available OA from publisher website: CC-BY-NC-ND)
    Total downloads from WRRO: 102

  4. McMillan, M, Shepherd, A, Sundal, A, Briggs, K, Muir, A, Ridout, A, Hogg, A and Wingham, D (2014) Increased ice losses from Antarctica detected by CryoSat-2. Geophysical Research Letters, 41 (11). 3899 – 3905. ISSN 0094-8276

    DOI lookup(Access restricted from publisher website: CC-BY*)
    Total downloads from WRRO: 12
    (* restricted access presumably in error)

  5. Marotzke, J and Forster, PM (2015) Forcing, feedback and internal variability in global temperature trends. Nature, 517 (7536). 565 – 570. ISSN 0028-0836

    DOI lookup(Access restricted from publisher website)
    Total downloads from WRRO: 1

  6. Otto, A, Otto, FEL, Allen, MR, Boucher, O, Church, J, Hegerl, G, Forster, PM, Gillett, NP, Gregory, J, Johnson, GC, Knutti, R, Lohmann, U, Lewis, N, Marotzke, J, Stevens, B, Myhre, G and Shindell, D (2013) Energy budget constraints on climate response. Nature Geoscience, 6 (6). 415 – 416. ISSN 1752-0894

    DOI lookup(Access restricted from publisher website)
    Total downloads from WRRO: 537

  7. Challinor, AJ, Watson, J, Lobell, DB, Howden, SM, Smith, DR and Chhetri, N (2014) A meta-analysis of crop yield under climate change and adaptation. Nature Climate Change, 4. 287 – 291. ISSN 1758-678X

    DOI lookup(Access restricted from publisher websiter)
    Total downloads from WRRO: 77

  8. MacPherson, Hugh, Richmond, Stewart John, Bland, Martin, Brealey, Stephen Derek, Gabe, Rhian, Hopton, Ann Kathryn, Keding, Ada, Lansdown, Harriet, Perren, Sara, Sculpher, Mark, Spackman, Eldon, Torgerson, David John and Watt, Ian (2013) Acupuncture and counselling for depression in primary care : a randomised controlled trial. PLoS Medicine. 1001518. ISSN 1549-1277

    DOI lookup(Available OA from publisher website: CC-BY)
    Total downloads from WRRO: 52

  9. Schroeder, J., Dugdale, H.L., Radersma, R., Hinsch, M., Buehler, D.M., Saul, J., Porter, L., Liker, A., De Cauwer, I., Johnson, P.J., Santure, A.W., Griffin, A.S., Bolund, E., Ross, L., Webb, T.J., Feulner, P.G.D., Winney, I., Szulkin, M., Komdeur, J., Versteegh, M.A., Hemelrijk, C.K., Svensson, E.I., Edwards, H., Karlsson, M., West, S.A., Barrett, E.L.B., Richardson, D.S., van den Brink, V., Wimpenny, J.H., Ellwood, S.A., Rees, M., Matson, K.D., Charmantier, A., dos Remedios, N., Schneider, N.A., Teplitsky, C., Laurance, W.F., Butlin, R.K. and Horrocks, N.P.C. (2013) Fewer invited talks by women in evolutionary biology symposia. Journal Of Evolutionary Biology, 26 (9). pp. 2063-2069. ISSN 1420-9101

    DOI lookup(Available OA from publisher website: CC-BY)
    Total downloads from WRRO: 6

  10. Jetz, W, Thomas, G.H, Joy, J.B, Redding, D.W, Hartmann, K and Mooers, A.O (2014) Global Distribution and Conservation of Evolutionary Distinctness in Birds. Current Biology, 24 (9). pp. 919-930.

    DOI lookup(Available OA from publisher website: CC-BY)
    Total downloads from WRRO: 91

4 thoughts on “Ranking altmetrics: DIY

  1. Thank you for this and the walk-through method. It worked for a non-techie! Copy & pasting directly from blog above gave me a character encoding issue in Google Sheets script with quotes/”. Sorted by keying in these manually. I cleaned up the DOI column with sed on Mac Terminal/bash :
    sed 's/,.*//' YOUR_AR4_Apr-2014_Mar-2015.csv | sed '/^$/d' | sed -n '/10./p' | sed 's/["]//g' | sed 's/\. *$//' > YOUR_AR4_Apr-2014_Mar-2015_DOI_COLUMN_CLEAN.csv
    Needed to QA this for my particular gubbins, but goes through about 5000 records in ~0.5sec. The live formula got me, regenerated on mass, with ‘ERROR!’ , on scrolling(?), as you noted. RStudio/R and rAltmetric is another approach, although it has its annoyances.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top