Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

A python script to convert large matrices stored as .h5 to .txt

Project description

kelvinnypy

It is pronounced 'kelvinny-pee'

Intro

Hi there! I've put together the following python script/package for some work stuff!

Requirements

python 3.7

Installation instructions

# using pip
pip install kelvinnypy

# or using conda
conda install -c kt16 kelvinnypy

Main function (well, only function)

h5totxt

Together with another R function in zktuong/kelvinny (kelvinny::mtx_to_h5, or in a combined wrapper - kelvinny::mtx_to_h5totxt), this python script helps to parse large matrices in R to .h5 to .txt format. This packages are extremely light weight and should be relatively quick and easy to install and use. Have fun!

Usage

I've created this as an executable that you can use directly via the terminal/console

# bash
h5totxt counts.h5

# for help,
h5totxt -h

You can also download the file called h5convert.py and call it in terminal via python

# bash
python ./path/to/kelvinnypy.py counts.h5

Or use in R via reticulate

# R
reticulate::repl_python()
# python
import kelvinnypy as kp
kp.h5totxt("counts.h5")
# or
kp.h5totxt("counts.h5", "new_counts.txt")

or

# R
library(reticulate)
kp <- import("kelvinnypy")
kp$h5totxt("counts.h5")

or even as a complete workflow with the the R function

# devtools::install_github('zktuong/kelvinny', dependencies = TRUE)
mat <- matrix(rexp(2e8, rate=.1), ncol=20000, dimnames = list(paste0("gene", 1:10000), paste0("cell", 1:20000)))
dim(mat)
# [1] 10000 20000

# try this!
mtx_to_h5totxt(mat, "mat")

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for kelvinnypy, version 1.0.16
Filename, size File type Python version Upload date Hashes
Filename, size kelvinnypy-1.0.16-py3-none-any.whl (5.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size kelvinnypy-1.0.16.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page