Skip to main content

Handle Thomson Reuters Web of Science™ export files

Project description

wosfile

Build Status Coverage Status

wosfile is a Python package designed to read and handle data exported from Thomson Reuters Web of Science™. It supports both tab-delimited files and so-called ‘plain text’ files.

The point of wosfile is to read export files from WoS and give you a simple data structure—essentially a dict—that can be further analyzed with tools available in standard Python or with third-party packages. If you're looking for a ‘one-size-fits-all’ solution, this is probably not it.

Pros:

  • It has no requirements beyond Python 3.6+ and the standard library.
  • Completely iterator-based, so useful for working with large datasets. At no point should we ever have more than one single record in memory.
  • Simple API: usually one needs just one function wosfile.records_from().

Cons:

  • Pure Python, so might be slow.
  • At the moment, wosfile does little more than reading WoS files and generating Record objects for each record. While it does some niceties like parsing address fields, it does not have any analysis functionality.

Examples

These examples use a dataset exported from Web of Science in multiple separate files(the maximum number of exported records per file is 500).

Subject categories in our data

import glob
import wosfile
from collections import Counter

subject_cats = Counter()
# Create a list of all relevant files. Our folder may contain multiple export files.
files = glob.glob("data/savedrecs*.txt")

# wosfile will read each file in the list in turn and yield each record
# for further handling
for rec in wosfile.records_from(files):
    # Records are very thin wrappers around a standard Python dict,
    # whose keys are the WoS field tags.
    # Here we look at the SC field (subject categories) and update our counter
    # with the categories in each record.
    subject_cats.update(rec.get("SC"))

# Show the five most common subject categories in the data and their number.
print(subject_cats.most_common(5))

Citation network

For this example you will need the NetworkX package. The data must be exported as ‘Full Record and Cited References’.

import networkx as nx
import wosfile

# Create a directed network (empty at this point).
G = nx.DiGraph()
nodes_in_data = set()

for rec in wosfile.records_from(files):
    # Each record has a record_id, a standard string uniquely identifying the reference.
    nodes_in_data.add(rec.record_id)
    # The CR field is a list of cited references. Each reference is formatted the same
    # as a record_id. This means that we can add citation links by connecting the record_id
    # to the reference.
    for reference in rec.get("CR", []):
        G.add_edge(rec.record_id, reference)

# At this point, our network also contains all references that were not in the original data.
# The line below ensures that we only retain publications from the original data set.
G.remove_nodes_from(set(G) - nodes_in_data)
# Show some basic statistics and save as Pajek file for visualization and/or further analysis.
print(nx.info(G))
nx.write_pajek(G, 'network.net')

Other Python packages

The following packages also read WoS files (+ sometimes much more):

Other packages query WoS directly through the API and/or by scraping the web interface:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wosfile-0.4.2.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wosfile-0.4.2-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file wosfile-0.4.2.tar.gz.

File metadata

  • Download URL: wosfile-0.4.2.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.7

File hashes

Hashes for wosfile-0.4.2.tar.gz
Algorithm Hash digest
SHA256 8c8b122b42cf654ebc43e619f4ffa1f932fabc6009cdb62e1b96d49462153460
MD5 87c0e9dea8e0c058183c4c4224d6df25
BLAKE2b-256 7aafee1ede14a25bd0eacd059400a187afe9e6b673f2b50b914f3534729f3804

See more details on using hashes here.

File details

Details for the file wosfile-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: wosfile-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.9

File hashes

Hashes for wosfile-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 514556aa1af2e0f1b1d90a059cec8c5c1e3101d4c5e92052aac9127f41319888
MD5 4ba5978f6321eab6190e4dea4cb25ca8
BLAKE2b-256 d5a8576588e63423062b4a73d364a569f5b7c82cfcfd9d6f5ab60e96d70a5478

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page