Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CREATED BY 4R7I5T -- OPEN SOURCE CANCER CURE FRAMEWORK. YOU CAN PURCHASE THE GUIDES ONLINE THROUGH REPUTABLE VENDORS. BE CAREFUL! INTEGRATION WITH BIOLLM SOON.

To perform the analysis using GPT-4o for CRISPR-Cas9 gene edits, you will need to integrate GPT-4o with your local setup. Below is an updated guide, including the installation of necessary libraries, setting up the environment, and using GPT-4o for analysis.

Step-by-Step Guide for Genomic Analysis and CRISPR Suggestions with GPT-4o

  1. Set Up the Environment

Install required dependencies:

Update and install dependencies (Mac)

brew update brew install bwa samtools bcftools cmake git wget openjdk htslib freebayes

Update and install dependencies (Linux)

pip install -r requirements.txt

1a. Install FreeBayes

git clone --recursive https://github.com/freebayes/freebayes.git cd freebayes make sudo mv bin/freebayes /usr/local/bin/

  1. Download the Reference Genome and Sample Data

Prepare your working directory and download the necessary files:

mkdir -p ~/genome_analysis cd ~/genome_analysis

Download GRCh38 reference genome (FASTA format)

wget -O GRCh38.fna.gz ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/000/001/405/GCA_000001405.15_GRCh38/GCA_000001405.15_GRCh38_genomic.fna.gz

gunzip GRCh38.fna.gz

Download sample data

wget -O WGS_Norm.tar http://genomedata.org/pmbio-workshop/fastqs/WGS_Norm.tar wget -O WGS_Tumor.tar http://genomedata.org/pmbio-workshop/fastqs/WGS_Tumor.tar

Unpack the individual fastq files

mkdir -p fastq cd fastq tar -xvf ../WGS_Norm.tar tar -xvf ../WGS_Tumor.tar cd ..

  1. Index the Reference Genome

bwa index GRCh38.fna

  1. Align the Reads to the Reference Genome

Align the reads for each lane:

Align normal sample reads to reference genome (Lane 1)

bwa mem GRCh38.fna fastq/WGS_Norm_Lane1_R1.fastq.gz fastq/WGS_Norm_Lane1_R2.fastq.gz > normal_Lane1.sam samtools view -S -b normal_Lane1.sam > normal_Lane1.bam samtools sort normal_Lane1.bam -o normal_Lane1_sorted.bam samtools index normal_Lane1_sorted.bam

Repeat for Lane 2 and Lane 3

bwa mem GRCh38.fna fastq/WGS_Norm_Lane2_R1.fastq.gz fastq/WGS_Norm_Lane2_R2.fastq.gz > normal_Lane2.sam samtools view -S -b normal_Lane2.sam > normal_Lane2.bam samtools sort normal_Lane2.bam -o normal_Lane2_sorted.bam samtools index normal_Lane2_sorted.bam

bwa mem GRCh38.fna fastq/WGS_Norm_Lane3_R1.fastq.gz fastq/WGS_Norm_Lane3_R2.fastq.gz > normal_Lane3.sam samtools view -S -b normal_Lane3.sam > normal_Lane3.bam samtools sort normal_Lane3.bam -o normal_Lane3_sorted.bam samtools index normal_Lane3_sorted.bam

Align tumor sample reads to reference genome (Lane 1)

bwa mem GRCh38.fna fastq/WGS_Tumor_Lane1_R1.fastq.gz fastq/WGS_Tumor_Lane1_R2.fastq.gz > tumor_Lane1.sam samtools view -S -b tumor_Lane1.sam > tumor_Lane1.bam samtools sort tumor_Lane1.bam -o tumor_Lane1_sorted.bam samtools index tumor_Lane1_sorted.bam

Repeat for Lane 2 and Lane 3

bwa mem GRCh38.fna fastq/WGS_Tumor_Lane2_R1.fastq.gz fastq/WGS_Tumor_Lane2_R2.fastq.gz > tumor_Lane2.sam samtools view -S -b tumor_Lane2.sam > tumor_Lane2.bam samtools sort tumor_Lane2.bam -o tumor_Lane2_sorted.bam samtools index tumor_Lane2_sorted.bam

bwa mem GRCh38.fna fastq/WGS_Tumor_Lane3_R1.fastq.gz fastq/WGS_Tumor_Lane3_R2.fastq.gz > tumor_Lane3.sam samtools view -S -b tumor_Lane3.sam > tumor_Lane3.bam samtools sort tumor_Lane3.bam -o tumor_Lane3_sorted.bam samtools index tumor_Lane3_sorted.bam

  1. Merge BAM Files for Each Sample

Merge BAM files for normal sample

samtools merge normal_merged.bam normal_Lane1_sorted.bam normal_Lane2_sorted.bam normal_Lane3_sorted.bam samtools sort normal_merged.bam -o normal_sorted.bam samtools index normal_sorted.bam

Merge BAM files for tumor sample

samtools merge tumor_merged.bam tumor_Lane1_sorted.bam tumor_Lane2_sorted.bam tumor_Lane3_sorted.bam samtools sort tumor_merged.bam -o tumor_sorted.bam samtools index tumor_sorted.bam

  1. Perform Variant Calling

Perform variant calling on the normal sample

freebayes -f GRCh38.fna normal_sorted.bam > normal_variants.vcf

Perform variant calling on the tumor sample

freebayes -f GRCh38.fna tumor_sorted.bam > tumor_variants.vcf

  1. Compress and Index VCF Files

bgzip tumor_variants.vcf bgzip normal_variants.vcf

tabix tumor_variants.vcf.gz tabix normal_variants.vcf.gz

  1. Compare Variants

bcftools isec -p variant_comparison -O v tumor_variants.vcf.gz normal_variants.vcf.gz

  1. Annotate Variants Using SnpEff

Download and Unzip SnpEff

wget http://sourceforge.net/projects/snpeff/files/snpEff_latest_core.zip unzip snpEff_latest_core.zip cd snpEff

Manually Download the GRCh38.92 Database

wget https://snpeff.blob.core.windows.net/databases/v5_0/snpEff_v5_0_GRCh38.92.zip

Extract the Database

unzip snpEff_v5_0_GRCh38.92.zip -d data/

Edit the Configuration File

bash nano snpEff.config

Add:

GRCh38.92.genome : Human genome version GRCh38 (Ensembl 92)

Annotate the VCF File

java -jar snpEff.jar GRCh38.92 ../genome_analysis/variant_comparison/0002.vcf > ../genome_analysis/annotated_variants.vcf

Python Script for GPT-4o Analysis (gpt4o_crispr.py)

Create the Python script in your working directory:

import openai

Set up the OpenAI API key

openai.api_key = "your_openai_api_key"

Read the annotated variants file

with open('../genome_analysis/annotated_variants.vcf', 'r') as file: annotated_variants = file.read()

Define a function to get CRISPR-Cas9 suggestions from GPT-4o

def get_crispr_suggestions(text): prompt = f"Based on the following annotated variants from a tumor-normal comparison, suggest specific CRISPR-Cas9 gene edits that can revert the tumor genome to the normal state:\n\n{text}" response = openai.Completion.create( engine="gpt-4o", prompt=prompt, max_tokens=1000 ) return response.choices[0].text.strip()

Get CRISPR-Cas9 gene edit suggestions from GPT-4o

crispr_suggestions = get_crispr_suggestions(annotated_variants)

Print the CRISPR-Cas9 gene edit suggestions

print(crispr_suggestions)

Run the Python Script

python gpt4o_crispr.py

By following these steps, you should be able to manually download the GRCh38.92 database for SnpEff, annotate your VCF file, and proceed with CRISPR-Cas9 gene edit suggestions using GPT-4o.

NOW THAT PRELIMINARY PROCESSING IS DONE - THE TRAINING SET PREP HAPPENS BY RUNNING THE PYTHON SCRIPTS ONE BY ONE:

E.G. (python Step1.py... python step2.py...)

Step 1: Process VCF File for CRISPR-Cas9 Gene Edits

This step takes a variant call format (VCF) file that contains genomic data (from a tumor-normal comparison) and prepares a prompt to be used later by OpenAI’s GPT model. It extracts important metadata from the VCF file (such as the contig, file format, reference genome, etc.) and constructs a detailed prompt asking GPT to suggest specific CRISPR-Cas9 gene edits that could revert the tumor genome to a normal state.

Step 2: Token Counting

This step counts the number of tokens in a given file using GPT-2 tokenization. It reads a file in chunks, tokenizes the text, and counts how many tokens are present. This is useful for determining the size of data to be sent to the OpenAI API, as there is often a token limit in requests.

Step 3: OpenAI API Interaction

This step sends the prompt created in Step 1 to the OpenAI API, along with the genomic data, to get specific CRISPR-Cas9 gene editing suggestions. It handles the communication with OpenAI’s API by providing the prompt and receiving the AI’s response, which is saved to a CSV file for further use.

Step 4: Additional Data Processing

Step4a.py: This Python script processes the genomic data further, preparing it for downstream tasks. It may involve tasks like parsing and validating the input data (e.g., the VCF files or sequences) and performing intermediate calculations or formatting.

Step4b.sh: This shell script likely handles file operations or calls external tools to manipulate the data. It could involve system-level tasks such as invoking tools like samtools or other command-line utilities.

Step 5: Extract Sequence Data

This shell script likely performs extraction of sequence data from genomic files (such as FASTA or FASTQ files). It could involve using tools like samtools or bcftools to manipulate BAM files (binary alignment) and prepare the data for further use in the pipeline. Purpose: To extract genomic sequences and align them to the reference genome, preparing the data for CRISPR analysis.

Step 6: Data Formatting

This step formats the extracted sequence data from Step 5 into a format that is usable for machine learning or CRISPR analysis. This might involve cleaning up the sequences, converting them into a standard format, or ensuring that they are compatible with the next steps in the pipeline.

Step 7: Prepare JSONL Data for Model Training

This step processes the cleaned sequence data and prepares it in .jsonl (JSON Lines) format, which is commonly used for training machine learning models. It reads the CRISPR-related data (e.g., sequences and associated guide RNA), formats it correctly, and outputs a file ready to be used for model training.

Step 8: Sequence Cleaning and Validation

This final step cleans and validates the sequences from the JSONL file to ensure that they meet the necessary standards. It removes any invalid characters (e.g., ‘N’ in DNA sequences) and ensures that only valid nucleotide bases (A, C, G, T) remain. Purpose: To finalize and validate the sequences to ensure accuracy before they are used in machine learning models or CRISPR research.

These eight steps form a comprehensive pipeline for processing genomic data, generating CRISPR-Cas9 gene-editing suggestions using AI, and formatting the data for machine learning models to assist in cancer research.

About

Core OpenCure Cancer Research Repo by 4R7I5T

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages