pytransit package — TRANSIT v2.3.2 documentation

# pytransit package

## Subpackages

- pytransit.analysis package
  - Submodules
  - pytransit.analysis.base module
  - pytransit.analysis.binomial module
  - pytransit.analysis.example module
  - pytransit.analysis.griffin module
  - pytransit.analysis.gumbel module
  - pytransit.analysis.hmm module
  - pytransit.analysis.rankproduct module
  - pytransit.analysis.resampling module
  - pytransit.analysis.tn5gaps module
  - pytransit.analysis.anova module
  - Module contents

## Submodules

## pytransit.draw_trash module

`pytransit.draw_trash.` `draw_canvas`(fulldata, position, hash, orf2data, feature_hashes, feature_data, labels=[], min_read=0, scale=[500], globalScale=False, start=1, end=500, canvas_h=-1, canvas_w=1000)

`pytransit.draw_trash.` `draw_features`(draw, GENES, orf2data, start, end, start_x, start_y, width, height)

`pytransit.draw_trash.` `draw_genes`(draw, GENES, orf2data, start, end, start_x, start_y, width, height, doTriangle=True)

`pytransit.draw_trash.` `draw_reads`(draw, reads, ta_sites, start_x=0, start_y=0, width=400, height=100, start=0, end=500, min_read=0, max_read=500, lwd=2)

`pytransit.draw_trash.` `draw_scale`(draw, start_x, start_y, height, max_read)

`pytransit.draw_trash.` `draw_ta_sites`(draw, ta_sites, start_x=0, start_y=0, width=200, height=0, start=0, end=500, lwd=2)

`pytransit.draw_trash.` `get_dynamic_height`(N)

`pytransit.draw_trash.` `normalize`(X, old_min, old_max, new_min, new_max)

## pytransit.fileDisplay module

class `pytransit.fileDisplay.` `ImgFrame`(parent, filePath)

  Bases: `wx._core.Frame`

class `pytransit.fileDisplay.` `SortableListCtrl`(parent, ID=-1, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0)

  Bases: `wx._core.ListCtrl`

class `pytransit.fileDisplay.` `TransitGridFrame`(parent, path, size=(-1, -1))

  Bases: `wx._core.Frame`

  `AutoResizeCols`()
  `OnCellRightClicked`(evt)
  `OnLabelDoubleClicked`(evt)

class `pytransit.fileDisplay.` `TransitTable`(data, colnames)

  Bases: `wx._grid.GridTableBase`

  A custom wx.Grid Table using user supplied data

  `GetColLabelValue`(col) → String

    Return the label of the specified column.

  `GetNumberCols`() → int

    Must be overridden to return the number of columns in the table.

  `GetNumberRows`() → int

    Must be overridden to return the number of rows in the table.

  `GetRawValue`(row, col)
  `GetRowLabelValue`(row) → String

    Return the label of the specified row.

  `GetValue`(row, col) → PyObject

    Must be overridden to implement accessing the table values as text.

  `SetValue`(row, col, value)

    Must be overridden to implement setting the table values as text.

  `SortColumn`(col)

`pytransit.fileDisplay.` `getInfoFromFileType`(X)

`pytransit.fileDisplay.` `unknownColNames`(path)

`pytransit.fileDisplay.` `unknownFileHeaderText`(path)

`pytransit.fileDisplay.` `unknownTableData`(path, colnames)

## pytransit.images module

## pytransit.norm_tools module

class `pytransit.norm_tools.` `AdaptiveBGCNorm`

  Bases: `pytransit.norm_tools.NormMethod`

  `cleaninfgeom`(rho)

    Returns a ‘clean’ output from the geometric distribution.

  `ecdf`(x)

    Calculates an empirical CDF of the given data.

  `name` = 'aBGC'
  static `normalize`(wigList=[], annotationPath='', doTotReads=True, bgsamples=200000)

    Returns the normalized data using the aBGC method.

    Parameters: | data (numpy array) – (K,N) numpy array defining read-counts at N sites for K datasets. doTotReads (bool) – Boolean specifying whether to do TTR normalization as well. bgsamples (int) – Integeer specifying how many samples to take.
    Returns: | Array with the normalized data.
    Return type: | numpy array
    Example: |
        >>> import pytransit.norm_tools as norm_tools
        >>> import pytransit.tnseq_tools as tnseq_tools
        >>> (data, position) = tnseq_tools.get_data(["transit/data/glycerol_H37Rv_rep1.wig", "transit/data/glycerol_H37Rv_rep2.wig"])
        >>> print data
        array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
               [ 0.,  0.,  0., ...,  0.,  0.,  0.]])
        >>> normdata = norm_tools.aBGC_norm(data)
        >>> print normdata
        array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
               [ 0.,  0.,  0., ...,  0.,  0.,  0.]])

    See also

    `normalize_data`

class `pytransit.norm_tools.` `BetaGeomNorm`

  Bases: `pytransit.norm_tools.NormMethod`

  `cleaninfgeom`(rho)

    Returns a ‘clean’ output from the geometric distribution.

  `ecdf`(x)

    Calculates an empirical CDF of the given data.

  `name` = 'betageom'
  static `normalize`(wigList=[], annotationPath='', doTTR=True, bgsamples=200000)

    Returns normalized data according to the BGC method.

    Parameters: | data (numpy array) – (K,N) numpy array defining read-counts at N sites for K datasets. doTTR (bool) – Boolean specifying whether to do TTR norm as well. bgsamples (int) – Integer specifying how many samples to take.
    Returns: | Array with the data normalized using the betageom method.
    Return type: | numpy array
    Example: |
        >>> import pytransit.norm_tools as norm_tools
        >>> import pytransit.tnseq_tools as tnseq_tools
        >>> (data, position) = tnseq_tools.get_data(["transit/data/glycerol_H37Rv_rep1.wig", "transit/data/glycerol_H37Rv_rep2.wig"])
        >>> print data
        array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
               [ 0.,  0.,  0., ...,  0.,  0.,  0.]])
        >>> normdata = norm_tools.betageom_norm(data)
        >>> print normdata
        [[ 0.  0.  0. ...,  0.  0.  0.]
         [ 0.  0.  0. ...,  0.  0.  0.]]

    See also

    `normalize_data`

class `pytransit.norm_tools.` `EmpHistNorm`

  Bases: `pytransit.norm_tools.NormMethod`

  static `Fzinfnb`(args)

    Objective function for the zero-inflated NB method.

  `name` = 'emphist'
  static `normalize`(wigList=[], annotationPath='')

    Returns the normalized data, using the empirical hist method.

    Parameters: | wigList (list) – List of paths to wig formatted datasets. annotationPath (str) – Path to annotation in .prot_table or GFF3 format.
    Returns: | Array with the normalization factors for the emphist method.
    Return type: | numpy array
    Example: |
        >>> import pytransit.norm_tools as norm_tools
        >>> import pytransit.tnseq_tools as tnseq_tools
        >>> (data, position) = tnseq_tools.get_data(["transit/data/glycerol_H37Rv_rep1.wig", "transit/data/glycerol_H37Rv_rep2.wig"])
        >>> print data
        array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
               [ 0.,  0.,  0., ...,  0.,  0.,  0.]])
        >>> factors = norm_tools.emphist_factors(["transit/data/glycerol_H37Rv_rep1.wig", "transit/data/glycerol_H37Rv_rep2.wig"], "transit/genomes/H37Rv.prot_table")
        >>> print factors
        array([[ 1.        ],
               [ 0.63464722]])

    See also

    `normalize_data`

`pytransit.norm_tools.` `Fzinfnb`(params, args)

  Objective function for the zero-inflated NB method.

class `pytransit.norm_tools.` `NZMeanNorm`

  Bases: `pytransit.norm_tools.NormMethod`

  `name` = 'nzmean'
  static `normalize`(wigList=[], annotationPath='')

    Returns the normalization factors for the data, using the NZMean method.

    Parameters: | data (numpy array) – (K,N) numpy array defining read-counts at N sites for K datasets.
    Returns: | Array with the normalization factors for the nzmean method.
    Return type: | numpy array
    Example: |
        >>> import pytransit._tools.norm_tools as norm_tools
        >>> import pytransit.tnseq_tools as tnseq_tools
        >>> (data, position) = tnseq_tools.get_data(["transit/data/glycerol_H37Rv_rep1.wig", "transit/data/glycerol_H37Rv_rep2.wig"])
        >>> print data
        array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
               [ 0.,  0.,  0., ...,  0.,  0.,  0.]])
        >>> factors = norm_tools.nzmean_factors(data)
        >>> print factors
        array([[ 1.14836149],
               [ 0.88558737]])

    See also

    `normalize_data`

class `pytransit.norm_tools.` `NoNorm`

  Bases: `pytransit.norm_tools.NormMethod`

  `name` = 'nonorm'
  static `normalize`(wigList=[], annotationPath='')

class `pytransit.norm_tools.` `NormMethod`
  `name` = 'undefined'
  static `normalize`()

class `pytransit.norm_tools.` `QuantileNorm`

  Bases: `pytransit.norm_tools.NormMethod`

  `name` = 'quantile'
  static `normalize`(wigList=[], annotationPath='')

    Performs Quantile Normalization as described by Bolstad et al. 2003

    Parameters: | data (numpy array) – (K,N) numpy array defining read-counts at N sites for K datasets.
    Returns: | Array with the data normalized by the quantile normalization method.
    Return type: | numpy array
    Example: |
        >>> import pytransit.norm_tools as norm_tools
        >>> import pytransit.tnseq_tools as tnseq_tools
        >>> (data, position) = tnseq_tools.get_data(["transit/data/glycerol_H37Rv_rep1.wig", "transit/data/glycerol_H37Rv_rep2.wig"])
        >>> print data
        array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
               [ 0.,  0.,  0., ...,  0.,  0.,  0.]])
        >>> normdata = norm_tools.quantile_norm(data)
        >>> print normdata

    See also

    `normalize_data`

class `pytransit.norm_tools.` `TTRNorm`

  Bases: `pytransit.norm_tools.NormMethod`

  `empirical_theta`()

    Calculates the observed density of the data.

    This is used as an estimate insertion density by some normalization methods. May be improved by more sophisticated ways later on.

    Parameters: | data (numpy array) – numpy array defining read-counts at N sites.
    Returns: | Density of the given dataset.
    Return type: | float
    Example: |
        >>> import pytransit.tnseq_tools as tnseq_tools
        >>> import pytransit.norm_tools as norm_tools
        >>> (data, position) = tnseq_tools.get_data(["transit/data/glycerol_H37Rv_rep1.wig", "transit/data/glycerol_H37Rv_rep2.wig"])
        >>> print data
        array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
               [ 0.,  0.,  0., ...,  0.,  0.,  0.]])
        >>> theta = norm_tools.empirical_theta(data)
        >>> print theta
        0.467133570136

    See also

    `TTR_factors`

  `name` = 'emphist'
  static `normalize`(wigList=[], annotationPath='', thetaEst=<function empirical_theta>, muEst=<function trimmed_empirical_mu>, target=100.0)

    Returns the normalization factors for the data, using the TTR method.

    Parameters: | data (numpy array) – (K,N) numpy array defining read-counts at N sites for K datasets. thetaEst (function) – Function used to estimate density. Should take a list of counts as input. muEst (function) – Function used to estimate mean count. Should take a list of counts as input.
    Returns: | Array with the normalization factors for the TTR method.
    Return type: | numpy array
    Example: |
        >>> import pytransit.norm_tools as norm_tools
        >>> import pytransit.tnseq_tools as tnseq_tools
        >>> (data, position) = tnseq_tools.get_data(["transit/data/glycerol_H37Rv_rep1.wig", "transit/data/glycerol_H37Rv_rep2.wig"])
        >>> print data
        array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
               [ 0.,  0.,  0., ...,  0.,  0.,  0.]])
        >>> factors = norm_tools.TTR_factors(data)
        >>> print factors
        array([[ 1.        ],
               [ 0.62862886]])

    See also

    `normalize_data`

  `trimmed_empirical_mu`(t=0.05)

    Estimates the trimmed mean of the data.

    This is used as an estimate of mean count by some normalization methods. May be improved by more sophisticated ways later on.

    Parameters: | data (numpy array) – numpy array defining read-counts at N sites. t (float) – Float specifying fraction of start and end to trim.
    Returns: | (Trimmed) Mean of the given dataset.
    Return type: | float
    Example: |
        >>> import pytransit.tnseq_tools as tnseq_tools
        >>> import pytransit.norm_tools as norm_tools
        >>> (data, position) = tnseq_tools.get_data(["transit/data/glycerol_H37Rv_rep1.wig", "transit/data/glycerol_H37Rv_rep2.wig"])
        >>> print data
        array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
               [ 0.,  0.,  0., ...,  0.,  0.,  0.]])
        >>> mu = norm_tools.trimmed_empirical_mu(data)
        >>> print mu
        120.73077107

    See also

    `TTR_factors`

class `pytransit.norm_tools.` `TotReadsNorm`

  Bases: `pytransit.norm_tools.NormMethod`

  `name` = 'totreads'
  static `normalize`(wigList=[], annotationPath='')

    Returns the normalization factors for the data, using the total reads method.

    Parameters: | data (numpy array) – (K,N) numpy array defining read-counts at N sites for K datasets.
    Returns: | Array with the normalization factors for the totreads method.
    Return type: | numpy array
    Example: |
        >>> import pytransit.norm_tools as norm_tools
        >>> import pytransit.tnseq_tools as tnseq_tools
        >>> (data, position) = tnseq_tools.get_data(["transit/data/glycerol_H37Rv_rep1.wig", "transit/data/glycerol_H37Rv_rep2.wig"])
        >>> print data
        array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
               [ 0.,  0.,  0., ...,  0.,  0.,  0.]])
        >>> factors = norm_tools.totreads_factors(data)
        >>> print factors
        array([[ 1.2988762],
               [ 0.8129396]])

    See also

    `normalize_data`

class `pytransit.norm_tools.` `ZeroInflatedNBNorm`

  Bases: `pytransit.norm_tools.NormMethod`

  `name` = 'zinfb'
  static `normalize`(wigList=[], annotationPath='')

    Returns the normalization factors for the data using the zero-inflated negative binomial method.

    Parameters: | data (numpy array) – (K,N) numpy array defining read-counts at N sites for K datasets.
    Returns: | Array with the normalization factors for the zinfnb method.
    Return type: | numpy array
    Example: |
        >>> import pytransit.norm_tools as norm_tools
        >>> import pytransit.tnseq_tools as tnseq_tools
        >>> (data, position) = tnseq_tools.get_data(["transit/data/glycerol_H37Rv_rep1.wig", "transit/data/glycerol_H37Rv_rep2.wig"])
        >>> print data
        array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
               [ 0.,  0.,  0., ...,  0.,  0.,  0.]])
        >>> factors = norm_tools.zinfnb_factors(data)
        >>> print factors
        [[ 0.0121883 ]
         [ 0.00747111]]

    See also

    `normalize_data`

`pytransit.norm_tools.` `cleaninfgeom`(x, rho)

  Returns a ‘clean’ output from the geometric distribution.

`pytransit.norm_tools.` `ecdf`(S, x)

  Calculates an empirical CDF of the given data.

`pytransit.norm_tools.` `empirical_theta`(X)

  Calculates the observed density of the data.

  This is used as an estimate insertion density by some normalization methods. May be improved by more sophisticated ways later on.

  Parameters: | data (numpy array) – numpy array defining read-counts at N sites.
  Returns: | Density of the given dataset.
  Return type: | float
  Example: |
      >>> import pytransit.tnseq_tools as tnseq_tools
      >>> import pytransit.norm_tools as norm_tools
      >>> (data, position) = tnseq_tools.get_data(["transit/data/glycerol_H37Rv_rep1.wig", "transit/data/glycerol_H37Rv_rep2.wig"])
      >>> print data
      array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
             [ 0.,  0.,  0., ...,  0.,  0.,  0.]])
      >>> theta = norm_tools.empirical_theta(data)
      >>> print theta
      0.467133570136

  See also

  `TTR_factors`

`pytransit.norm_tools.` `norm_to_target`(data, target)

  Returns factors to normalize the data to the given target value.

  Parameters: | data (numpy array) – (K,N) numpy array defining read-counts at N sites for K datasets. target (float) – Floating point specifying the target for the mean of the data/
  Returns: | Array with the factors necessary to normalize mean to target.
  Return type: | numpy array
  Example: |
      >>> import pytransit.norm_tools as norm_tools
      >>> import pytransit.tnseq_tools as tnseq_tools
      >>> (data, position) = tnseq_tools.get_data(["transit/data/glycerol_H37Rv_rep1.wig", "transit/data/glycerol_H37Rv_rep2.wig"])
      >>> print data
      array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
             [ 0.,  0.,  0., ...,  0.,  0.,  0.]])
      >>> factors = norm_tools.norm_to_target(data, 100)
      >>> print factors
      [[ 1.8548104 ]
       [ 1.16088726]]

  See also

  `normalize_data`

`pytransit.norm_tools.` `normalize_data`(data, method='nonorm', wigList=[], annotationPath='')

  Normalizes the numpy array by the given normalization method.

  Parameters: | data (numpy array) – (K,N) numpy array defining read-counts at N sites for K datasets. method (str) – Name of the desired normalization method. wigList (list) – List of paths for the desired wig-formatted datasets. annotationPath (str) – Path to the prot_table annotation file.
  Returns: | Array with the normalized data. list: List containing the normalization factors. Empty if not used.
  Return type: | numpy array
  Example: |
      >>> import pytransit.norm_tools as norm_tools
      >>> import pytransit.tnseq_tools as tnseq_tools
      >>> (data, position) = tnseq_tools.get_data(["transit/data/glycerol_H37Rv_rep1.wig", "transit/data/glycerol_H37Rv_rep2.wig"])
      >>> print data
      array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
             [ 0.,  0.,  0., ...,  0.,  0.,  0.]])
      (normdata, normfactors) = norm_tools.normalize_data(data, "TTR")   # Some methods require annotation and path to wig files.
      >>> print normfactors
      array([[ 1.        ],
             [ 0.62862886]])
      >> print normdata
      array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
             [ 0.,  0.,  0., ...,  0.,  0.,  0.]])

  Note

  Some normalization methods require the wigList and annotationPath arguments.

`pytransit.norm_tools.` `trimmed_empirical_mu`(X, t=0.05)

  Estimates the trimmed mean of the data.

  This is used as an estimate of mean count by some normalization methods. May be improved by more sophisticated ways later on.

  Parameters: | data (numpy array) – numpy array defining read-counts at N sites. t (float) – Float specifying fraction of start and end to trim.
  Returns: | (Trimmed) Mean of the given dataset.
  Return type: | float
  Example: |
      >>> import pytransit.tnseq_tools as tnseq_tools
      >>> import pytransit.norm_tools as norm_tools
      >>> (data, position) = tnseq_tools.get_data(["transit/data/glycerol_H37Rv_rep1.wig", "transit/data/glycerol_H37Rv_rep2.wig"])
      >>> print data
      array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
             [ 0.,  0.,  0., ...,  0.,  0.,  0.]])
      >>> mu = norm_tools.trimmed_empirical_mu(data)
      >>> print mu
      120.73077107

  See also

  `TTR_factors`

`pytransit.norm_tools.` `zinfnb_factors`(data)

  Returns the normalization factors for the data using the zero-inflated negative binomial method.

  Parameters: | data (numpy array) – (K,N) numpy array defining read-counts at N sites for K datasets.
  Returns: | Array with the normalization factors for the zinfnb method.
  Return type: | numpy array
  Example: |
      >>> import pytransit.norm_tools as norm_tools
      >>> import pytransit.tnseq_tools as tnseq_tools
      >>> (data, position) = tnseq_tools.get_data(["transit/data/glycerol_H37Rv_rep1.wig", "transit/data/glycerol_H37Rv_rep2.wig"])
      >>> print data
      array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
             [ 0.,  0.,  0., ...,  0.,  0.,  0.]])
      >>> factors = norm_tools.zinfnb_factors(data)
      >>> print factors
      [[ 0.0121883 ]
       [ 0.00747111]]

  See also

  `normalize_data`

## pytransit.qcDisplay module

`pytransit.qcDisplay.` `PilImageToWxBitmap`(myPilImage)

`pytransit.qcDisplay.` `PilImageToWxImage`(myPilImage)

`pytransit.qcDisplay.` `WxBitmapToPilImage`(myBitmap)

`pytransit.qcDisplay.` `WxBitmapToWxImage`(myBitmap)

`pytransit.qcDisplay.` `WxImageToWxBitmap`(myWxImage)

class `pytransit.qcDisplay.` `qcFrame`(parent, datasets)

  Bases: `wx._core.Frame`

  `OnClose`(event)
  `addPlots`()
  `onNormSelect`(event)
  `onStatsItemSelect`(event)
  `refresh`()
  `refreshPlots`()
  `statsSelected`(col=0)
  `updateFiles`()

## pytransit.stat_tools module

`pytransit.stat_tools.` `BH_fdr_correction`(X)

  Adjusts p-values using the Benjamini Hochberg procedure

`pytransit.stat_tools.` `FWER_Bayes`(X)

`pytransit.stat_tools.` `F_mean_diff_dict`(*args, **kwargs)

`pytransit.stat_tools.` `F_mean_diff_flat`(*args, **kwargs)

`pytransit.stat_tools.` `F_shuffle_dict_libraries`(*args, **kwargs)

`pytransit.stat_tools.` `F_shuffle_flat`(*args, **kwargs)

`pytransit.stat_tools.` `F_sum_diff_dict`(*args, **kwargs)

`pytransit.stat_tools.` `F_sum_diff_flat`(*args, **kwargs)

`pytransit.stat_tools.` `HDI_from_MCMC`(posterior_samples, credible_mass=0.95)

`pytransit.stat_tools.` `bFDR`(X)

`pytransit.stat_tools.` `bayesian_ess_thresholds`(Z_raw, ALPHA=0.05)

  Returns Essentiality Thresholds using a BH-like procedure

`pytransit.stat_tools.` `binom`(k, n, p)

  Binomial distribution. Uses Normal approximation for large ‘n’

`pytransit.stat_tools.` `binom_cdf`(k, n, p)

  CDF of the binomial distribution

`pytransit.stat_tools.` `binom_test`(k, n, p, type='two-sided')

  Does a binomial test given success, trials and probability.

`pytransit.stat_tools.` `boxcoxTable`(X, minlambda, maxlambda, dellambda)

  Returns a table of (loglik function, lambda) pairs for the data.

`pytransit.stat_tools.` `boxcoxtransform`(x, lambdax)

  Performs a box-cox transformation to data vector X. WARNING: elements of X should be all positive! Fixed: ‘>’ has changed to ‘<’

`pytransit.stat_tools.` `comb`(n, k)

`pytransit.stat_tools.` `comb1`(n, k)

`pytransit.stat_tools.` `combine_lib_dicts`(L1, L2)

`pytransit.stat_tools.` `cumulative_average`(new_x, n, prev_avg)

`pytransit.stat_tools.` `dberndiff`(d, peq, p01, p10)

`pytransit.stat_tools.` `dbinomdiff`(d, n, P)

`pytransit.stat_tools.` `fact`(n)

`pytransit.stat_tools.` `get_lib_data_dict`(data1, ctrl_lib_str, data2, exp_lib_str, nTAs)

`pytransit.stat_tools.` `isEven`(x)

`pytransit.stat_tools.` `loess`(X, Y, h=10000)

`pytransit.stat_tools.` `loess_correction`(X, Y, h=10000, window=100)

`pytransit.stat_tools.` `log_fac`(n)

`pytransit.stat_tools.` `loglik`(X, lambdax)

  Computes the log-likelihood function for a transformed vector Xtransform.

`pytransit.stat_tools.` `multinomial`(K, P)

`pytransit.stat_tools.` `my_perm`(d, n)

`pytransit.stat_tools.` `norm`(x, mu, sigma)

  Normal distribution

`pytransit.stat_tools.` `parse_lib_index`(nData, libstr, nTAs)

`pytransit.stat_tools.` `phi_coefficient`(X, Y)

  Calculates the phi-coefficient for two bool arrays

`pytransit.stat_tools.` `qberndiff`(d, peq, p01, p10)

`pytransit.stat_tools.` `qbinomdiff`(d, n, peq, p01, p10)

`pytransit.stat_tools.` `regress`(X, Y)

  Performs linear regression given two vectors, X, Y.

`pytransit.stat_tools.` `resampling`(data1, data2, S=10000, testFunc=<function F_mean_diff_flat>, permFunc=<function F_shuffle_flat>, adaptive=False, lib_str1='', lib_str2='')

  Does a permutation test on two sets of data.

  Performs the resampling / permutation test given two sets of data using a function defining the test statistic and a function defining how to permute the data.

  Parameters: | ar – List or numpy array with the first set of observations. data2 – List or numpy array with the second set of observations. S – Number of permutation tests (or samples) to obtain. testFunc – Function defining the desired test statistic. Should accept two lists as arguments. Default is difference in means between the observations. permFunc – Function defining the way to permute the data. Should accept one argument, the combined set of data. Default is random shuffle. adaptive – Cuts-off resampling early depending on significance.
  Returns: | Tuple with described values test_obs – Test statistic of observation. mean1 – Arithmetic mean of first set of data. mean2 – Arithmetic mean of second set of data. log2FC – Normalized log2FC the means. pval_ltail – Lower tail p-value. pval_utail – Upper tail p-value. pval_2tail – Two-tailed p-value. test_sample – List of samples of the test statistic.
  Example: |
      >>> import pytransit.stat_tools as stat_tools
      >>> import numpy
      >>> X = numpy.random.random(100)
      >>> Y = numpy.random.random(100)
      >>> (test_obs, mean1, mean2, log2fc, pval_ltail, pval_utail, pval_2tail, test_sample) = stat_tools.resampling(X,Y)
      >>> pval_2tail
      0.2167
      >>> test_sample[:3]
      [0.076213992904990535, -0.0052513291091412784, -0.0038425140184765172]

`pytransit.stat_tools.` `sample_trunc_norm_post`(data, S, mu0, s20, k0, nu0)

`pytransit.stat_tools.` `text_histogram`(X, nBins=20, resolution=200, obs=None)

`pytransit.stat_tools.` `transformToRange`(X, new_min, new_max, old_min=None, old_max=None)

`pytransit.stat_tools.` `tricoeff`(N, S)

`pytransit.stat_tools.` `tricube`(X)

## pytransit.tnseq_tools module

`pytransit.tnseq_tools.` `ExpectedRuns`(n, pnon)

  Expected value of the run of non=insertions (Schilling, 1990):

  > ER_n = log(1/p)(nq) + gamma/ln(1/p) -1/2 + r1(n) + E1(n)

  Parameters: | n (int) – Integer representing the number of sites. pins (float) – Floating point number representing the probability of non-insertion.
  Returns: | Size of the expected maximum run.
  Return type: | float

class `pytransit.tnseq_tools.` `Gene`(orf, name, desc, reads, position, start=0, end=0, strand='')

  Class defining a gene with useful attributes for TnSeq analysis.

  This class helps define a “gene” with attributes that facilitate TnSeq analysis. Here “gene” can be defined to be any genomic region. The Genes class (with an s) can be used to define list of Gene objects with more useful operations on the “genome” level.

  `orf`

    A string defining the ID of the gene.

  `name`

    A string with the human readable name of the gene.

  `desc`

    A string with the description of the gene.

  `reads`

    List of lists of read-counts in possible site replicate dataset.

  `position`

    List of coordinates of the possible sites.

  `start`

    An integer defining the start coordinate for the gene.

  `end`

    An integer defining the end coordinate for the gene.

  `strand`

    A string defining the strand of the gene.

  Example: |
      >>> import pytransit.tnseq_tools as tnseq_tools
      >>> G = tnseq_tools.Gene("Rv0001", "dnaA", "DNA Replication A", [[0,0,0,0,1,3,0,1]],  [1,21,32,37,45,58,66,130], strand="+" )
      >>> print G
      Rv0001  (dnaA)  k=3 n=8 r=4 theta=0.37500
      >>> print G.phi()
      0.625
      >>> print G.tosses
      array([ 0.,  0.,  0.,  0.,  1.,  1.,  0.,  1.])
  See also `Genes`

  `__eq__`(other)

    Compares against other gene object.

    Returns: | True if the gene objects have same orf id.
    Return type: | bool

  `__ge__`(other)

    x.__ge__(y) <==> x>=y

  `__getitem__`(i)

    Return read-counts at position i.

    Parameters: | i (int) – integer of the index of the desired site.
    Returns: | Reads at position i.
    Return type: | list

  `__gt__`(other)

    x.__gt__(y) <==> x>y

  `__le__`(other)

    x.__le__(y) <==> x<=y

  `__lt__`(other)

    Compares against other gene object.

    Returns: | True if the gene object id is less than the other.
    Return type: | bool

  `__str__`()

    Return a string representation of the object.

    Returns: | Human readable string with some of the attributes.
    Return type: | str

  `get_gap_span`()

    Returns the span of the maxrun of the gene (i.e. number of nucleotides).

    Returns: | Number of nucleotides spanned by the max run.
    Return type: | int

  `get_gene_span`()

    Returns the number of nucleotides spanned by the gene.

    Returns: | Number of nucleotides spanned by the gene’s sites.
    Return type: | int

  `phi`()

    Return the non-insertion density (“phi”) for the gene.

    Returns: | Non-insertion density (i.e. 1 - theta)
    Return type: | float

  `theta`()

    Return the insertion density (“theta”) for the gene.

    Returns: | Density of the gene (i.e. k/n )
    Return type: | float

  `total_reads`()

    Return the total reads for the gene.

    Returns: | Total sum of read-counts.
    Return type: | float

class `pytransit.tnseq_tools.` `Genes`(wigList, annotation, norm='nonorm', reps='All', minread=1, ignoreCodon=True, nterm=0.0, cterm=0.0, include_nc=False, data=[], position=[], genome='', transposon='himar1')

  Class defining a list of Gene objects with useful attributes for TnSeq analysis.

  This class helps define a list of Gene objects with attributes that facilitate TnSeq analysis. Includes methods that calculate useful statistics and even rudamentary analysis of essentiality.

  `wigList`

    List of paths to datasets in .wig format.

  `protTable`

    String with path to annotation in .prot_table format.

  `norm`

    String with the normalization used/

  `reps`

    String with information on how replicates were handled.

  `minread`

    Integer with the minimum magnitude of read-count considered.

  `ignoreCodon`

    Boolean defining whether to ignore the start/stop codon.

  `nterm`

    Float number of the fraction of the N-terminus to ignore.

  `cterm`

    Float number of the fraction of the C-terminus to ignore.

  `include_nc`

    Boolean determining whether to include non-coding areas.

  `orf2index`

    Dictionary of orf id to index in the genes list.

  `genes`

    List of the Gene objects.

  Example: |
      >>> import pytransit.tnseq_tools as tnseq_tools
      >>> G = tnseq_tools.Genes(["transit/data/glycerol_H37Rv_rep1.wig", "transit/data/glycerol_H37Rv_rep2.wig"], "transit/genomes/H37Rv.prot_table", norm="TTR")
      >>> print G
      Genes Object (N=3990)
      >>> print G.global_theta()
      0.40853707222816626
      >>> print G["Rv0001"]   # Lookup like dictionary
      Rv0001  (dnaA)  k=0 n=31    r=31    theta=0.00000
      >>> print G[2]          # Lookup like list
      Rv0003  (recF)  k=5 n=35    r=14    theta=0.14286
      >>> print G[2].reads
      [[  62.            0.            0.            0.            0.            0.
       0.            0.            0.            0.            0.            0.
       0.            0.           63.            0.            0.           13.
      46.            0.            1.            0.            0.            0.
       0.            0.            0.            0.            0.            0.
       0.            0.            0.            0.            0.        ]
       [   3.14314432   67.26328843    0.            0.            0.            0.
       0.            0.            0.           35.20321637    0.            0.
       0.            0.           30.80281433    0.          101.20924707
       0.           23.25926796    0.           16.97297932    8.17217523
       0.            0.            2.51451546    3.77177318    0.62862886
       0.            0.           69.14917502    0.            0.            0.
       0.            0.        ]]
  See also `Gene`

  `__contains__`(item)

    Defines __contains__ to check if gene exists in the list.

    Parameters: | item (str) – String with the id of the gene.
    Returns: | Boolean with True if item is in the list.
    Return type: | bool

  `__getitem__`(i)

    Defines __getitem__ method so that it works as dictionary and list.

    Parameters: | i (int) – Integer or string defining index or orf ID desired.
    Returns: | A gene with the index or ID equal to i.
    Return type: | Gene

  `__len__`()

    Defines __len__ returning number of genes.

    Returns: | Number of genes in the list.
    Return type: | int

  `__str__`()

    Defines __str__ to print a generic str with the size of the list.

    Returns: | Human readable string with number of genes in object.
    Return type: | str

  `global_insertion`()

    Returns total number of insertions, i.e. sum of ‘k’ over all genes.

    Returns: | Total sum of reads across all genes.
    Return type: | float

  `global_phi`()

    Returns global non-insertion frequency, of the library.

    Returns: | Complement of global theta i.e. 1.0-theta
    Return type: | float

  `global_reads`()

    Returns the reads among the library.

    Returns: | List of all the data.
    Return type: | list

  `global_run`()

    Returns the run assuming all genes were concatenated together.

    Returns: | Max run across all genes.
    Return type: | int

  `global_sites`()

    Returns total number of sites, i.e. sum of ‘n’ over all genes.

    Returns: | Total number of sites across all genes.
    Return type: | int

  `global_theta`()

    Returns global insertion frequency, of the library.

    Returns: | Total sites with insertions divided by total sites.
    Return type: | float

  `local_gap_span`()

    Returns numpy array with the span of nucleotides of the largest gap, ‘s’, for each gene.

    Returns: | Numpy array with the span of gap for all genes.
    Return type: | narray

  `local_gene_span`()

    Returns numpy array with the span of nucleotides of the gene, ‘t’, for each gene.

    Returns: | Numpy array with the span of gene for all genes.
    Return type: | narray

  `local_insertions`()

    Returns numpy array with the number of insertions, ‘k’, for each gene.

    Returns: | Numpy array with the number of insertions for all genes.
    Return type: | narray

  `local_phis`()

    Returns numpy array of non-insertion frequency, ‘phi’, for each gene.

    Returns: | Numpy array with the complement of density for all genes.
    Return type: | narray

  `local_reads`()

    Returns numpy array of lists containing the read counts for each gene.

    Returns: | Numpy array with the list of reads for all genes.
    Return type: | narray

  `local_runs`()

    Returns numpy array with maximum run of non-insertions, ‘r’, for each gene.

    Returns: | Numpy array with the max run of non-insertions for all genes.
    Return type: | narray

  `local_sites`()

    Returns numpy array with total number of TA sites, ‘n’, for each gene.

    Returns: | Numpy array with the number of sites for all genes.
    Return type: | narray

  `local_thetas`()

    Returns numpy array of insertion frequencies, ‘theta’, for each gene.

    Returns: | Numpy array with the density for all genes.
    Return type: | narray

  `tosses`()

    Returns list of bernoulli trials, ‘tosses’, representing insertions in the gene.

    Returns: | Sites represented as bernoulli trials with insertions as true.
    Return type: | list

  `total_reads`()

    Returns total reads among the library.

    Returns: | Total sum of read-counts accross all genes.
    Return type: | float

`pytransit.tnseq_tools.` `GumbelCDF`(x, u, B)

  CDF of the Gumbel distribution:

  > e^(-e^( (u-x)/B))

  Parameters: | x (int) – Length of the max run. u (float) – Location parameter of the Gumbel dist. B (float) – Scale parameter of the Gumbel dist.
  Returns: | Cumulative probability o the Gumbel distribution.
  Return type: | float

`pytransit.tnseq_tools.` `VarR`(n, pnon)

  Variance of the expected run of non-insertons (Schilling, 1990):

  Parameters: | n (int) – Integer representing the number of sites. pnon (float) – Floating point number representing the probability of non-insertion.
  Returns: | Variance of the length of the maximum run.
  Return type: | float

`pytransit.tnseq_tools.` `check_wig_includes_zeros`(wig_list)

  Returns boolean list showing whether the given files include empty sites (zero) or not.

  Parameters: | wig_list (list) – List of paths to wig files.
  Returns: | List of boolean values.
  Return type: | list

`pytransit.tnseq_tools.` `combine_replicates`(data, method='Sum')

  Returns list of data merged together.

  Parameters: | data (list) – List of numeric (replicate) data to be merged. method (str) – How to combine the replicate dataset.
  Returns: | List of numeric dataset now merged together.
  Return type: | list

`pytransit.tnseq_tools.` `getE1`(n)

  Small Correction term. Defaults to 0.01 for now

`pytransit.tnseq_tools.` `getE2`(n)

  Small Correction term. Defaults to 0.01 for now

`pytransit.tnseq_tools.` `getGamma`()

  Euler-Mascheroni constant ~ 0.577215664901

`pytransit.tnseq_tools.` `getR1`(n)

  Small Correction term. Defaults to 0.000016 for now

`pytransit.tnseq_tools.` `getR2`(n)

  Small Correction term. Defaults to 0.00006 for now

`pytransit.tnseq_tools.` `get_coordinate_map`(galign_path, reverse=False)

  Attempts to get mapping of coordinates from galign file.

  Parameters: | path (str) – Path to .galign file. reverse (bool) – Boolean specifying whether to do A to B or B to A.
  Returns: | Dictionary of coordinate in one file to another file.
  Return type: | dict

`pytransit.tnseq_tools.` `get_data`(wig_list)
  Returns a tuple of (data, position) containing a matrix of raw read-counts
    , and list of coordinates.

  Parameters: | wig_list (list) – List of paths to wig files.
  Returns: | Two lists containing data and positions of the wig files given.
  Return type: | tuple
  Example: |
      >>> import pytransit.tnseq_tools as tnseq_tools
      >>> (data, position) = tnseq_tools.get_data(["data/glycerol_H37Rv_rep1.wig", "data/glycerol_H37Rv_rep2.wig"])
      >>> print data
      array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
             [ 0.,  0.,  0., ...,  0.,  0.,  0.]])

  See also

  `get_file_types` `combine_replicates` `get_data_zero_fill` `pytransit.norm_tools.normalize_data`

`pytransit.tnseq_tools.` `get_data_stats`(reads)

`pytransit.tnseq_tools.` `get_data_w_genome`(wig_list, genome)

`pytransit.tnseq_tools.` `get_data_zero_fill`(wig_list)
  Returns a tuple of (data, position) containing a matrix of raw read counts,
    and list of coordinates. Positions that are missing are filled in as zero.

  Parameters: | wig_list (list) – List of paths to wig files.
  Returns: | Two lists containing data and positions of the wig files given.
  Return type: | tuple

`pytransit.tnseq_tools.` `get_extended_pos_hash_gff`(path, N=None)

`pytransit.tnseq_tools.` `get_extended_pos_hash_pt`(path, N=None)

`pytransit.tnseq_tools.` `get_file_types`(wig_list)

  Returns the transposon type (himar1/tn5) of the list of wig files.

  Parameters: | wig_list (list) – List of paths to wig files.
  Returns: | List of transposon type (“himar1” or “tn5”).
  Return type: | list

`pytransit.tnseq_tools.` `get_gene_info`(path)

  Returns a dictionary that maps gene id to gene information.

  Parameters: | path (str) – Path to annotation in .prot_table or GFF3 format.
  Returns: | Dictionary of gene id to tuple of information: name description start coordinate end coordinate strand
  Return type: | dict

`pytransit.tnseq_tools.` `get_gene_info_gff`(path)

  Returns a dictionary that maps gene id to gene information.

  Parameters: | path (str) – Path to annotation in GFF3 format.
  Returns: | Dictionary of gene id to tuple of information: name description start coordinate end coordinate strand
  Return type: | dict

`pytransit.tnseq_tools.` `get_gene_info_pt`(path)

  Returns a dictionary that maps gene id to gene information.

  Parameters: | path (str) – Path to annotation in .prot_table format.
  Returns: | Dictionary of gene id to tuple of information: name description start coordinate end coordinate strand
  Return type: | dict

`pytransit.tnseq_tools.` `get_genes_in_range`(pos_hash, start, end)

  Returns list of genes that occur in a given range of coordinates.

  Parameters: | pos_hash (dict) – Dictionary of position to list of genes. start (int) – Start coordinate of the desired range. end (int) – End coordinate of the desired range.
  Returns: | List of genes that fall within range.
  Return type: | list

`pytransit.tnseq_tools.` `get_pos_hash`(path)

  Returns a dictionary that maps coordinates to a list of genes that occur at that coordinate.

  Parameters: | path (str) – Path to annotation in .prot_table or GFF3 format.
  Returns: | Dictionary of position to list of genes that share that position.
  Return type: | dict

`pytransit.tnseq_tools.` `get_pos_hash_gff`(path)

  Returns a dictionary that maps coordinates to a list of genes that occur at that coordinate.

  Parameters: | path (str) – Path to annotation in GFF3 format.
  Returns: | Dictionary of position to list of genes that share that position.
  Return type: | dict

`pytransit.tnseq_tools.` `get_pos_hash_pt`(path)

  Returns a dictionary that maps coordinates to a list of genes that occur at that coordinate.

  Parameters: | path (str) – Path to annotation in .prot_table format.
  Returns: | Dictionary of position to list of genes that share that position.
  Return type: | dict

`pytransit.tnseq_tools.` `get_unknown_file_types`(wig_list, transposons)

`pytransit.tnseq_tools.` `get_wig_stats`(path)

  Returns statistics for the given wig file with read-counts.

  Parameters: | path (str) – String with the path to the wig file of interest.
  Returns: | Tuple with the following statistical measures: density mean read non-zero mean non-zero median max read total reads skew kurtosis
  Return type: | tuple

`pytransit.tnseq_tools.` `griffin_analysis`(genes_obj, pins)

  Implements the basic Gumbel analysis of runs of non-insertion, described in Griffin et al. 2011.

  This analysis method calculates a p-value of observing the maximun run of TA sites without insertions in a row (i.e. a “run”, r). Unusually long runs are indicative of an essential gene or protein domain. Assumes that there is a constant, global probability of observing an insertion (tantamount to a Bernoulli probability of success).

  Parameters: | genes_obj (Genes) – An object of the Genes class defining the genes. pins (float) – The probability of insertion.
  Returns: | List of lists with results and information for the genes. The elements of the list are as follows: ORF ID. Gene Name. Gene Description. Number of TA sites with insertions. Number of TA sites. Length of largest run of non-insertion. Expected run for a gene this size. p-value of the observed run.
  Return type: | list

`pytransit.tnseq_tools.` `maxrun`(lst, item=0)

  Returns the length of the maximum run an item in a given list.

  Parameters: | lst (list) – List of numeric items. item (float) – Number to look for consecutive runs of.
  Returns: | Length of the maximum run of consecutive instances of item.
  Return type: | int

`pytransit.tnseq_tools.` `read_combined_wig`(fname)

  Read the combined wig-file generated by Transit :: Filename -> Tuple([Site], [[WigData]]) Site :: [Integer] WigData :: [Integer]

`pytransit.tnseq_tools.` `read_genes`(fname, descriptions=False)

  (Filename, Options) -> [Gene] Gene :: {start, end, rv, gene, strand}

`pytransit.tnseq_tools.` `read_genome`(path)

  Reads in FASTA formatted genome file.

  Parameters: | path (str) – Path to .galign file.
  Returns: | String with the genomic sequence.
  Return type: | string

`pytransit.tnseq_tools.` `runindex`(runs)

  Returns a list of the indexes of the start of the runs; complements runs().

  Parameters: | runs (list) – List of numeric data.
  Returns: | List of the index of the runs of non-insertions. Non-zero sites are treated as runs of zero.
  Return type: | list

`pytransit.tnseq_tools.` `runs`(data)

  Return list of all the runs of consecutive non-insertions.

  Parameters: | data (list) – List of numeric data.
  Returns: | List of the length of the runs of non-insertions. Non-zero sites are treated as runs of zero.
  Return type: | list

`pytransit.tnseq_tools.` `runs_w_info`(data)

  Return list of all the runs of consecutive non-insertions with the start and end locations.

  Parameters: | data (list) – List of numeric data to check for runs.
  Returns: | List of dictionary from run to length and position information of the tun.
  Return type: | list

`pytransit.tnseq_tools.` `rv_siteindexes_map`(genes, TASiteindexMap)

  ([Gene], {TAsite: Siteindex}) -> {Rv: Siteindex}

`pytransit.tnseq_tools.` `tossify`(data)

  Reduces the data into Bernoulli trials (or ‘tosses’) based on whether counts were observed or not.

  Parameters: | data (list) – List of numeric data.
  Returns: | Data represented as bernoulli trials with >0 as true.
  Return type: | list

## pytransit.transit_gui module

class `pytransit.transit_gui.` `AssumeZerosDialog`(*args, **kw)

  Bases: `wx._core.Dialog`

  `OnClose`(event)

class `pytransit.transit_gui.` `MainFrame`(parent)

  Bases: `wx._core.Frame`

  `Exit`(event)
  `LoessPrevFunc`(event)
  `MethodSelectFunc`(event)
  `RunBinomialFunc`(event)
  `RunDEHMMFunc`(event)
  `RunHMMFunc`(event)
  `RunResamplingFunc`(event)
  `aboutFunc`(event)
  `addFileFunc`(event)
  `allViewFunc`(event)
  `annotationFileFunc`(event)
  `annotationGFF3_to_PT`(event)
  `annotationPTT_to_PT`(event)
  `annotationPT_to_GFF3`(event)
  `annotationPT_to_PTT`(event)
  `clearStatus`(event)
  `ctrlRemoveFunc`(event)
  `ctrlToIGV`(event)
  `displayFileFunc`(event)
  `documentationFunc`(event)
  `expRemoveFunc`(event)
  `expToIGV`(event)
  `fileActionFunc`(event)
  `loadCtrlFileFunc`(event)
  `loadExpFileFunc`(event)
  `onHimar1Checked`(event)
  `onTn5Checked`(event)
  `qcFunc`(event)
  `scatterFunc`(event)

class `pytransit.transit_gui.` `TnSeekFrame`(parent, DEBUG=False)

  Bases: `pytransit.transit_gui.MainFrame`

  `Exit`(event)

    Exit Menu Item

  `ExportSelectFunc`(selected_name, test='')
  `HideAllOptions`()
  `HideGlobalCTerminus`()
  `HideGlobalCtrlLibraries`()
  `HideGlobalExpLibraries`()
  `HideGlobalLibraries`()
  `HideGlobalNTerminus`()
  `HideGlobalOptions`()
  `HideProgressSection`()
  `LoessPrevFunc`(event)
  `MethodSelectFunc`(selected_name, test='')
  `OpenFile`(DIR='.', FILE='', WC='')

    Create and show the Open FileDialog

  `ResetProgress`()
  `RunMethod`(event)
  `SaveFile`(DIR=None, FILE='', WC=u'Common output extensions (*.txt, *.dat, *.out)|*.txt;*.dat;*.out;|\nAll files (*.*)|*.*"')

    Create and show the Save FileDialog

  `ShowGlobalCTerminus`()
  `ShowGlobalCtrlLibraries`()
  `ShowGlobalExpLibraries`()
  `ShowGlobalLibraries`()
  `ShowGlobalNTerminus`()
  `ShowGlobalOptions`()
  `ShowProgressSection`()
  `aboutFunc`(event)
  `addFile`(data)
  `addFileFunc`(event)
  `allSelected`(col=5)
  `allViewFunc`(event, gene='')
  `annotationFileFunc`(event)
  `annotationGFF3_to_PT`(event)
  `annotationPTT_to_PT`(event)
  `annotationPT_to_GFF3`(event)
  `annotationPT_to_PTT`(event)
  `chooseNormalization`()
  `choseMethodsMenu`(selected_name, event)
  `clearStatus`(event)
  `ctrlAll`(col=5)
  `ctrlRemoveFunc`(event)
  `ctrlSelected`(col=5)
  `ctrlViewFunc`(event, gene='')
  `displayFileFunc`(event)
  `documentationFunc`(event)
  `expAll`(col=5)
  `expRemoveFunc`(event)
  `expSelected`(col=5)
  `expViewFunc`(event, gene='')
  `fileActionFunc`(event)
  `fileSelected`(event)
  `filterMethodsByTransposon`()
  `finishRun`(msg)
  `graphGeneCounts`(dataset_name, dataset_type, dataset_path)
  `graphRankedZbar`(dataset_name, dataset_type, dataset_path)
  `graphVolcanoPlot`(dataset_name, dataset_type, dataset_path)
  `loadCtrlFile`(fullpath)
  `loadCtrlFileFunc`(event)
  `loadExpFile`(fullpath)
  `loadExpFileFunc`(event)
  `onHimar1Checked`(event)
  `onTn5Checked`(event)
  `qcFunc`(event)
  `saveHistogram`(msg)
  `scatterFunc`(event)
  `setProgressRange`(msg)
  `updateGraphChoices`(dataset_type)
  `updateProgress`(msg)
  `updateStatus`(msg, time=-1)

## pytransit.transit_tools module

class `pytransit.transit_tools.` `AssumeZerosDialog`(*args, **kw)

  Bases: `wx._core.Dialog`

  `OnClose`(event)

`pytransit.transit_tools.` `ShowAskWarning`(MSG='')

`pytransit.transit_tools.` `ShowError`(MSG='')

`pytransit.transit_tools.` `ShowMessage`(MSG='')

`pytransit.transit_tools.` `aton`(aa)

`pytransit.transit_tools.` `basename`(filepath)

`pytransit.transit_tools.` `cleanargs`(rawargs)

  Returns a list and a dictionary with positional and keyword arguments.

  -This function assumes flags must start with a “-” and and cannot be a
    number (but can include them).
  -Flags should either be followed by the value they want to be associated
    with (i.e. -p 5) or will be assigned a value of True in the dictionary.
  -The dictionary will map flags to the name given minus ONE “-” sign in
    front. If you use TWO minus signs in the flag name (i.e. –verbose), the dictionary key will be the name with ONE minus sign in front (i.e. {“-verbose”:True}).

  Parameters: | rawargs (list) – List of positional/keyword arguments. As obtained from sys.argv.
  Returns: | List of positional arguments (i.e. arguments without flags), in order provided. dict: Dictionary mapping flag (key is flag minus the first “-“) and their values.
  Return type: | list

`pytransit.transit_tools.` `convertToCombinedWig`(dataset_list, annotationPath, outputPath, normchoice='nonorm')

  Normalizes the input datasets and outputs the result in CombinedWig format.

  Parameters: | dataset_list (list) – List of paths to datasets in .wig format annotationPath (str) – Path to annotation in .prot_table or GFF3 format. outputPath (str) – Desired output path. normchoice (str) – Choice for normalization method.

`pytransit.transit_tools.` `convertToGeneCountSummary`(dataset_list, annotationPath, outputPath, normchoice='nonorm')

  Normalizes the input datasets and outputs the result in CombinedWig format.

  Parameters: | dataset_list (list) – List of paths to datasets in .wig format annotationPath (str) – Path to annotation in .prot_table or GFF3 format. outputPath (str) – Desired output path. normchoice (str) – Choice for normalization method.

`pytransit.transit_tools.` `convertToIGV`(self, dataset_list, annotationPath, path, normchoice=None)

`pytransit.transit_tools.` `dirname`(filepath)

`pytransit.transit_tools.` `fetch_name`(filepath)

`pytransit.transit_tools.` `getTabTableData`(path, colnames)

`pytransit.transit_tools.` `get_extended_pos_hash`(path)

  Returns a dictionary that maps coordinates to a list of genes that occur at that coordinate.

  Parameters: | path (str) – Path to annotation in .prot_table or GFF3 format.
  Returns: | Dictionary of position to list of genes that share that position.
  Return type: | dict

`pytransit.transit_tools.` `get_gene_info`(path)

  Returns a dictionary that maps gene id to gene information.

  Parameters: | path (str) – Path to annotation in .prot_table or GFF3 format.
  Returns: | Dictionary of gene id to tuple of information: name description start coordinate end coordinate strand
  Return type: | dict

`pytransit.transit_tools.` `get_pos_hash`(path)

  Returns a dictionary that maps coordinates to a list of genes that occur at that coordinate.

  Parameters: | path (str) – Path to annotation in .prot_table or GFF3 format.
  Returns: | Dictionary of position to list of genes that share that position.
  Return type: | dict

`pytransit.transit_tools.` `get_validated_data`(wig_list, wxobj=None)
  Returns a tuple of (data, position) containing a matrix of raw read-counts
    , and list of coordinates.

  Parameters: | wig_list (list) – List of paths to wig files. wxobj (object) – wxPython GUI object for warnings
  Returns: | Two lists containing data and positions of the wig files given.
  Return type: | tuple
  Example: |
      >>> import pytransit.tnseq_tools as tnseq_tools
      >>> (data, position) = tnseq_tools.get_validated_data(["data/glycerol_H37Rv_rep1.wig", "data/glycerol_H37Rv_rep2.wig"])
      >>> print data
      array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
             [ 0.,  0.,  0., ...,  0.,  0.,  0.]])

  See also

  `get_file_types` `combine_replicates` `get_data_zero_fill` `pytransit.norm_tools.normalize_data`

`pytransit.transit_tools.` `parseCoords`(strand, aa_start, aa_end, start, end)

`pytransit.transit_tools.` `transit_error`(text)

`pytransit.transit_tools.` `transit_message`(msg='', prefix='')

`pytransit.transit_tools.` `validate_annotation`(annotation)

`pytransit.transit_tools.` `validate_both_datasets`(ctrldata, expdata)

`pytransit.transit_tools.` `validate_control_datasets`(ctrldata)

`pytransit.transit_tools.` `validate_filetypes`(datasets, transposons, justWarn=True)

`pytransit.transit_tools.` `validate_transposons_used`(datasets, transposons, justWarn=True)

`pytransit.transit_tools.` `validate_wig_format`(wig_list, wxobj=None)

## pytransit.trash module

`pytransit.trash.` `PilImageToWxBitmap`(myPilImage)

`pytransit.trash.` `PilImageToWxImage`(myPilImage)

class `pytransit.trash.` `TrashFrame`(parent, dataset_list=['H37Rv_Sassetti_glycerol.wig'], annotation='H37Rv.prot_table', gene='', scale=None, feature_hashes=[], feature_data=[])

  Bases: `pytransit.view_trash.MainFrame`

  `DrawCanvas`()
  `OpenFile`(DIR='.', FILE='', WC='')

    Create and show the Open FileDialog

  `SaveFile`(DIR='.', FILE='', WC='')

    Create and show the Save FileDialog

  `addFeatureFunc`(event)
  `changedMaxFunc`(event)
  `checkHMMFeature`(path)
  `clearStatus`(event)
  `datasetSelectFunc`(event)
  `getHMMHash`(path)
  `leftFunc`(event)
  `resetFunc`(event)
  `rightFunc`(event)
  `saveImageFunc`(event)
  `scaleFunc`(event)
  `searchFunc`(event)
  `track_message`(text, time=3000)
  `updateFunc`(event)
  `zoomInFunc`(event)
  `zoomOutFunc`(event)

`pytransit.trash.` `WxBitmapToPilImage`(myBitmap)

`pytransit.trash.` `WxBitmapToWxImage`(myBitmap)

`pytransit.trash.` `WxImageToWxBitmap`(myWxImage)

`pytransit.trash.` `fetch_name`(filepath)

## pytransit.view_trash module

class `pytransit.view_trash.` `MainFrame`(parent)

  Bases: `wx._core.Frame`

  `addFeatureFunc`(event)
  `changedMaxFunc`(event)
  `clearStatus`(event)
  `leftFunc`(event)
  `resetFunc`(event)
  `rightFunc`(event)
  `saveImageFunc`(event)
  `searchFunc`(event)
  `updateFunc`(event)
  `zoomInFunc`(event)
  `zoomOutFunc`(event)

## Module contents