tools.shiftPisa

Help Info

Slide pisa data to turn endpoint-based pisa data into midpoints.

usage: shiftPisa [-h] [--pisa PISA] [--pisa5 PISA5]
                 [--pisa3 PISA3] [--mnase]
                 [--amount AMOUNT] [--out OUT]

Named Arguments

--pisa

The name of the file to shift. Cannot be used with –pisa5 and –pisa3

--pisa5

The first (5’) pisa hdf5, for –mnase.

--pisa3

The second (3’) pisa hdf5, for –mnase.

--mnase

Perform the +79, -80 shift that is recommended for mnase

Default: False

--amount

How much should the input be shifted? Cannot be used with –pisa5, –pisa3, or –mnase.

--out

The name of the hdf5 file to save.

Usage

A little tool to shift pisa values in hdf5 files.

bpreveal.tools.shiftPisa.shiftPisa(dats, offset)

Shift a (2D) PISA array.

Parameters:
  • dats (ndarray[tuple[int, ...], dtype[float16]])

  • offset (int)

Return type:

ndarray[tuple[int, …], dtype[float16]]

bpreveal.tools.shiftPisa.shiftPredictions(preds, offset)

Shift an array of predictions.

Parameters:
  • preds (ndarray[tuple[int, ...], dtype[float32]])

  • offset (int)

Return type:

ndarray[tuple[int, …], dtype[float32]]

bpreveal.tools.shiftPisa.getMask(dats, offset, coords, chroms)

After the data are shifted, which spaces in the output will still be valid?

Parameters:
  • dats (ndarray[tuple[int, ...], dtype[float16]]) – The pisa data. These are just used to load the shape.

  • offset (int) – The offset being applied.

  • coords (ndarray[tuple[int, ...], dtype[_ScalarType_co]] | None) – The genomic coordinates of each row in dats. If a coordinate discontinuity is detected, then values near that discontinuity are masked out.

  • chroms (ndarray[tuple[int, ...], dtype[_ScalarType_co]] | None) – What chromosome (number) is each row in dats on? If the chromosome changes, then values near that discontinuity are masked out.

Returns:

An array of ones and zeroes. Areas that are one are valid to use for more and areas with zeros are not valid pisa data after shifting.

Return type:

ndarray[tuple[int, …], dtype[_ScalarType_co]]

bpreveal.tools.shiftPisa.doShift(pisaFnames, shifts, outFname)

Actually apply the shift.

Parameters:
  • pisaFnames (list[str]) – The names of the hdf5-format files to shift.

  • shifts (list[int]) – The integer shift amounts.

  • outFname (str) – The name of the (single) hdf5-format file to write.

Return type:

None

bpreveal.tools.shiftPisa.getParser()

Generate (but don’t parse_args()) the argument parser.

Return type:

ArgumentParser

bpreveal.tools.shiftPisa.main()

Do the shifting.

Return type:

None