semvec/pypi-packages huggingface dataset:
grnportia 0.0.2
PORTIA: Fast and Accurate Inference of Gene Regulatory Networks through Robust Precision Matrix Estimation
Requires Python: >=3.6

[![Build status](https://github.com/AntoinePassemiers/PORTIA/actions/workflows/build.yml/badge.svg)](https://github.com/AntoinePassemiers/PORTIA/actions?query=build)
[![Code analysis](https://github.com/AntoinePassemiers/PORTIA/actions/workflows/analysis.yml/badge.svg)](https://github.com/AntoinePassemiers/PORTIA/actions?query=analysis)

# PORTIA

<img align="left" src="docs/imgs/portia.svg" />

Lightning-fast Gene Regulatory Network (GRN) inference tool.

PORTIA builds on power transforms and covariance matrix inversion to approximate GRNs, and is orders of magnitude faster than other existing tools (as of August 2021).

---

### How to use it

Install the dependencies:

```bash
pip3 -r requirements.txt
```

For using the end-to-end inference algorithm, install dependencies from `requirements-etel.txt` instead.

Install the package:

```bash
python3 setup.py install
```

In Python, create an empty dataset:

```python
import grnportia as pt

dataset = pt.GeneExpressionDataset()
```

Microarray experiments can be added with the `GeneExpressionDataset.add` method. `data` must be an iterable (list, NumPy array, etc).

```python
for exp_id, data in enumerate(your_data):
    dataset.add(pt.Experiment(exp_id, data))
```

Gene knock-out experiments can be encoded using the `knockout` optional parameter.

```python
dataset.add(pt.Experiment(exp_id, data, knockout=[gene_idx]))
```

where `gene_idx` is the (0-based) index of the gene being knocked out. Dual/multiple knock-out experiments are supported, but won't help in the inference process in any way.

Run PORTIA on your dataset:

```python
M_bar = pt.run(dataset, method='fast')
```

The output `M_bar` is a matrix, where each element `M_bar[i, j]` is a score in the range [0, 1] reflecting the confidence about gene `i` being a regulator for target gene `j`. A whitelist of putative transcription factors can be specified with the `tf_idx` argument. `tf_idx` must be a (0-based) list of gene indices.

```python
M_bar = pt.run(dataset, tf_idx=tf_idx, method='fast')
```

Finally, rank and store the results in a text file. `gene_names` is the list of your genes, provided in the correct order.

```python
with open('your_destination/results.txt', 'w') as f:
    for gene_a, gene_b, score in pt.rank_scores(M_bar, gene_names, limit=10000):
        f.write(f'{gene_a}\t{gene_b}\t{score}\n')
```

Real examples on the DREAM datasets are provided in the `scripts/` folder.
gzip-stream 1.2.0
Compress stream by GZIP on the fly.
Requires Python: ~=3.5
Keywords: gzip,compression

===========
gzip-stream
===========

`gzip-stream` is a super-tiny library that will help you compress by GZIP
on-the-fly.

`GZIPCompressedStream` class instance acting like an any other stream (in fact,
`GZIPCompressedStream` inherits `io.RawIOBase <https://docs.python.org/3/library/io.html#io.RawIOBase>`_),
but wraps another stream and compress it on-the-fly.

.. code-block:: python

    from gzip_stream import GZIPCompressedStream
    from my_upload_lib import MyUploadClient

    upload_client = MyUploadClient()
    with open('my_very_big_1tb_file.txt') as file_to_upload:
        compressed_stream = GZIPCompressedStream(
            file_to_upload,
            compression_level=7
        )
        upload_client.upload_fileobj(compressed_stream)

`GZIPCompressedStream` does not read entire stream, but instead read it
by chunks, until compressed output size will not satisfy read size.

`AsyncGZIPDecompressedStream` class can async read from another source
with zlib and gzip decompression on-the-fly

.. code-block:: python

    # aiobotocore example

    import aiobotocore

    from gzip_stream import AsyncGZIPDecompressedStream

    AWS_ACCESS_KEY_ID = "KEY_ID"
    AWS_SECRET_ACCESS_KEY = "ACCESS_KEY"
    BUCKET = "AWESOME_BUCKET"

    upload_client = MyAsyncUploadClient()
    session = aiobotocore.get_session()
    async with session.create_client(
        service_name="s3",
        endpoint_url="s3_endpoint",
        aws_secret_access_key=AWS_SECRET_ACCESS_KEY,
        aws_access_key_id=AWS_ACCESS_KEY_ID,
    ) as client:
        response = await client.get_object(Bucket=BUCKET, Key='my_very_big_1tb_file.txt.gz')
        async for decompressed_chunk in GzipAsyncReaderWrapper(response["Body"])):
            await upload_client.upload_fileobj(decompressed_chunk)


Module works on Python ~= 3.5.

Installation
------------
.. code-block:: bash

    pip install gzip-stream


License
-------
Public Domain: `CC0 1.0 Universal <https://creativecommons.org/publicdomain/zero/1.0/>`_.