tools.bestMotifsOnly

Help Info

Read in a tsv file from the motif scanner and limit each position to only have one motif.

usage: bestMotifsOnly [-h] [--column COLUMN]
                      [--in-tsv INTSV] [--in-bed INBED]
                      [--out-bed OUTBED]
                      [--out-tsv OUTTSV] [--match-names]
                      [--verbose]

Named Arguments

--column

The name of the tsv column that should be used to compare two called motifs to see which one is better. (Beds should use the score column to compare.)

Default: “score”

--in-tsv

The input file, in TSV format. One of –input-tsv or –input-bed is required

--in-bed

The input file, in bed format. One of –input-tsv or –input-bed is required

--out-bed

(Optional) The name of the output file, in bed format.

--out-tsv

(Optional) The name of the output file, in tsv format. Cannot be used with –in-bed.

--match-names

If provided, then only compare motifs with the same name. Overlapping motifs will only be removed if there is a better instance of a motif with the same name at that locus.

Default: False

--verbose

Show progress.

Default: False

Usage

Read in a tsv file from motif scanning and remove overlapping motifs.

For each position, if there are two motifs that claim it, remove the motif with a lower value in the specified score.

bpreveal.tools.bestMotifsOnly.getParser()

Generates the parser, but does not call parse_args().

Return type:

ArgumentParser

bpreveal.tools.bestMotifsOnly.removeOverlaps(entries, colName, nameCol)

Scan over the (sorted) motif hits and keep the best ones.

Parameters:
  • entries (list[dict]) – A list of motif tsv (or bed) entries. This is a dict keyed by column name.

  • colName (str) – The name of the column used to make comparisons, like score.

  • nameCol (str | None) – The name of the column used to check to see if motifs have the same name, for example short_name. If None, then don’t compare motifs by name, and only return the single best hit at each locus.

Returns:

A list of entries, of the same type as the input entries.

Return type:

list[dict]

bpreveal.tools.bestMotifsOnly.main()

Run the culling algorithm.