Skip to content

Repository files navigation

MARCUS Logo

Molecular Annotation and Recognition for Curating Unravelled Structures

License Version FastAPI Vue.js Docker


πŸ“š Table of Contents


πŸ”¬ Overview

Project MARCUS is a comprehensive platform for extracting, recognizing, and processing molecular structures from scientific literature. The system integrates multiple advanced technologies to create an end-to-end pipeline from PDF processing to molecular structure recognition and visualization.


🧠 Key Features

πŸ“„ PDF Processing

  • Extract DOIs from scientific PDFs
  • Segment PDFs to identify chemical structures
  • Organize segments hierarchically

πŸ”¬ OCSR Engines

  • DECIMER: SMILES generation with hand-drawn support
  • MolNexTR: SMILES and molfiles with coordinates
  • MolScribe: Advanced structure recognition

🎨 Chemical Depiction

  • Convert SMILES/molfiles to visualizations
  • CDK-powered high-quality rendering
  • Multiple formats (SVG, PNG, Base64)

πŸ€– Text Analysis

  • Fine-tuned OpenAI model integration
  • Extract structured chemical data from text
  • Maintain extraction result archives

πŸ—οΈ Architecture

Project MARCUS follows a modern microservices architecture:

  • Backend: FastAPI application with versioned API endpoints
  • Frontend: Vue.js application for user interaction
  • Containerization: Docker for consistent deployment

πŸš€ Getting Started

Prerequisites

Software Requirements:

  • Docker Engine 20.10+ with NVIDIA Container Toolkit
  • Docker Compose
  • Python 3.10+ (for development)
  • Node.js and npm (for frontend development)
  • OpenAI API key (required for AI features)
  • Stable internet connectivity for OpenAI API integration

Hardware Requirements:

  • GPU: NVIDIA GPU with ~20GB VRAM (development used V100)
  • CPU: Minimum 8-core (16-core recommended)
  • RAM: 32GB recommended (minimum requirements may vary)
  • Storage: ~50GB for container images and processing files
  • Concurrent Users: Up to 3 users (GPU memory limited, scalable with additional hardware)
  • Container Runtime: Docker Engine 20.10+ with NVIDIA Container Toolkit

Environment Configuration

Before running the application, copy the example environment file and configure your settings:

cp .env.example .env

Required Environment Variables:

  • OPENAI_API_KEY: Your OpenAI API key for AI-powered text analysis
  • OPENAI_MODEL_ID: OpenAI model to use (e.g., gpt-4, gpt-3.5-turbo)

Optional Configuration:

  • MARCUS_MAX_CONCURRENT_USERS: Maximum concurrent users (default: 3)
  • VUE_APP_BACKEND_URL: Backend URL for frontend (default: http://localhost:9000)

See .env.example for all available configuration options.

Installation

Step 1: Clone the repository

git clone https://github.com/Kohulan/MARCUS.git
cd MARCUS
docker-compose up -d

For Apple Silicon (M1/M2/M3) Mac users:

docker-compose -f docker-compose.mac.yml up -d

System Architecture Considerations

  • x86/x64 Systems: Use the standard docker-compose.yml file which includes CUDA dependencies for optimal performance.
  • Apple Silicon Macs: Use the Mac-specific docker-compose.mac.yml file which resolves TensorFlow and CUDA compatibility issues on ARM architecture.

πŸ”Œ API Reference

The API is versioned and provides the following main endpoints:

Category Endpoints
PDF Processing POST /v1/decimer/extract_doi: Extract DOI from uploaded PDF
POST /v1/decimer/extract_segments: Extract chemical structure segments
OCSR POST /v1/ocsr/generate_smiles: Generate SMILES from structure image
POST /v1/ocsr/generate_molfile: Generate molfile from structure image
POST /v1/ocsr/generate_both: Generate both SMILES and molfile
Depiction POST /v1/depiction/generate: Generate molecular depiction
POST /v1/depiction/visualize: Visualize a molecular structure
Text Annotation POST /v1/openai/extract_json: Extract structured JSON data from text
POST /v1/openai/extract_positions: Extract entity positions from text

For complete API documentation, refer to the Swagger UI at /v1/docs.


πŸ’» Development

Backend Development

cd backend
pip install -r requirements.txt
uvicorn app.main:app --reload

Frontend Development

cd frontend
npm install
npm run serve

πŸ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ“§ Contact


πŸ™ Acknowledgements

This project utilizes several open-source cheminformatics tools:


About

Molecular Annotation and Recognition for Curating Unravelled Structures

Resources

Stars

30 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages