New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@rcsb/rcsb-api-tools

Package Overview
Dependencies
Maintainers
4
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rcsb/rcsb-api-tools

RCSB Saguaro Web API is an open-source library that includes different tools to validate and request data from the [1D Coordinate Server](https://1d-coordinates.rcsb.org), the [RCSB Data API](https://data.rcsb.org) and the [RCSB Search Service](https://s

  • 2.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
20
decreased by-65.52%
Maintainers
4
Weekly downloads
 
Created
Source

rcsb-api-tools

RCSB Saguaro Web API is an open-source library that includes different tools to validate and request data from the 1D Coordinate 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("borrego"|"yosemity"|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!){
     alignment(
         queryId:$queryId
         from:$from
         to:$to
         range:$range
     ){
         query_sequence
         target_alignment {
             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 {CoreEntry, RcsbEntryContainerIdentifiers} from "@rcsb/rcsb-api-tools/build/RcsbGraphQL/Types/Yosemite/GqlTypes";

1d-coordinates/borrego server

E.g. import {AnnotationFeatures, Feature, AlignmentResponse} from "@rcsb/rcsb-api-tools/build/RcsbGraphQL/Types/Borrego/GqlTypes";

GRphQL query validation

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

Requesting RCSB Search data

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

const client = new SearchRequest();

client.request(query_object);

Example
import {SearchQuery} from "@rcsb/rcsb-api-tools/build/RcsbSearch/Types/SearchQueryInterface";
import {LogicalOperator, ReturnType, Service, Type} from "@rcsb/rcsb-api-tools/build/RcsbSearch/Types/SearchEnums";
import {RcsbSearchMetadata} from "@rcsb/rcsb-api-tools/build/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/build/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/build/RcsbSearch/Types/SearchEnums";

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

FAQs

Package last updated on 22 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc