Skip to content

Commit

Permalink
Fix BAM header parsing failing on refNames containing a colon (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin authored Feb 20, 2024
1 parent 6e2d490 commit 37aded4
Show file tree
Hide file tree
Showing 7 changed files with 1,706 additions and 1,817 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ on: push

jobs:
test:
name: Lint, build, and test on node 16.x and ubuntu-latest
name: Lint, build, and test on node 20.x and ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16.x
- name: Use Node.js 20.x
uses: actions/setup-node@v1
with:
node-version: 16.x
node-version: 20.x
- name: Install deps (with cache)
uses: bahmutov/npm-install@v1
- name: Lint codebase
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@
"devDependencies": {
"@types/jest": "^29.5.1",
"@types/long": "^4.0.0",
"@types/node": "^18.16.0",
"@typescript-eslint/eslint-plugin": "^5.59.6",
"@typescript-eslint/parser": "^5.59.6",
"@types/node": "^20.11.19",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"eslint": "^8.40.0",
"eslint-config-prettier": "^8.7.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-unicorn": "^47.0.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-unicorn": "^51.0.1",
"jest": "^29.5.0",
"jest-fetch-mock": "^3.0.3",
"prettier": "^2.8.8",
"prettier": "^3.2.5",
"rimraf": "^5.0.0",
"standard-changelog": "^2.0.27",
"standard-changelog": "^5.0.0",
"ts-jest": "^29.1.0",
"typescript": "^5.0.4"
},
Expand Down
1 change: 0 additions & 1 deletion src/record.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-empty-function */
import Constants from './constants'

const SEQRET_DECODER = '=ACMGRSVTWYHKDBN'.split('')
Expand Down
4 changes: 3 additions & 1 deletion src/sam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ export function parseHeaderText(text: string) {
data.push({
tag: tag.slice(1),
data: fields.map(f => {
const [fieldTag, value] = f.split(':', 2)
const r = f.indexOf(':')
const fieldTag = f.slice(0, r)
const value = f.slice(r + 1)
return { tag: fieldTag, value }
}),
})
Expand Down
2 changes: 1 addition & 1 deletion test/__snapshots__/bai.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ exports[`check ecoli header and records 1`] = `
},
{
"tag": "DT",
"value": "2012-01-31T10",
"value": "2012-01-31T10:30:14",
},
],
"tag": "RG",
Expand Down
4 changes: 2 additions & 2 deletions test/htsget.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ xdescribe('htsspec htsget wtsi', () => {

const result = fs.readFileSync('test/htsget/result.json', 'utf8')

test('dnanexus with mock', async () => {
xtest('dnanexus with mock', async () => {
fetchMock.mockIf(
'http://htsnexus.rnd.dnanex.us/v1/reads/BroadHiSeqX_b37/NA12878?referenceName=na&class=header',
result,
Expand All @@ -46,7 +46,7 @@ test('dnanexus with mock', async () => {
expect(records.length).toBe(39)
})

test('dnanexus without mock', async () => {
xtest('dnanexus without mock', async () => {
const ti = new HtsgetFile({
baseUrl: 'http://htsnexus.rnd.dnanex.us/v1/reads',
trackId: 'BroadHiSeqX_b37/NA12878',
Expand Down
Loading

0 comments on commit 37aded4

Please sign in to comment.