bigBedNamedItems file.bb name output.bed
This tool is part of UCSC Genome Browser's utilities.
In the following example, we will extract a record named rs6657048 from the input bigBed file (dbSnp153.bb):
$ bigBedNamedItems dbSnp153.bb rs6657048 stdout chr1 1022259 1022260 rs6657048 C 1 T, 0 12 0.0327476,0.0181309,0.030366,0.0201581,-inf,0.0262923,0.0317546,0.0127232,0.0142709,0.00997843,0.01,0.0147059, C,C,C,C,,C,C,C,C,C,C,C, T,T,T,T,,T,T,T,T,T,T,T, 1819 snv clinvar,clinvarBenign,commonSome,rareSome,overlapDiffClass, 53759991835 617
If you want to retrieve records by more than one criteria, you can set the -nameFile option. In the following example, you can retrieve all variants with rs# IDs in file myIds.txt
bigBedNamedItems -nameFile dbSnp153.bb myIds.txt dbSnp153.myIds.bed
By default bigBedNamedItems finds matches in the name field, if you want to query a different field, you can specify the -field option. In the following example, we will retrieve all records from the input bigBed file (ccre.bb) where the records have dELS in the field called encodeLabel:
$ bigBedNamedItems -field=encodeLabel
ccre.bb dELS stdout | head
chr15 63475839 63476047 EH38E1769144 208 . 63475839 63476047 255,205,0 dELS,CTCF-bound dELS 2.08989283126 enhD E1769144 EH38E1769144 distal enhancer-like signature
chr15 63476209 63476559 EH38E1769145 526 . 63476209 63476559 255,205,0 dELS dELS 5.26807680919 enhD E1769145 EH38E1769145 distal enhancer-like signature
chr15 63476570 63476755 EH38E1769146 353 . 63476570 63476755 255,205,0 dELS,CTCF-bound dELS 3.53008748925 enhD E1769146 EH38E1769146 distal enhancer-like signature
chr15 63478100 63478278 EH38E1769147 255 . 63478100 63478278 255,205,0 dELS dELS 2.55437821217 enhD E1769147 EH38E1769147 distal enhancer-like signature
chr15 63479657 63480007 EH38E1769149 724 . 63479657 63480007 255,205,0 dELS,CTCF-bound dELS 7.24512266895 enhD E1769149 EH38E1769149 distal enhancer-like signature
chr15 63480513 63480686 EH38E1769150 306 . 63480513 63480686 255,205,0 dELS,CTCF-bound dELS 3.0673872344 enhD E1769150 EH38E1769150 distal enhancer-like signature
chr15 63480788 63481138 EH38E1769151 265 . 63480788 63481138 255,205,0 dELS,CTCF-bound dELS 2.65695408956 enhD E1769151 EH38E1769151 distal enhancer-like signature
chr15 63481161 63481434 EH38E1769152 480 . 63481161 63481434 255,205,0 dELS dELS 4.80043098947 enhD E1769152 EH38E1769152 distal enhancer-like signature
chr15 63482932 63483244 EH38E1769155 405 . 63482932 63483244 255,205,0 dELS dELS 4.05419796646 enhD E1769155 EH38E1769155 distal enhancer-like signature
chr15 63483521 63483693 EH38E1769156 376 . 63483521 63483693 255,205,0 dELS dELS 3.7647196654 enhD E1769156 EH38E1769156 distal enhancer-like signature
If you want to know all fields in a bigBed file, you can use bigBedSummary
:
$ bigBedSummary -fields ccre.bb 9 bed definition fields, 15 total fields chrom Reference sequence chromosome or scaffold chromStart Start position of feature on chromosome chromEnd End position of feature on chromosome name ENCODE accession score 0-1000, based on Z score strand n/a thickStart Start position thickEnd End position reserved RGB Color ccre ENCODE classification encodeLabel ENCODE label zScore Max DNase Z-score ucscLabel UCSC label accessionLabel Accession (abbreviated) description Description for browser hover
If the field that you want to query is not indexed, you will encounter error messages like
$ bigBedNamedItems -field=encodeLabel encodeCcreCombined.bb dELS stdout | head encodeCcreCombined.bb has no indexes
In this case, you can first convert the bigBed back to bed format with bigBedToBed
and then use bedToBigBed
with the -extraIndex option to add additional indexes to the bigBed file.
$ bigBedToBed encodeCcreCombined.bb enC.bed $ bedToBigBed -tab -as=ccre.as -type=bed9+6 -extraIndex=encodeLabel enC.bed hg38.chrom.size ccre.bb