debase 0.1.3__py3-none-any.whl → 0.1.4__py3-none-any.whl

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.
debase/_version.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """Version information."""
2
2
 
3
- __version__ = "0.1.3"
3
+ __version__ = "0.1.4"
@@ -800,15 +800,36 @@ def identify_evolution_locations(
800
800
  _dump(f"=== CAMPAIGN MAPPING PROMPT ===\nLocation: {location_str}\n{'='*80}\n\n{mapping_prompt}", mapping_file)
801
801
 
802
802
  response = model.generate_content(mapping_prompt)
803
- campaign_id = _extract_text(response).strip().strip('"')
803
+ response_text = _extract_text(response).strip()
804
+
805
+ # Extract just the campaign_id from the response
806
+ # Look for the campaign_id pattern in the response
807
+ campaign_id = None
808
+ for campaign in campaigns:
809
+ if hasattr(campaign, 'campaign_id') and campaign.campaign_id in response_text:
810
+ campaign_id = campaign.campaign_id
811
+ break
812
+
813
+ # If not found, try to extract the last line or quoted string
814
+ if not campaign_id:
815
+ # Try to find quoted string
816
+ quoted_match = re.search(r'"([^"]+)"', response_text)
817
+ if quoted_match:
818
+ campaign_id = quoted_match.group(1)
819
+ else:
820
+ # Take the last non-empty line
821
+ lines = [line.strip() for line in response_text.split('\n') if line.strip()]
822
+ if lines:
823
+ campaign_id = lines[-1].strip('"')
804
824
 
805
825
  # Save mapping response to debug if provided
806
826
  if debug_dir:
807
827
  response_file = debug_path / f"campaign_mapping_response_{location_str.replace(' ', '_')}_{int(time.time())}.txt"
808
- _dump(f"=== CAMPAIGN MAPPING RESPONSE ===\nLocation: {location_str}\nMapped to: {campaign_id}\n{'='*80}\n\n{_extract_text(response)}", response_file)
828
+ _dump(f"=== CAMPAIGN MAPPING RESPONSE ===\nLocation: {location_str}\nFull response:\n{response_text}\nExtracted campaign_id: {campaign_id}\n{'='*80}", response_file)
809
829
 
810
830
  # Add campaign_id to location
811
- loc['campaign_id'] = campaign_id
831
+ if campaign_id:
832
+ loc['campaign_id'] = campaign_id
812
833
  log.info(f"Mapped {location_str} to campaign: {campaign_id}")
813
834
  except Exception as exc:
814
835
  log.warning(f"Failed to map location to campaign: {exc}")
@@ -2038,8 +2059,15 @@ def run_pipeline(
2038
2059
  sequences = get_sequences(full_text, model, pdf_paths=pdf_paths, debug_dir=debug_dir)
2039
2060
 
2040
2061
  # 4a. Try PDB extraction if no sequences found -----------------------------
2041
- if not sequences or all(s.aa_seq is None for s in sequences):
2042
- log.info("No sequences found in paper, attempting PDB extraction...")
2062
+ # Check if we need PDB sequences (no sequences or only partial sequences)
2063
+ MIN_PROTEIN_LENGTH = 50 # Most proteins are >50 AA
2064
+ needs_pdb = (not sequences or
2065
+ all(s.aa_seq is None or (s.aa_seq and len(s.aa_seq) < MIN_PROTEIN_LENGTH)
2066
+ for s in sequences))
2067
+
2068
+ if needs_pdb:
2069
+ log.info("No full-length sequences found in paper (only partial sequences < %d AA), attempting PDB extraction...",
2070
+ MIN_PROTEIN_LENGTH)
2043
2071
 
2044
2072
  # Extract PDB IDs from all PDFs
2045
2073
  pdb_ids = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: debase
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Enzyme lineage analysis and sequence extraction package
5
5
  Home-page: https://github.com/YuemingLong/DEBase
6
6
  Author: DEBase Team
@@ -61,14 +61,70 @@ Enzyme lineage analysis and sequence extraction package with advanced parallel p
61
61
 
62
62
  ## Installation
63
63
 
64
+ ### Quick Install (PyPI)
64
65
  ```bash
65
66
  pip install debase
66
67
  ```
68
+
69
+ ### Development Setup with Conda (Recommended)
70
+
71
+ 1. **Clone the repository**
72
+ ```bash
73
+ git clone https://github.com/YuemingLong/DEBase.git
74
+ cd DEBase
75
+ ```
76
+
77
+ 2. **Create conda environment from provided file**
78
+ ```bash
79
+ conda env create -f environment.yml
80
+ conda activate debase
81
+ ```
82
+
83
+ 3. **Install DEBase in development mode**
84
+ ```bash
85
+ pip install -e .
86
+ ```
87
+
88
+ ### Manual Setup
89
+
90
+ If you prefer to set up the environment manually:
91
+
92
+ ```bash
93
+ # Create new conda environment
94
+ conda create -n debase python=3.9
95
+ conda activate debase
96
+
97
+ # Install conda packages
98
+ conda install -c conda-forge pandas numpy matplotlib seaborn jupyter jupyterlab openpyxl biopython requests tqdm
99
+
100
+ # Install RDKit (optional - used for SMILES canonicalization)
101
+ conda install -c conda-forge rdkit
102
+
103
+ # Install pip-only packages
104
+ pip install PyMuPDF google-generativeai debase
105
+ ```
106
+
107
+ **Note about RDKit**: RDKit is optional and only used for canonicalizing SMILES strings in the output. If not installed, DEBase will still function normally but SMILES strings won't be standardized.
108
+
67
109
  ## Requirements
68
110
 
69
111
  - Python 3.8 or higher
70
112
  - A Gemini API key (set as environment variable `GEMINI_API_KEY`)
71
113
 
114
+ ### Setting up Gemini API Key
115
+
116
+ ```bash
117
+ # Option 1: Export in your shell
118
+ export GEMINI_API_KEY="your-api-key-here"
119
+
120
+ # Option 2: Add to ~/.bashrc or ~/.zshrc for persistence
121
+ echo 'export GEMINI_API_KEY="your-api-key-here"' >> ~/.bashrc
122
+ source ~/.bashrc
123
+
124
+ # Option 3: Create .env file in project directory
125
+ echo 'GEMINI_API_KEY=your-api-key-here' > .env
126
+ ```
127
+
72
128
  ## Recent Updates
73
129
 
74
130
  - **Campaign-Aware Extraction**: Automatically detects and processes multiple directed evolution campaigns in a single paper
@@ -1,17 +1,17 @@
1
1
  debase/PIPELINE_FLOW.md,sha256=S4nQyZlX39-Bchw1gQWPK60sHiFpB1eWHqo5GR9oTY8,4741
2
2
  debase/__init__.py,sha256=YeKveGj_8fwuu5ozoK2mUU86so_FjiCwsvg1d_lYVZU,586
3
3
  debase/__main__.py,sha256=LbxYt2x9TG5Ced7LpzzX_8gkWyXeZSlVHzqHfqAiPwQ,160
4
- debase/_version.py,sha256=92QgGO0ZoG0AhULGdcMTX2RSEJkv8UZrDw2peYQOh4U,49
4
+ debase/_version.py,sha256=mcDHWqAxAKwMNAAyHmpWVDTK-zafQ1kQjmiwnsZbUD4,49
5
5
  debase/build_db.py,sha256=bW574GxsL1BJtDwM19urLbciPcejLzfraXZPpzm09FQ,7167
6
6
  debase/cleanup_sequence.py,sha256=QyhUqvTBVFTGM7ebAHmP3tif3Jq-8hvoLApYwAJtpH4,32702
7
- debase/enzyme_lineage_extractor.py,sha256=sJ9Lz7Usse5NqdoZatoOEDMwbMYEgNH1HCLIGS9avn8,87774
7
+ debase/enzyme_lineage_extractor.py,sha256=s1kPOomvJjfMSN5odxeyXNmxiaOzXyOZICr4YUWU6j8,89288
8
8
  debase/lineage_format.py,sha256=mACni9M1RXA_1tIyDZJpStQoutd_HLG2qQMAORTusZs,30045
9
9
  debase/reaction_info_extractor.py,sha256=6wWj4IyUNSugNjxpwMGjABSAp68yHABaz_7ZRjh9GEk,112162
10
10
  debase/substrate_scope_extractor.py,sha256=dbve8q3K7ggA3A6EwB-KK9L19BnMNgPZMZ05G937dSY,82262
11
11
  debase/wrapper.py,sha256=lTx375a57EVuXcZ_roXaj5UDj8HjRcb5ViNaSgPN4Ik,10352
12
- debase-0.1.3.dist-info/licenses/LICENSE,sha256=5sk9_tcNmr1r2iMIUAiioBo7wo38u8BrPlO7f0seqgE,1075
13
- debase-0.1.3.dist-info/METADATA,sha256=WUJha43ZPKgGDNZD1DYu8CfJwxUOj09kzuPSqfwe96s,9382
14
- debase-0.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
- debase-0.1.3.dist-info/entry_points.txt,sha256=hUcxA1b4xORu-HHBFTe9u2KTdbxPzt0dwz95_6JNe9M,48
16
- debase-0.1.3.dist-info/top_level.txt,sha256=2BUeq-4kmQr0Rhl06AnRzmmZNs8WzBRK9OcJehkcdk8,7
17
- debase-0.1.3.dist-info/RECORD,,
12
+ debase-0.1.4.dist-info/licenses/LICENSE,sha256=5sk9_tcNmr1r2iMIUAiioBo7wo38u8BrPlO7f0seqgE,1075
13
+ debase-0.1.4.dist-info/METADATA,sha256=fZwXCP1i1s0VNq7Ds5bd2ys3pONgaV1XCe_edUkQdRU,10789
14
+ debase-0.1.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
+ debase-0.1.4.dist-info/entry_points.txt,sha256=hUcxA1b4xORu-HHBFTe9u2KTdbxPzt0dwz95_6JNe9M,48
16
+ debase-0.1.4.dist-info/top_level.txt,sha256=2BUeq-4kmQr0Rhl06AnRzmmZNs8WzBRK9OcJehkcdk8,7
17
+ debase-0.1.4.dist-info/RECORD,,
File without changes