
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Performs parsing of BED files including autoSql
You can pipe your file through this programs parseLine function
import BED from '@gmod/bed'
// you might require compatibility with node.js to use the default export with require e.g.
// const BED = require('@gmod/bed').default
var parser = new BED()
var text = fs.readFileSync('file.txt', 'utf8')
var results = text.split('\n').map(line => parser.parseLine(line))
The BED constructor accepts an opts object with options
The predefined types can include
bigInteract
bigMaf
bigPsl
bigNarrowPeak
bigGenePred
bigLink
bigChain
mafFrames
mafSummary
If neither autoSql or type is specified, the default BED schema is used (see here)
Parses a BED line according to the currently loaded schema
string|Array<string>
- is a tab delimited line with fields from the
schema, or an array that has been pre-split by tab with those same contentsAn Options object can contain
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
const p = new BED()
p.parseLine('chr1\t0\t100')
// outputs { chrom: 'chr1', chromStart: 0, chromEnd: 100, strand: 0 }
If you have a BED format that corresponds to a different schema, you can specify from the list of default built in schemas
Specify this in the opts.type for the BED constructor
const p = new BED({ type: 'bigGenePred' })
const line = 'chr1\t11868\t14409\tENST00000456328.2\t1000\t+\t11868\t11868\t255,128,0\t3\t359,109,1189,\t0,744,1352,\tDDX11L1\tnone\tnone\t-1,-1,-1,\tnone\tENST00000456328.2\tDDX11L1\tnone'
p.parseLine(line)
// above line outputs
{ chrom: 'chr1',
chromStart: 11868,
chromEnd: 14409,
name: 'ENST00000456328.2',
score: 1000,
strand: 1,
thickStart: 11868,
thickEnd: 11868,
reserved: '255,128,0',
blockCount: 3,
blockSizes: [ 359, 109, 1189 ],
chromStarts: [ 0, 744, 1352 ],
name2: 'DDX11L1',
cdsStartStat: 'none',
cdsEndStat: 'none',
exonFrames: [ -1, -1, -1 ],
type: 'none',
geneName: 'ENST00000456328.2',
geneName2: 'DDX11L1',
geneType: 'none' }
If you have a BED format with a custom alternative schema with autoSql, or if you are using a BigBed file that contains autoSql (e.g. with @gmod/bbi then you can get it from header.autoSql) then you initialize the schema in the constructor and then use parseLine as normal
const {BigBed} = require('@gmod/bbi')
const bigbed = new BigBed({path: 'yourfile'})
const {autoSql} = await bigbed.getHeader()
const p = new BED({ autoSql })
p.parseLine(line)
// etc.
line
for parseLineThis package was written with funding from the NHGRI as part of the JBrowse project. If you use it in an academic project that you publish, please cite the most recent JBrowse paper, which will be linked from jbrowse.org.
MIT © Colin Diesh
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
FAQs
A BED file format parser with autoSql support
We found that @gmod/bed demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
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.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.