You need to agree to share your contact information to access this dataset

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this dataset content.

Step 1 — Install Dependencies

pip install huggingface-hub pandas

Step 2 — Login

from huggingface_hub import login
login(token="YOUR_HF_TOKEN")

Download Script

import os
from huggingface_hub import snapshot_download

def download_superfocus_dataset(ids=None, local_dir="./superfocus_prediction"):
    """
    Downloads files from the yaolu-huggingface/SuperFocus dataset.
    
    Parameters:
    - ids (list of str or str): Prefix IDs to filter files (e.g., ['INT13', 'MEND142'] or 'NCBI2').
                               If None, the entire dataset will be downloaded.
    - local_dir (str): The local directory where files should be saved.
    """
    repo_id = "yaolu-huggingface/SuperFocus"
    repo_type = "dataset"
    
    # Ensure the local directory exists
    os.makedirs(local_dir, exist_ok=True)
    
    # Handle the filtering pattern if ids are provided
    
    if len(ids)>0:
        # Build wildcard patterns (e.g., ['INT13*', 'MEND142*'])
        allow_patterns = [f"{prefix}*" for prefix in ids]
        print(f"Downloading files matching prefixes {ids} from {repo_id}...")
    else:
        allow_patterns = "*"
        print(f"Downloading the entire dataset from {repo_id} (Warning: total size is ~221 GB)...")

    # Download using snapshot_download
    path = snapshot_download(
        repo_id=repo_id,
        repo_type=repo_type,
        local_dir=local_dir,
        allow_patterns=allow_patterns
    )
    
    print(f"Download complete. Files saved to: {path}")
    return

# --- Example Usage ---

# 1. Download only specific subsets (e.g., files starting with INT13 or MEND142)
# download_superfocus_dataset(ids=["INT13", "MEND142"])

# 2. Download files matching a single ID prefix
# download_superfocus_dataset(ids="NCBI2")

# 3. Download everything (Make sure you have 221+ GB of free space!)
# download_superfocus_dataset(ids=None)

Usage Examples

Download One Sample

download_superfocus_dataset(
    ids=["NCBI689"]
)

Download Multiple Samples

download_superfocus_dataset(
    ids=["NCBI689", "MEND62"]
)

Download Entire Dataset

download_superfocus_dataset()

Downloads last month
9