Skip to content

does pybedtools closest support multiple databases like bedtools? #163

@xguse

Description

@xguse

I am trying to run something like this:

$ cat a.bed
chr1  10  20  a1  1 -

$ cat b1.bed
chr1  5   6   b1.1  1 -
chr1  30  40  b1.2  2 +

$ cat b2.bed
chr1  0   1   b2.1  1 -
chr1  21  22  b2.2  2 +



$ bedtools closest -a a.bed -b b1.bed b2.bed -mdb each -d
chr1  10  20  a1  1 - 1 chr1  5   6   b1.1  1 - 5
chr1  10  20  a1  1 - 2 chr1  21  22  b2.2  2 + 2

This is what I am doing:

k_nearest = snp_bed.closest([gene_model_subtracted_bed, genes_only_sorted_bed],
                                k=k_number,
                                names=['novel_mapped_tx', 'official_annotations'],
                                D='ref',    # Include SIGNED distances from SNP based on the ref genome
                                t='all',    # Return all members of a distance "tie"
                                mdb='each', # Return `k_number` of neighboors for EACH `names`
                                )

This is the error I am getting:

pybedtools.helpers.BEDToolsError:
Command was:

        bedtools closest -t all -names novel_mapped_tx official_annotations -mdb each -k 10 -b /tmp/pybedtools.eieijdz9.tmp -a snp_bed.bed -D ref

Error message was:

***** ERROR: Number of database name tags given does not match number of databases. *****

Is it possible to give multiple "B" files in pybedtools? It seems to enforce that only a single *arg is passed.

Any help would be awesome!

Gus

PS: I also tried just passing in a string with the two file paths, but it tried to open them as if it were a single path declaration which borks of course.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions