Skip to content

Commit 2e13193

Browse files
authored
Update python_api.rs
1 parent 92ef282 commit 2e13193

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

src/python_api.rs

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,57 +24,35 @@ fn _check_table(table: u8) -> PyResult<()> {
2424
Ok(())
2525
}
2626

27-
/// Translate a bytestring of DNA nucleotides into a bytestring of amino acids.
28-
///
29-
/// The input string is allowed to contain IUPAC ambiguity codes; ambiguous
30-
/// codons are represented by `X` in the output.
31-
///
32-
/// * `translate(b"CCNTACACK CATNCNAAT")` returns `b"PYTHXN"`
3327
#[pyfunction]
3428
fn _translate(py: Python, table: u8, dna: &PyBytes) -> PyResult<Py<PyAny>> {
3529
let table = TranslationTable::try_from(table)?;
3630
let bytes = table.translate_dna_bytes::<NucleotideAmbiguous>(dna.as_bytes())?;
3731
Ok(PyBytes::new(py, &bytes).into())
3832
}
3933

40-
/// Translate a bytestring of DNA nucleotides into a bytestring of amino acids.
41-
///
42-
/// The input string is validated to consist of unambiguous nucleotides (no IUPAC ambiguity codes).
43-
///
44-
/// * `translate_strict(b"AAACCCTTTGGG")` returns `b"KPFG"`
45-
/// * `translate_strict(b"AAACCCTTTGGN")` is an error.
4634
#[pyfunction]
4735
fn _translate_strict(py: Python, table: u8, dna: &PyBytes) -> PyResult<Py<PyAny>> {
4836
let table = TranslationTable::try_from(table)?;
4937
let bytes = table.translate_dna_bytes::<Nucleotide>(dna.as_bytes())?;
5038
Ok(PyBytes::new(py, &bytes).into())
5139
}
5240

53-
/// Get the reverse complement of a bytestring of DNA nucleotides.
54-
///
55-
/// The input string is allowed to contain IUPAC ambiguity codes.
56-
///
57-
/// * `reverse_complement(b"AAAAABCCC")` returns `b"GGGVTTTTT"`
5841
#[pyfunction]
5942
fn _reverse_complement(py: Python, dna: &PyBytes) -> PyResult<Py<PyAny>> {
6043
let bytes = reverse_complement_bytes::<NucleotideAmbiguous>(dna.as_bytes())?;
6144
Ok(PyBytes::new(py, &bytes).into())
6245
}
6346

64-
/// Get the reverse complement of a bytestring of DNA nucleotides.
65-
///
66-
/// The input string is validated to consist of unambiguous nucleotides (no IUPAC ambiguity codes).
67-
///
68-
/// * `reverse_complement_strict(b"AAAAAACCC")` returns `b"GGGTTTTTT"`
69-
/// * `reverse_complement_strict(b"AAAAAACCN")` is an error.
7047
#[pyfunction]
7148
fn _reverse_complement_strict(py: Python, dna: &PyBytes) -> PyResult<Py<PyAny>> {
7249
let bytes = reverse_complement_bytes::<Nucleotide>(dna.as_bytes())?;
7350
Ok(PyBytes::new(py, &bytes).into())
7451
}
7552

7653
#[pymodule]
77-
fn quickdna(_py: Python, m: &PyModule) -> PyResult<()> {
54+
fn quickdna(py: Python, m: &PyModule) -> PyResult<()> {
55+
// Wrap functions with the Python token
7856
m.add_function(wrap_pyfunction!(_check_table, m)?)?;
7957
m.add_function(wrap_pyfunction!(_translate, m)?)?;
8058
m.add_function(wrap_pyfunction!(_translate_strict, m)?)?;

0 commit comments

Comments
 (0)