Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

How to access Index array in H5 file using jsfive library?

$
0
0

I need to grab the index array from an h5 file but can't seem to locate it.I use this python code to print and see

import pandas as pdber_per_flow = pd.read_hdf('c:\\runbrowser\\data\\032266_1\\RunID032266_1.MonitorData.h5', 'count_of_reads_lengths')print(ber_per_flow)

which returns

           All reads  Trimmed by adapter  Trimmed by quality  Trimmed by Adapter or Quality12           2                 1.0                 1.0                            2.013           5                 4.0                 1.0                            5.014           5                 3.0                 2.0                            5.015           5                 3.0                 2.0                            5.016           9                 5.0                 4.0                            9.0..         ...                 ...                 ...                            ...459          1                 0.0                 0.0                            0.0465          1                 0.0                 0.0                            0.0466          1                 0.0                 0.0                            0.0469          1                 0.0                 0.0                            0.0476          1                 0.0                 0.0                            0.0

the first column starting at 12 and down is the index array.

This is my JS code

const readH5FileRLDataAsync = async (filepath, key) => {    return new Promise((resolve, reject) => {        fs_raw.readFile(filepath, (err, data) => {            if (err) return reject(err);            else {                try {                    let f = new hdf5.File(data.buffer);                    let keys1 = f.get(`${key}/block1_items`);                    let group1 = f.get(`${key}/block1_values`);                    let keys = f.get(`${key}/block0_items`);                    let group = f.get(`${key}/block0_values`);                    if (group !== undefined && group1 !== undefined) {                        let result = splitIntoChunks(group, keys);                        let result1 = splitIntoChunks(group1, keys1);                        let merged = { ...result, ...result1 };                        return resolve(merged);                    }                    else return resolve(null);                }                catch (e) {                    console.log(e);                    return reject(e);                }            }        });    });}

keys1 contains 'All reads', group contains the array for keys1, keys contains 'Trimmed by adapter, Trimmed by quality, Trimmed by Adapter or Quality' and group1 contains the arrays for corresponding keys. Neither contain the index array shown in python.

I'm new to this library, does anyone know how to locate <path_to_indexes_dataset> ?


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>