-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
146 finish remaining python api (#148)
* include pyo3 anyhow * include BLAT and ucsc module for python module * included python3 ucsc in modlist * include into py dict for Blat object * ran cargo fmt * include pytest justfile * add blat testing * add python seq function to module * pass in transcribe dereferenced * include python seq in modlist * use fastarecord and fastarecords to resultseq container and resultseq * include fastarecord and fastarecords to uniprotinfo and container * include fasta to utils * include fasta record and records to utils * added python submodule function for seq * include testing for python seq command * python API for info * include python in info modlist * implement into py dict for info container and info * include python info in modlist for python api * added function checking to mandate list for python seq * include nolist testing in seq * python testing for info * added python blast to blast modlist * added into py dict tract for blast result * included python blast into python module * api for python blast * remove evalue testing since multiple are possible * added testing for python blast api * will add this back in once megablast is stable * bump version
- Loading branch information
1 parent
7663e88
commit 7bd4761
Showing
30 changed files
with
470 additions
and
38 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
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
pub mod cli; | ||
pub mod functions; | ||
pub mod types; | ||
mod python; | ||
pub use python::python_blast; |
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,43 @@ | ||
use anyhow::{Result, bail}; | ||
use clap::ValueEnum; | ||
use pyo3::{Python, types::{PyDict, IntoPyDict}, pyfunction}; | ||
use super::{types::{BlastProgram, BlastDatabase}, functions::blast}; | ||
|
||
#[pyfunction(name = "blast")] | ||
#[pyo3(text_signature = "(query, program = None, database = None, limit = 50, expect = 10.0, low_comp_filter = False, megablast = True)")] | ||
pub fn python_blast<'py>( | ||
py: Python<'py>, | ||
query: &str, | ||
program: Option<String>, | ||
database: Option<String>, | ||
limit: Option<usize>, | ||
expect: Option<f64>, | ||
low_comp_filter: Option<bool>, | ||
megablast: Option<bool>, | ||
) -> Result<&'py PyDict> { | ||
|
||
let program = match program { | ||
Some(program_str) => if let Ok(s) = BlastProgram::from_str(&program_str, true) { | ||
Some(s) | ||
} else { | ||
bail!("Could not assign blast program from input") | ||
}, | ||
None => None | ||
}; | ||
|
||
let database = match database { | ||
Some(database_str) => if let Ok(s) = BlastDatabase::from_str(&database_str, true) { | ||
Some(s) | ||
} else { | ||
bail!("Could not assign blast database from input") | ||
}, | ||
None => None | ||
}; | ||
|
||
let limit = limit.unwrap_or(50); | ||
let expect = expect.unwrap_or(10.0); | ||
let low_comp_filter = low_comp_filter.unwrap_or(false); | ||
let megablast = megablast.unwrap_or(true); | ||
let response = blast(query, &program, &database, limit, expect, low_comp_filter, megablast)?; | ||
Ok(response.into_py_dict(py)) | ||
} |
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
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
mod add_list; | ||
mod enrich; | ||
mod get_libraries; | ||
mod view_list; | ||
mod shorthand; | ||
mod view_list; | ||
pub use add_list::add_list; | ||
pub use enrich::enrich; | ||
pub use get_libraries::get_libraries; | ||
pub use view_list::view_list; | ||
pub use shorthand::shorthand; | ||
pub use view_list::view_list; |
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
mod cli; | ||
pub mod functions; | ||
pub mod types; | ||
mod python; | ||
pub use cli::launch_info; | ||
pub use functions::info; | ||
pub use types::Info; | ||
pub use python::python_info; |
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,23 @@ | ||
use anyhow::{bail, Result}; | ||
use pyo3::{types::{PyDict, IntoPyDict}, Python, pyfunction}; | ||
use super::info; | ||
|
||
|
||
#[pyfunction(name = "info")] | ||
#[pyo3(text_signature = "(search_terms, species = 'homo_sapiens', taxon_id = 9606)")] | ||
pub fn python_info<'py>( | ||
py: Python<'py>, | ||
search_terms: Vec<String>, | ||
species: Option<String>, | ||
taxon_id: Option<usize>, | ||
) -> Result<&'py PyDict> { | ||
if search_terms.len() == 0 { | ||
bail!("Must pass in more than one search term!"); | ||
} else if search_terms[0].len() == 1 { | ||
bail!("Must pass in search terms as a list!"); | ||
} | ||
let species = species.unwrap_or("homo_sapiens".to_string()); | ||
let taxon_id = taxon_id.unwrap_or(9606); | ||
let results = info(&search_terms, &species, taxon_id)?; | ||
Ok(results.into_py_dict(py)) | ||
} |
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
Oops, something went wrong.