Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pandas Interface for KDataframes #69

Open
shokrof opened this issue Mar 30, 2020 · 1 comment
Open

Pandas Interface for KDataframes #69

shokrof opened this issue Mar 30, 2020 · 1 comment

Comments

@shokrof
Copy link
Collaborator

shokrof commented Mar 30, 2020

I have created new class for columns you will find a file called defaultColumn

and I added new functions in kDataframe base class

void addColumn(string columnName, Column*);
template<typename T,typename Container>
T getKmerColumnValue(string columnName,string kmer);
template<typename T,typename Container>
void setKmerColumnValue(string columnName,string kmer, T value);
void changeDefaultColumnType(Column*);
template<typename T,typename Container>
T getKmerDefaultColumnValue(string kmer);
template<typename T,typename Container>
void setKmerDefaultColumnValue(string kmer, T value);

@mr-eyes
Copy link
Member

mr-eyes commented Mar 25, 2021

Just a start for the concept

import kProcessor as kp
import numpy as np
import pandas as pd

genesFrame = kp.kDataFramePHMAP(21)
genes_file = "human_pc.part_002.fa"
chunkSize = 10000
cKF = kp.index(genesFrame, {"kSize": genesFrame.ksize()}, genes_file, chunkSize, f"{genes_file}.names")

# Create a zeros numpy 2d array with type unsigned long long with the size of the kDataFrame
np_array = np.zeros(shape=(2,genesFrame.size()), dtype=np.ulonglong)

# Load the kDataFrame into the numpy array
genesFrame.to_numpy(np_array)

df = pd.DataFrame(data=np_array.T)
df.describe()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants