Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/npm-grunt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: NodeJS with Grunt

on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x, 22.x]

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Build
run: |
npm install
grunt
33 changes: 33 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Node.js Package

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm test

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
25 changes: 19 additions & 6 deletions sbol_utilities/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,25 @@ def convert2to3(sbol2_doc: Union[str, sbol2.Document], namespaces=None, use_nati
# TODO: remove workaround after conversion errors fixed in https://github.com/sboltools/sbolgraph/issues/14
# add in the missing namespace fields where possible, defaulting otherwise
# TODO: add check for non-TopLevel? See https://github.com/SynBioDex/pySBOL3/issues/295
needs_namespace = {o for o in doc.objects if o.namespace is None}
for n in namespaces:
assignable = {o for o in needs_namespace if o.identity.startswith(n)}
for a in assignable:
a.namespace = n
needs_namespace = needs_namespace - assignable
# Namespace Assignment
needs_namespace = {o for o in doc.objects if o.namespace is None}
for n in namespaces:
assignable = {o for o in needs_namespace if o.identity.startswith(n)}
for a in assignable:
a.namespace = n
needs_namespace = needs_namespace - assignable
for o in needs_namespace:
p = urllib.parse.urlparse(o.identity)
server = urllib.parse.urlunparse([p.scheme, p.netloc, '', '', '', ''])
o.namespace = server

# Sequence Inference
for s in (o for o in doc.objects if isinstance(o, sbol3.Component)):
if len(s.sequences) != 1:
continue
for f in (f for f in s.features if isinstance(f, sbol3.SequenceFeature) or isinstance(f, sbol3.SubComponent)):
for loc in f.locations:
loc.sequence = s.sequences[0]
for o in needs_namespace: # if no supplied namespace matches, default to scheme//netloc
# figure out the server to access from the URL
p = urllib.parse.urlparse(o.identity)
Expand Down