seqmat 1.0.0__tar.gz → 1.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {seqmat-1.0.0/seqmat.egg-info → seqmat-1.1.1}/PKG-INFO +3 -17
  2. {seqmat-1.0.0 → seqmat-1.1.1}/README.md +2 -15
  3. {seqmat-1.0.0 → seqmat-1.1.1}/requirements.txt +0 -1
  4. {seqmat-1.0.0 → seqmat-1.1.1}/seqmat/__init__.py +1 -1
  5. {seqmat-1.0.0 → seqmat-1.1.1}/seqmat/seqmat.py +15 -0
  6. {seqmat-1.0.0 → seqmat-1.1.1}/seqmat/transcript.py +27 -10
  7. {seqmat-1.0.0 → seqmat-1.1.1/seqmat.egg-info}/PKG-INFO +3 -17
  8. {seqmat-1.0.0 → seqmat-1.1.1}/seqmat.egg-info/requires.txt +0 -1
  9. {seqmat-1.0.0 → seqmat-1.1.1}/setup.py +1 -2
  10. {seqmat-1.0.0 → seqmat-1.1.1}/LICENSE +0 -0
  11. {seqmat-1.0.0 → seqmat-1.1.1}/MANIFEST.in +0 -0
  12. {seqmat-1.0.0 → seqmat-1.1.1}/examples/basic_usage.py +0 -0
  13. {seqmat-1.0.0 → seqmat-1.1.1}/examples/data_inspection.py +0 -0
  14. {seqmat-1.0.0 → seqmat-1.1.1}/seqmat/cli.py +0 -0
  15. {seqmat-1.0.0 → seqmat-1.1.1}/seqmat/config.py +0 -0
  16. {seqmat-1.0.0 → seqmat-1.1.1}/seqmat/gene.py +0 -0
  17. {seqmat-1.0.0 → seqmat-1.1.1}/seqmat/lmdb_store.py +0 -0
  18. {seqmat-1.0.0 → seqmat-1.1.1}/seqmat/sqlite_store.py +0 -0
  19. {seqmat-1.0.0 → seqmat-1.1.1}/seqmat/utils.py +0 -0
  20. {seqmat-1.0.0 → seqmat-1.1.1}/seqmat.egg-info/SOURCES.txt +0 -0
  21. {seqmat-1.0.0 → seqmat-1.1.1}/seqmat.egg-info/dependency_links.txt +0 -0
  22. {seqmat-1.0.0 → seqmat-1.1.1}/seqmat.egg-info/entry_points.txt +0 -0
  23. {seqmat-1.0.0 → seqmat-1.1.1}/seqmat.egg-info/top_level.txt +0 -0
  24. {seqmat-1.0.0 → seqmat-1.1.1}/setup.cfg +0 -0
  25. {seqmat-1.0.0 → seqmat-1.1.1}/tests/__init__.py +0 -0
  26. {seqmat-1.0.0 → seqmat-1.1.1}/tests/test_gene.py +0 -0
  27. {seqmat-1.0.0 → seqmat-1.1.1}/tests/test_seqmat.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: seqmat
3
- Version: 1.0.0
3
+ Version: 1.1.1
4
4
  Summary: Lightning-fast gene manipulation and analysis library.
5
5
  Home-page: https://github.com/nicolasalynn/seqmat
6
6
  Author: Nicolas Lynn Vila
@@ -22,7 +22,6 @@ Requires-Dist: pyarrow>=15.0.0
22
22
  Requires-Dist: pysam>=0.19.0
23
23
  Requires-Dist: requests>=2.26.0
24
24
  Requires-Dist: tqdm>=4.62.0
25
- Requires-Dist: biopython>=1.79
26
25
  Requires-Dist: platformdirs>=3.0.0
27
26
  Provides-Extra: lmdb
28
27
  Requires-Dist: lmdb>=1.4.0; extra == "lmdb"
@@ -77,18 +76,6 @@ seqmat setup
77
76
 
78
77
  This downloads prebuilt data (genes.db + FASTA) from SeqMat's S3 bucket into a dedicated directory on your machine. No config file is required: the installer can add `SEQMAT_DATA_DIR` to your shell config so SeqMat finds the data in future sessions.
79
78
 
80
- ### With Bioinformatics Features
81
- ```bash
82
- # For protein translation
83
- pip install seqmat[bio]
84
-
85
- # For GTF parsing and genomics data setup
86
- pip install seqmat[genomics]
87
-
88
- # Install everything
89
- pip install seqmat[all]
90
- ```
91
-
92
79
  ### From Source
93
80
  ```bash
94
81
  git clone https://github.com/yourusername/seqmat.git
@@ -218,7 +205,7 @@ print(f"Introns: {len(transcript.introns)}")
218
205
  transcript.generate_mature_mrna()
219
206
  print(f"Mature mRNA length: {len(transcript.mature_mrna)} bp")
220
207
 
221
- # Generate protein (if protein-coding and BioPython available)
208
+ # Generate protein (if protein-coding)
222
209
  if transcript.protein_coding:
223
210
  protein = transcript.generate_protein()
224
211
  print(f"Protein length: {len(transcript.protein)} aa")
@@ -661,7 +648,7 @@ $ seqmat summary
661
648
 
662
649
  - `generate_pre_mrna()`: Create pre-mRNA sequence
663
650
  - `generate_mature_mrna()`: Create spliced mRNA
664
- - `generate_protein()`: Translate to protein (requires BioPython)
651
+ - `generate_protein()`: Translate to protein
665
652
  - `exons`/`introns`: Genomic coordinates
666
653
  - `protein_coding`: Boolean flag
667
654
 
@@ -747,7 +734,6 @@ SeqMat is optimized for performance:
747
734
  - tqdm >= 4.62.0
748
735
 
749
736
  **Optional:**
750
- - biopython >= 1.79 (for protein translation)
751
737
  - gtfparse >= 1.2.0 (for genomics data setup)
752
738
  - pyarrow >= 14 (included; used for parquet export in `save_seqmat`)
753
739
 
@@ -31,18 +31,6 @@ seqmat setup
31
31
 
32
32
  This downloads prebuilt data (genes.db + FASTA) from SeqMat's S3 bucket into a dedicated directory on your machine. No config file is required: the installer can add `SEQMAT_DATA_DIR` to your shell config so SeqMat finds the data in future sessions.
33
33
 
34
- ### With Bioinformatics Features
35
- ```bash
36
- # For protein translation
37
- pip install seqmat[bio]
38
-
39
- # For GTF parsing and genomics data setup
40
- pip install seqmat[genomics]
41
-
42
- # Install everything
43
- pip install seqmat[all]
44
- ```
45
-
46
34
  ### From Source
47
35
  ```bash
48
36
  git clone https://github.com/yourusername/seqmat.git
@@ -172,7 +160,7 @@ print(f"Introns: {len(transcript.introns)}")
172
160
  transcript.generate_mature_mrna()
173
161
  print(f"Mature mRNA length: {len(transcript.mature_mrna)} bp")
174
162
 
175
- # Generate protein (if protein-coding and BioPython available)
163
+ # Generate protein (if protein-coding)
176
164
  if transcript.protein_coding:
177
165
  protein = transcript.generate_protein()
178
166
  print(f"Protein length: {len(transcript.protein)} aa")
@@ -615,7 +603,7 @@ $ seqmat summary
615
603
 
616
604
  - `generate_pre_mrna()`: Create pre-mRNA sequence
617
605
  - `generate_mature_mrna()`: Create spliced mRNA
618
- - `generate_protein()`: Translate to protein (requires BioPython)
606
+ - `generate_protein()`: Translate to protein
619
607
  - `exons`/`introns`: Genomic coordinates
620
608
  - `protein_coding`: Boolean flag
621
609
 
@@ -701,7 +689,6 @@ SeqMat is optimized for performance:
701
689
  - tqdm >= 4.62.0
702
690
 
703
691
  **Optional:**
704
- - biopython >= 1.79 (for protein translation)
705
692
  - gtfparse >= 1.2.0 (for genomics data setup)
706
693
  - pyarrow >= 14 (included; used for parquet export in `save_seqmat`)
707
694
 
@@ -5,5 +5,4 @@ pyarrow>=15.0.0
5
5
  pysam>=0.19.0
6
6
  requests>=2.26.0
7
7
  tqdm>=4.62.0
8
- biopython>=1.79
9
8
  platformdirs>=3.0.0
@@ -5,7 +5,7 @@ A comprehensive Python library for genomic sequence analysis with full mutation
5
5
  splicing analysis, and sequence manipulation.
6
6
  """
7
7
 
8
- __version__ = "1.0.0"
8
+ __version__ = "1.1.1"
9
9
  __author__ = "Nicolas Lynn Vila"
10
10
  __email__ = "nicolasalynn@gmail.com"
11
11
 
@@ -190,6 +190,21 @@ class SeqMat:
190
190
  """Return the reference sequence as a string (only valid bases)."""
191
191
  return self.seq_array['ref'][self.seq_array['valid']].tobytes().decode()
192
192
 
193
+ def alignment(self) -> Tuple[str, str]:
194
+ """Return gapped reference and mutated sequences aligned to each other.
195
+
196
+ Deletions appear as '-' in the mutated string, insertions appear as '-'
197
+ in the reference string, and SNPs show the differing bases at the same
198
+ position.
199
+
200
+ Returns:
201
+ (reference, mutated) tuple of equal-length strings.
202
+ """
203
+ arr = self.seq_array
204
+ ref = arr['ref'].tobytes().decode()
205
+ mut = np.where(arr['valid'], arr['nt'], b'-').tobytes().decode()
206
+ return ref, mut
207
+
193
208
  @property
194
209
  def index(self) -> np.ndarray:
195
210
  """Return the genomic indices of valid bases."""
@@ -7,11 +7,32 @@ from typing import Any, Dict, List, Optional, Tuple, Union
7
7
 
8
8
  import numpy as np
9
9
 
10
- try:
11
- from Bio.Seq import Seq
12
- BIOPYTHON_AVAILABLE = True
13
- except ImportError:
14
- BIOPYTHON_AVAILABLE = False
10
+ _CODON_TABLE = {
11
+ 'TTT': 'F', 'TTC': 'F', 'TTA': 'L', 'TTG': 'L',
12
+ 'CTT': 'L', 'CTC': 'L', 'CTA': 'L', 'CTG': 'L',
13
+ 'ATT': 'I', 'ATC': 'I', 'ATA': 'I', 'ATG': 'M',
14
+ 'GTT': 'V', 'GTC': 'V', 'GTA': 'V', 'GTG': 'V',
15
+ 'TCT': 'S', 'TCC': 'S', 'TCA': 'S', 'TCG': 'S',
16
+ 'CCT': 'P', 'CCC': 'P', 'CCA': 'P', 'CCG': 'P',
17
+ 'ACT': 'T', 'ACC': 'T', 'ACA': 'T', 'ACG': 'T',
18
+ 'GCT': 'A', 'GCC': 'A', 'GCA': 'A', 'GCG': 'A',
19
+ 'TAT': 'Y', 'TAC': 'Y', 'TAA': '*', 'TAG': '*',
20
+ 'CAT': 'H', 'CAC': 'H', 'CAA': 'Q', 'CAG': 'Q',
21
+ 'AAT': 'N', 'AAC': 'N', 'AAA': 'K', 'AAG': 'K',
22
+ 'GAT': 'D', 'GAC': 'D', 'GAA': 'E', 'GAG': 'E',
23
+ 'TGT': 'C', 'TGC': 'C', 'TGA': '*', 'TGG': 'W',
24
+ 'CGT': 'R', 'CGC': 'R', 'CGA': 'R', 'CGG': 'R',
25
+ 'AGT': 'S', 'AGC': 'S', 'AGA': 'R', 'AGG': 'R',
26
+ 'GGT': 'G', 'GGC': 'G', 'GGA': 'G', 'GGG': 'G',
27
+ }
28
+
29
+
30
+ def _translate(seq: str) -> str:
31
+ """Translate a nucleotide sequence to protein using the standard codon table."""
32
+ seq = seq.upper()
33
+ # Trim to multiple of 3 (avoids partial-codon warnings)
34
+ trimmed = seq[:len(seq) - len(seq) % 3] if len(seq) % 3 else seq
35
+ return ''.join(_CODON_TABLE.get(trimmed[i:i+3], 'X') for i in range(0, len(trimmed), 3))
15
36
 
16
37
  from .seqmat import SeqMat
17
38
  from .config import get_organism_config, get_default_organism
@@ -309,14 +330,10 @@ class Transcript:
309
330
  if not self.protein_coding:
310
331
  return self if inplace else ""
311
332
 
312
- if not BIOPYTHON_AVAILABLE:
313
- print("BioPython not available. Cannot translate to protein.")
314
- return self if inplace else ""
315
-
316
333
  # Translate the ORF to protein
317
334
  orf_seq = self.orf
318
335
  if isinstance(orf_seq, SeqMat):
319
- protein = str(Seq(orf_seq.seq).translate()).strip('*')
336
+ protein = _translate(orf_seq.seq).strip('*')
320
337
  else:
321
338
  protein = ""
322
339
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: seqmat
3
- Version: 1.0.0
3
+ Version: 1.1.1
4
4
  Summary: Lightning-fast gene manipulation and analysis library.
5
5
  Home-page: https://github.com/nicolasalynn/seqmat
6
6
  Author: Nicolas Lynn Vila
@@ -22,7 +22,6 @@ Requires-Dist: pyarrow>=15.0.0
22
22
  Requires-Dist: pysam>=0.19.0
23
23
  Requires-Dist: requests>=2.26.0
24
24
  Requires-Dist: tqdm>=4.62.0
25
- Requires-Dist: biopython>=1.79
26
25
  Requires-Dist: platformdirs>=3.0.0
27
26
  Provides-Extra: lmdb
28
27
  Requires-Dist: lmdb>=1.4.0; extra == "lmdb"
@@ -77,18 +76,6 @@ seqmat setup
77
76
 
78
77
  This downloads prebuilt data (genes.db + FASTA) from SeqMat's S3 bucket into a dedicated directory on your machine. No config file is required: the installer can add `SEQMAT_DATA_DIR` to your shell config so SeqMat finds the data in future sessions.
79
78
 
80
- ### With Bioinformatics Features
81
- ```bash
82
- # For protein translation
83
- pip install seqmat[bio]
84
-
85
- # For GTF parsing and genomics data setup
86
- pip install seqmat[genomics]
87
-
88
- # Install everything
89
- pip install seqmat[all]
90
- ```
91
-
92
79
  ### From Source
93
80
  ```bash
94
81
  git clone https://github.com/yourusername/seqmat.git
@@ -218,7 +205,7 @@ print(f"Introns: {len(transcript.introns)}")
218
205
  transcript.generate_mature_mrna()
219
206
  print(f"Mature mRNA length: {len(transcript.mature_mrna)} bp")
220
207
 
221
- # Generate protein (if protein-coding and BioPython available)
208
+ # Generate protein (if protein-coding)
222
209
  if transcript.protein_coding:
223
210
  protein = transcript.generate_protein()
224
211
  print(f"Protein length: {len(transcript.protein)} aa")
@@ -661,7 +648,7 @@ $ seqmat summary
661
648
 
662
649
  - `generate_pre_mrna()`: Create pre-mRNA sequence
663
650
  - `generate_mature_mrna()`: Create spliced mRNA
664
- - `generate_protein()`: Translate to protein (requires BioPython)
651
+ - `generate_protein()`: Translate to protein
665
652
  - `exons`/`introns`: Genomic coordinates
666
653
  - `protein_coding`: Boolean flag
667
654
 
@@ -747,7 +734,6 @@ SeqMat is optimized for performance:
747
734
  - tqdm >= 4.62.0
748
735
 
749
736
  **Optional:**
750
- - biopython >= 1.79 (for protein translation)
751
737
  - gtfparse >= 1.2.0 (for genomics data setup)
752
738
  - pyarrow >= 14 (included; used for parquet export in `save_seqmat`)
753
739
 
@@ -4,7 +4,6 @@ pyarrow>=15.0.0
4
4
  pysam>=0.19.0
5
5
  requests>=2.26.0
6
6
  tqdm>=4.62.0
7
- biopython>=1.79
8
7
  platformdirs>=3.0.0
9
8
 
10
9
  [dev]
@@ -8,7 +8,7 @@ long_description = (this_directory / "README.md").read_text()
8
8
 
9
9
  setup(
10
10
  name="seqmat",
11
- version="1.0.0",
11
+ version="1.1.1",
12
12
  author="Nicolas Lynn Vila",
13
13
  author_email="nicolasalynn@gmail.com",
14
14
  description="Lightning-fast gene manipulation and analysis library.",
@@ -34,7 +34,6 @@ setup(
34
34
  "pysam>=0.19.0",
35
35
  "requests>=2.26.0",
36
36
  "tqdm>=4.62.0",
37
- "biopython>=1.79",
38
37
  "platformdirs>=3.0.0",
39
38
  ],
40
39
  extras_require={
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes