lengthCalc

Help Info

Calculates the input sequence length required to run BPReveal for a given configuration and output length. The required length is written to stdout.

usage: lengthCalc [-h] [--output-len OL] [--input-len IL]
                  --n-dil-layers NL
                  [--initial-convolution-widths ICW [ICW ...]]
                  [--conv1-kernel-size C1KS]
                  --profile-kernel-size PKS [--verbose]

Named Arguments

--output-len, --output-length

The length of the output profile that is to be predicted. If specified, the returned value will be the required input sequence length. Exactly one of –input-len or –output-len must be specified.

--input-len, --input-length

The length of the input sequence for which profiles will be predicted. If specified, the returned value is the length of the predicted profile. If no profile can be predicted, the program will print a negative number and throw an error. Exactly one of –input-len or –output-len must be specified.

--n-dil-layers, --layers

The number of diluted convolutional layers in the network, typically on the order of 10.

--initial-convolution-widths

A (space delimited) list of widths of the convolutions at the top of the network. Mutually exclusive with –conv1-kernel-size, since –conv1-kernel-size N is equivalent to –initial-convolution-widths N

--conv1-kernel-size, --input-filter-width

The size of the first convolution in the network, typically on the order of 25

--profile-kernel-size, --output-filter-width

The width of the final convolutional filter in the output heads, typically on the order of 75.

--verbose

Display the receptive field at each level of the network

Default: False

Usage

A utility to calculate the input and output length of BPReveal models.

bpreveal.lengthCalc.getParser()

Command line arguments for the length_calc script.

Return type:

ArgumentParser

bpreveal.lengthCalc.getLengthDifference(numDilLayers, initialConvolutionWidths, profileKernelSize, verbose)

Determine the padding on each size of the output.

Given a BPNet architecture, calculate how much longer the input sequence will be than the predicted profile.

Parameters:
  • numDilLayers (int) – The number of dilated convolutional layers in BPNet.

  • initialConvolutionWidths (list[int]) – The widths of the convolutional kernels preceding the dilated convolutions. In the original BPNet, this was a single layer of width 25, so this argument would be [25].

  • profileKernelSize (int) – The width of the final kernel that generates the profiles, typically around 75.

  • verbose (bool) – Should the code tell you what it’s doing?

Returns:

An integer representing the number of extra bases in the input compared to the length of the predicted profile. Divide by two to get the overhang on each side of the input.

bpreveal.lengthCalc.getOutputLength(seqLen, numDilLayers, initialConvolutionWidths, profileKernelSize, verbose)

Determine how long the output will be.

Given a BPNet architecture and a length of the input sequence, calculate the length of the predicted profile.

Parameters:
  • seqLen (int) – : The length of the input sequence, in bp.

  • numDilLayers (int) – : The number of dilated convolutional layers in BPNet.

  • initialConvolutionWidths (list[int]) – : The widths of the convolutional kernels preceding the dilated convolutions. In the original BPNet, this was a single layer of width 25, so this argument would be [25].

  • profileKernelSize (int) – : The width of the final kernel that generates the profiles, typically around 75.

  • verbose (bool) – Should the code tell you what it’s doing?

Returns:

An integer representing the length of the profile that will be calculated. If this value is zero or lower, then no bases will have their profile predicted and the model is invalid.

bpreveal.lengthCalc.getInputLength(outPredLen, numDilLayers, initialConvolutionWidths, profileKernelSize, verbose)

Given an output length, calculate input length.

Given a BPNet architecture and a length of the output profile, calculate the length of the input sequence necessary to get that profile..

Parameters:
  • outPredLen (int) – : The length of the output profile, in bp.

  • numDilLayers (int) – : The number of dilated convolutional layers in BPNet.

  • initialConvolutionWidths (list[int]) – : The widths of the convolutional kernels preceding the dilated convolutions. In the original BPNet, this was a single layer of width 25, so this argument would be [25].

  • profileKernelSize (int) – : The width of the final kernel that generates the profiles, typically around 75.

  • verbose (bool) – Should the code tell you what it’s doing?

Returns:

An integer representing the length of the sequence necessary to calculate the profile.

bpreveal.lengthCalc.lengthCalcMain()

Run the calculation.