Comparing version 2.1.2 to 2.1.3
@@ -1,5 +0,9 @@ | ||
## [2.1.2](https://github.com/GMOD/bed-js/compare/v2.1.1...v2.1.2) (2022-07-24) | ||
## [2.1.3](https://github.com/GMOD/bed-js/compare/v2.1.2...v2.1.3) (2024-3-25) | ||
- Fix autoSql with comments in column names | ||
## [2.1.2](https://github.com/GMOD/bed-js/compare/v2.1.1...v2.1.2) (2022-07-24) | ||
- Add comment string to autoSql types | ||
@@ -33,3 +37,4 @@ | ||
- Allow for badly formatted comments not entirely within a quote, was exhibited by https://hgdownload.soe.ucsc.edu/gbdb/hg19/gnomAD/pLI/pliByGene.bb | ||
- Allow for badly formatted comments not entirely within a quote, was exhibited | ||
by https://hgdownload.soe.ucsc.edu/gbdb/hg19/gnomAD/pLI/pliByGene.bb | ||
@@ -44,3 +49,4 @@ ## [2.0.3](https://github.com/GMOD/bed-js/compare/v2.0.2...v2.0.3) (2020-07-09) | ||
- Small autoSql grammar improvements e.g. allow \_ in autoSql names (for `_mouseover` from ucsc) | ||
- Small autoSql grammar improvements e.g. allow \_ in autoSql names (for | ||
`_mouseover` from ucsc) | ||
@@ -59,9 +65,13 @@ <a name="2.0.1"></a> | ||
- Remove snake case of results | ||
- Returned values match autoSql very faithfully and uses the naming from UCSC e.g. exact strings from autoSql {chrom, chromStart, chromEnd} | ||
- Accepts a opts.uniqueId for the parseLine method which adds this to the featureData | ||
- Parses the default BED schema with a defaultBedSchema.as autoSql definition instead of a separate method | ||
- Returned values match autoSql very faithfully and uses the naming from UCSC | ||
e.g. exact strings from autoSql {chrom, chromStart, chromEnd} | ||
- Accepts a opts.uniqueId for the parseLine method which adds this to the | ||
featureData | ||
- Parses the default BED schema with a defaultBedSchema.as autoSql definition | ||
instead of a separate method | ||
## [1.0.4](https://github.com/GMOD/bed-js/compare/v1.0.3...v1.0.4) (2019-04-14) | ||
- Changed parseBedText to accept an Options argument with offset and optionally a uniqueId | ||
- Changed parseBedText to accept an Options argument with offset and optionally | ||
a uniqueId | ||
@@ -68,0 +78,0 @@ ## [1.0.3](https://github.com/GMOD/bed-js/compare/v1.0.2...v1.0.3) (2019-04-02) |
@@ -1,2 +0,1 @@ | ||
import BED from './parser'; | ||
export default BED; | ||
export { default } from './parser'; |
@@ -6,4 +6,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var parser_1 = __importDefault(require("./parser")); | ||
exports.default = parser_1.default; | ||
exports.default = void 0; | ||
var parser_1 = require("./parser"); | ||
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(parser_1).default; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -11,5 +11,3 @@ import { AutoSqlSchema } from './util'; | ||
uniqueId?: string; | ||
}): { | ||
[key: string]: any; | ||
}; | ||
}): Record<string, any>; | ||
} |
@@ -67,3 +67,3 @@ "use strict"; | ||
if (arrayIsNumeric) { | ||
columnVal = columnVal.map(function (str) { return Number(str); }); | ||
columnVal = columnVal.map(Number); | ||
} | ||
@@ -70,0 +70,0 @@ } |
@@ -20,2 +20,2 @@ export interface AutoSqlPreSchema { | ||
}; | ||
export declare type AutoSqlSchema = ReturnType<typeof detectTypes>; | ||
export type AutoSqlSchema = ReturnType<typeof detectTypes>; |
@@ -25,6 +25,9 @@ "use strict"; | ||
function detectTypes(autoSql) { | ||
var numericTypes = ['uint', 'int', 'float', 'long']; | ||
return __assign(__assign({}, autoSql), { fields: autoSql.fields.map(function (autoField) { return (__assign(__assign({}, autoField), { isArray: autoField.size && autoField.type !== 'char', arrayIsNumeric: autoField.size && numericTypes.includes(autoField.type), isNumeric: !autoField.size && numericTypes.includes(autoField.type) })); }) }); | ||
var numericTypes = new Set(['uint', 'int', 'float', 'long']); | ||
return __assign(__assign({}, autoSql), { fields: autoSql.fields | ||
.map(function (autoField) { return (__assign(__assign({}, autoField), { isArray: autoField.size && autoField.type !== 'char', arrayIsNumeric: autoField.size && numericTypes.has(autoField.type), isNumeric: !autoField.size && numericTypes.has(autoField.type) })); }) | ||
// this is needed because the autoSql doesn't properly parse comments in the autoSql | ||
.filter(function (f) { return !!f.name; }) }); | ||
} | ||
exports.detectTypes = detectTypes; | ||
//# sourceMappingURL=util.js.map |
@@ -1,2 +0,1 @@ | ||
import BED from './parser'; | ||
export default BED; | ||
export { default } from './parser'; |
@@ -1,3 +0,2 @@ | ||
import BED from './parser'; | ||
export default BED; | ||
export { default } from './parser'; | ||
//# sourceMappingURL=index.js.map |
@@ -11,5 +11,3 @@ import { AutoSqlSchema } from './util'; | ||
uniqueId?: string; | ||
}): { | ||
[key: string]: any; | ||
}; | ||
}): Record<string, any>; | ||
} |
@@ -60,3 +60,3 @@ import parser from './autoSql'; | ||
if (arrayIsNumeric) { | ||
columnVal = columnVal.map((str) => Number(str)); | ||
columnVal = columnVal.map(Number); | ||
} | ||
@@ -63,0 +63,0 @@ } |
@@ -20,2 +20,2 @@ export interface AutoSqlPreSchema { | ||
}; | ||
export declare type AutoSqlSchema = ReturnType<typeof detectTypes>; | ||
export type AutoSqlSchema = ReturnType<typeof detectTypes>; |
@@ -11,13 +11,16 @@ /* | ||
export function detectTypes(autoSql) { | ||
const numericTypes = ['uint', 'int', 'float', 'long']; | ||
const numericTypes = new Set(['uint', 'int', 'float', 'long']); | ||
return { | ||
...autoSql, | ||
fields: autoSql.fields.map(autoField => ({ | ||
fields: autoSql.fields | ||
.map(autoField => ({ | ||
...autoField, | ||
isArray: autoField.size && autoField.type !== 'char', | ||
arrayIsNumeric: autoField.size && numericTypes.includes(autoField.type), | ||
isNumeric: !autoField.size && numericTypes.includes(autoField.type), | ||
})), | ||
arrayIsNumeric: autoField.size && numericTypes.has(autoField.type), | ||
isNumeric: !autoField.size && numericTypes.has(autoField.type), | ||
})) | ||
// this is needed because the autoSql doesn't properly parse comments in the autoSql | ||
.filter(f => !!f.name), | ||
}; | ||
} | ||
//# sourceMappingURL=util.js.map |
{ | ||
"name": "@gmod/bed", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "A BED file format parser with autoSql support", | ||
@@ -41,16 +41,17 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@types/jest": "^28.1.6", | ||
"@typescript-eslint/eslint-plugin": "^5.30.7", | ||
"@typescript-eslint/parser": "^5.30.7", | ||
"eslint": "^8.20.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"jest": "^28.1.3", | ||
"@types/jest": "^29.5.1", | ||
"@typescript-eslint/eslint-plugin": "^7.3.1", | ||
"@typescript-eslint/parser": "^7.3.1", | ||
"eslint": "^8.40.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"eslint-plugin-unicorn": "^51.0.1", | ||
"jest": "^29.5.0", | ||
"pegjs": "^0.10.0", | ||
"prettier": "^2.7.1", | ||
"rimraf": "^3.0.2", | ||
"standard-changelog": "^2.0.24", | ||
"ts-jest": "^28.0.7", | ||
"typescript": "^4.7.4" | ||
"prettier": "^3.2.5", | ||
"rimraf": "^5.0.0", | ||
"standard-changelog": "^5.0.0", | ||
"ts-jest": "^29.1.0", | ||
"typescript": "^5.0.4" | ||
}, | ||
@@ -57,0 +58,0 @@ "keywords": [ |
# bed-js | ||
[![Coverage Status](https://img.shields.io/codecov/c/github/GMOD/bed-js/master.svg?style=flat-square)](https://codecov.io/gh/GMOD/bed-js/branch/master) | ||
[![Build Status](https://img.shields.io/github/workflow/status/GMOD/bed-js/Push/master?logo=github&style=flat-query)](https://github.com/GMOD/bed-js/actions?query=branch%3Amaster+workflow%3APush+) | ||
[![Build Status](https://img.shields.io/github/actions/workflow/status/GMOD/bed-js/push.yml?branch=master)](https://github.com/GMOD/bed-js/actions) | ||
@@ -46,3 +46,4 @@ Performs parsing of BED files including autoSql | ||
If neither autoSql or type is specified, the default BED schema is used (see [here](src/as/defaultBedSchema.as)) | ||
If neither autoSql or type is specified, the default BED schema is used (see | ||
[here](src/as/defaultBedSchema.as)) | ||
@@ -59,7 +60,9 @@ ### parseLine(line, opts) | ||
- opts.uniqueId - an indication of a uniqueId that is not encoded by the BED line itself | ||
- opts.uniqueId - an indication of a uniqueId that is not encoded by the BED | ||
line itself | ||
The default instantiation of the parser with new BED() simply parses lines | ||
assuming the fields come from the standard BED schema. | ||
Your line can just contain just a subset of the fields e.g. `chrom, chromStart, chromEnd, name, score` | ||
assuming the fields come from the standard BED schema. Your line can just | ||
contain just a subset of the fields e.g. | ||
`chrom, chromStart, chromEnd, name, score` | ||
@@ -79,3 +82,4 @@ ## Examples | ||
If you have a BED format that corresponds to a different schema, you can specify from the list of default built in schemas | ||
If you have a BED format that corresponds to a different schema, you can specify | ||
from the list of default built in schemas | ||
@@ -130,4 +134,4 @@ Specify this in the opts.type for the BED constructor | ||
- Does not parse "browser" or "track" lines and will throw an error if | ||
parseLine receives one of these | ||
- Does not parse "browser" or "track" lines and will throw an error if parseLine | ||
receives one of these | ||
- By default, parseLine parses only tab delimited text, if you want to use | ||
@@ -149,4 +153,6 @@ spaces as is allowed by UCSC then pass an array to `line` for parseLine | ||
based on https://genome-source.gi.ucsc.edu/gitlist/kent.git/blob/master/src/hg/autoSql/autoSql.doc | ||
based on | ||
https://genome-source.gi.ucsc.edu/gitlist/kent.git/blob/master/src/hg/autoSql/autoSql.doc | ||
also see http://genomewiki.ucsc.edu/index.php/AutoSql and https://www.linuxjournal.com/article/5949 | ||
also see http://genomewiki.ucsc.edu/index.php/AutoSql and | ||
https://www.linuxjournal.com/article/5949 |
@@ -1,3 +0,1 @@ | ||
import BED from './parser' | ||
export default BED | ||
export { default } from './parser' |
@@ -46,3 +46,3 @@ import parser from './autoSql' | ||
let feature = {} as { [key: string]: any } | ||
let feature = {} as Record<string, any> | ||
if ( | ||
@@ -69,3 +69,3 @@ !this.attemptDefaultBed || | ||
if (arrayIsNumeric) { | ||
columnVal = columnVal.map((str: string) => Number(str)) | ||
columnVal = columnVal.map(Number) | ||
} | ||
@@ -72,0 +72,0 @@ } |
@@ -15,11 +15,15 @@ export interface AutoSqlPreSchema { | ||
export function detectTypes(autoSql: AutoSqlPreSchema) { | ||
const numericTypes = ['uint', 'int', 'float', 'long'] | ||
const numericTypes = new Set(['uint', 'int', 'float', 'long']) | ||
return { | ||
...autoSql, | ||
fields: autoSql.fields.map(autoField => ({ | ||
...autoField, | ||
isArray: autoField.size && autoField.type !== 'char', | ||
arrayIsNumeric: autoField.size && numericTypes.includes(autoField.type), | ||
isNumeric: !autoField.size && numericTypes.includes(autoField.type), | ||
})), | ||
fields: autoSql.fields | ||
.map(autoField => ({ | ||
...autoField, | ||
isArray: autoField.size && autoField.type !== 'char', | ||
arrayIsNumeric: autoField.size && numericTypes.has(autoField.type), | ||
isNumeric: !autoField.size && numericTypes.has(autoField.type), | ||
})) | ||
// this is needed because the autoSql doesn't properly parse comments in the autoSql | ||
.filter(f => !!f.name), | ||
} | ||
@@ -26,0 +30,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
354438
5412
154
15