-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from apcamargo/rust-kmers
Version 0.2.0
- Loading branch information
Showing
8 changed files
with
58 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[package] | ||
name = "rnasamba" | ||
version = "0.2.0" | ||
authors = ["Antonio Camargo <[email protected]>"] | ||
edition = "2018" | ||
|
||
[lib] | ||
name = "rnasamba" | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies.pyo3] | ||
version = "0.8.1" | ||
features = ["extension-module"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
include LICENSE | ||
include LICENSE | ||
include Cargo.toml | ||
recursive-include src * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,4 @@ | |
# | ||
# Contact: [email protected] | ||
|
||
from rnasamba.core.model import RNAsambaClassificationModel, RNAsambaTrainModel | ||
from rnasamba.core.model import RNAsambaClassificationModel, RNAsambaTrainModel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,11 +20,14 @@ | |
# Contact: [email protected] | ||
|
||
from setuptools import find_packages, setup | ||
from setuptools_rust import RustExtension | ||
|
||
setup( | ||
name='rnasamba', | ||
version='0.1.6', | ||
version='0.2.0', | ||
packages=find_packages(), | ||
rust_extensions=[RustExtension('rnasamba.core.kmer', debug=False)], | ||
zip_safe=False, | ||
license='GNU General Public License v3.0', | ||
description='A tool for computing the coding potential of RNA transcript sequences using deep learning.', | ||
long_description=open('README.md').read(), | ||
|
@@ -45,7 +48,7 @@ | |
'machine learning', | ||
'neural networks', | ||
], | ||
author='Antonio Pedro Camargo, Vsevolod Sourkov', | ||
author='Antonio Camargo, Vsevolod Sourkov', | ||
author_email='[email protected]', | ||
classifiers=[ | ||
'Development Status :: 3 - Alpha', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use pyo3::prelude::*; | ||
use pyo3::wrap_pyfunction; | ||
use std::collections::HashMap; | ||
use std::str; | ||
|
||
#[pyfunction] | ||
fn count_kmers(sequence: &str, k: usize) -> PyResult<HashMap<&str, u16>> { | ||
let mut counts = HashMap::new(); | ||
let n_kmers = sequence.len() - k + 1; | ||
for i in 0..n_kmers { | ||
let kmer = &sequence[i..i + k]; | ||
*counts.entry(kmer).or_insert(0) += 1; | ||
} | ||
Ok(counts) | ||
} | ||
|
||
#[pymodule] | ||
fn kmer(_py: Python<'_>, m: &PyModule) -> PyResult<()> { | ||
m.add_wrapped(wrap_pyfunction!(count_kmers))?; | ||
Ok(()) | ||
} |