npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rcsb/rcsb-api-tools

v5.2.0

Published

RCSB PDB API request library

Downloads

3,479

Readme

rcsb-api-tools

RCSB Saguaro Web API is an open-source library that includes different tools to validate and request data from the Sequence Coordinates Server, the RCSB Data API and the RCSB Search Service.

Node Module Instalation

npm install @rcsb/rcsb-api-tools

Requesting RCSB GraphQL data

import {GraphQLRequest} from "@rcsb/rcsb-api-tools/build/RcsbGraphQL/GraphQLRequest"

const client = new GraphQLRequest("data-api"|"sequence-coordinates"|url);

client.request(query_params, query_string);

Example

query_params
const query_params = {
  queryId: "P01112",
  from: "UNIPROT",
  to: "PDB_ENTITY"
}
query_string
query QueryAlignment($queryId: String!, $from: String!, $to: String!, $range:[Int!]){
     alignments(
         queryId:$queryId
         from:$from
         to:$to
         range:$range
     ){
         query_sequence
         target_alignments {
             target_id
             orientation
             target_sequence
             coverage {
                 query_coverage
                 query_length
                 target_coverage
                 target_length
             }
             aligned_regions {
                 query_begin
                 query_end
                 target_begin
                 target_end
                 exon_shift
             }
         }
 
     }
 }

Importing RCSB GraphQL interfaces

data-api/yosemite server

E.g. import type {CoreEntry, RcsbEntryContainerIdentifiers} from "@rcsb/rcsb-api-tools/lib/RcsbGraphQL/Types/Yosemite/GqlTypes";

sequence-coordinates/borrego server

E.g. import type {Query, SequenceAnnotations, SequenceAlignments} from '@rcsb/rcsb-api-tools/lib/RcsbGraphQL/Types/Borrego/GqlTypes';

GraphQL query validation

import {validateQueries} from "@rcsb/rcsb-api-tools/lib/RcsbGraphQL/Generator/GeneratorTools";
validateQueries(graphql_schema_url, "path_to_queries/my_query.graphql");

Requesting RCSB Search data

import {SearchRequest} from "@rcsb/rcsb-api-tools/lib/RcsbSearch/SearchRequest";

const client = new SearchRequest();

client.request(query_object);

Example

import type {SearchQuery} from "@rcsb/rcsb-api-tools/lib/RcsbSearch/Types/SearchQueryInterface";
import {LogicalOperator, ReturnType, Service, Type} from "@rcsb/rcsb-api-tools/lib/RcsbSearch/Types/SearchEnums";
import {RcsbSearchMetadata} from "@rcsb/rcsb-api-tools/lib/RcsbSearch/Types/SearchMetadata";

const search_query = {
    query: {
        type: Type.Group,
        nodes:[{
            type:Type.Terminal,
            service: Service.FullText,
            parameters:{
                attribute:RcsbSearchMetadata.RcsbEntryInfo.DiffrnResolutionHigh.Value.path,
                operator:RcsbSearchMetadata.RcsbEntryInfo.DiffrnResolutionHigh.Value.operator.Greater,
                value: 2
            }
        },{
            type: Type.Terminal,
            service: Service.FullText,
            parameters: {
                attribute: RcsbSearchMetadata.RcsbEntitySourceOrganism.TaxonomyLineage.Name.path,
                operator: RcsbSearchMetadata.RcsbEntitySourceOrganism.TaxonomyLineage.Name.operator.ExactMatch,
                value: "Homo sapiens"
            }
        }],
        logical_operator: LogicalOperator.And,
    },
    return_type: ReturnType.PolymerEntity
};
const search = new SearchRequest();
search.request(search_query);

Importing RCSB Search classes/interfaces

Search metadata class

Search metadata class provides the searchable paths and methods for the RCSB Search API

import {RcsbSearchMetadata} from "@rcsb/rcsb-api-tools/lib/RcsbSearch/Types/SearchMetadata";

Utility examples

E.g. RcsbSearchMetadata.RcsbEntryInfo.DiffrnResolutionHigh.Value.path attribute contains the string "rcsb_entry_info.diffrn_resolution_high.value"

E.g. RcsbSearchMetadata.RcsbEntryInfo.DiffrnResolutionHigh.Value.operator enumerates the possible comparison operations (i.e. Equals, Greater, Range, ...)

Search enums

Search enums provide a collection of enums/classes that provide a controlled vocabulary to build the RCSB Search queries. The name of each enum/class (camel cased) matches with the RCSB search schema field name in snake case format. E.g. import {AggregationType, Operator, ReturnType, Service} from "@rcsb/rcsb-api-tools/lib/RcsbSearch/Types/SearchEnums";

AggregationType encodes the possible values of the schema field "aggregation_type", i.e. AggregationType.Terms = "terms", AggregationType.Histogram = "histogram", ...

Building GraphQL types from specific URLs

  • GraphQL types can be generated from specific URLs. By default, production server are used
    • E.g. npm run buildGraphQLInterfaces -- --data-api http://132.249.210.199/graphql --1d-service http://132.249.213.161/graphql

External schemas

  • DW schemas are collected from rcsb-mojave-model project released in maven.
    • rcsb-mojave-model:target/generated-sources/schema/core
  • Search API schemas are collected from the rcsb-arches git repo.
    • rcsb-arches:src/main/resources/schema
Download external schemas
  • DW schemas
    • npm run downloadDwSchemas -- --schema-version <VERSION-TAG>
    • E.g. npm run downloadDwSchemas -- --schema-version 1.32.1-MODELS-SNAPSHOT
  • Search schemas
    • npm run downloadSearchSchemas -- --branch-name <GIT-REMOTE-BRANCH-NAME>
    • E.g. npm run downloadSearchSchemas -- --branch-name dev-computed-models