Skip to content

Commit

Permalink
Adding inference interface
Browse files Browse the repository at this point in the history
  • Loading branch information
zhfanrui committed Sep 18, 2024
1 parent a9c692e commit fd137d8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 31 deletions.
18 changes: 9 additions & 9 deletions deepsramp/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ def parse_afa(f, ref):
def blast(fa, name, db, blast_path):
uid = f'{uuid.uuid1()}'
sdf = utils.load(f'{db}.df')
# echop = subprocess.Popen(['echo', '-e', fa], stdout=subprocess.PIPE)
echop = subprocess.Popen(['echo', '-e', fa], stdout=subprocess.PIPE)
dbpath = f'{db}'
# res = subprocess.check_output(['blast/bin/blastn', '-db', dbpath, '-max_target_seqs', '5', '-num_threads', '35', '-outfmt', '6 qacc sacc evalue length pident qstart qend sstart send btop'], stdin=echop.stdout)
# if not res: return pd.DataFrame()
res = b'''NM_000546.6 ENST00000620739 0.0 2512 100.000 1 2512 49 2560 2512
NM_000546.6 ENST00000269305 0.0 2512 100.000 1 2512 49 2560 2512
NM_000546.6 ENST00000619485 0.0 2509 99.880 4 2512 1 2506 110G-C-A-2396
NM_000546.6 ENST00000445888 0.0 2509 99.880 4 2512 1 2506 110G-C-A-2396
NM_000546.6 ENST00000610292 0.0 2296 100.000 217 2512 325 2620 2296
NM_000546.6 ENST00000610292 1.68e-104 207 100.000 10 216 1 207 207'''
res = subprocess.check_output([f'{blast_path}/blastn', '-db', dbpath, '-max_target_seqs', '5', '-num_threads', '35', '-outfmt', '6 qacc sacc evalue length pident qstart qend sstart send btop'], stdin=echop.stdout)
if not res: return pd.DataFrame()
# res = b'''NM_000546.6 ENST00000620739 0.0 2512 100.000 1 2512 49 2560 2512
# NM_000546.6 ENST00000269305 0.0 2512 100.000 1 2512 49 2560 2512
# NM_000546.6 ENST00000619485 0.0 2509 99.880 4 2512 1 2506 110G-C-A-2396
# NM_000546.6 ENST00000445888 0.0 2509 99.880 4 2512 1 2506 110G-C-A-2396
# NM_000546.6 ENST00000610292 0.0 2296 100.000 217 2512 325 2620 2296
# NM_000546.6 ENST00000610292 1.68e-104 207 100.000 10 216 1 207 207'''
rdf = pd.read_csv(StringIO(res.decode()), comment='#', sep='\t', header=None)

ref = rdf[1][0]
Expand Down
42 changes: 21 additions & 21 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# deepSRAMP

SRAMP (http://www.cuilab.cn/sramp) is a popular mammalian m6A site predictor we previously developed (Nucleic Acids Res 2016). SRAMP has been totally cited by more than 570 papers (google scholar, 4-16, 2024) and represents the mostly used algorithm in this field. A large number of m6A sites were identified by the helps of SRAMP. After ~8 years after its development, Now we released deepSRAMP, which is designed based on a combined framework of transformer neural network and recurrent neural network by fusing the sequence and genomic position features. The results showed that SRAMP2 greatly outperforms its predecessor SRAMP with 14.2 increase of AUC and 26.8 increase of AUPRC, and greatly outperforms other state-of-the-art m6A predictors (WHISTLE and DeepPromise) with 15.0% and 17.2 increase of AUC and 38.7% and 41.2% increase of AUPRC, respectively.
[SRAMP](http://www.cuilab.cn/sramp) is a popular mammalian m6A site predictor we previously developed ([Nucleic Acids Res 2016](https://pubmed.ncbi.nlm.nih.gov/26896799/)). SRAMP has been totally cited by more than 570 papers (Google Scholar, 4-16, 2024) and represents the mostly used algorithm in this field. A large number of m6A sites were identified by the helps of SRAMP.

After ~8 years after its development, Now we released [deepSRAMP (www.cuilab.cn/deepsramp)](http://www.cuilab.cn/deepsramp) , which is designed based on a combined framework of transformer neural network and recurrent neural network by fusing the sequence and genomic position features. The results showed that SRAMP2 greatly outperforms its predecessor SRAMP with 15.0% increase of AUROC and 30.9% increase of AUPRC, and greatly outperforms other state-of-the-art m6A predictors (WHISTLE and DeepPromise) with average 16.1% and 18.3% increase of AUC and 43.9% and 46.4% increase of AUPRC, respectively.

![](fig/fig1a.png)

Expand All @@ -18,36 +20,45 @@ SRAMP (http://www.cuilab.cn/sramp) is a popular mammalian m6A site predictor we

## Installation

1. Install `conda` and create a virtual enviroument named `sramp` with `python` installed;
1. Install `conda` and create a virtual enviroument named `sramp` with `python` installed.
```sh
conda create -y -n sramp python
conda activate sramp
```
2. Clone this repo;
2. Clone this repo.
```sh
git clone https://github.com/zhfanrui/deepSRAMP.git
```
3. Install this package and dependencies;
3. Install this package and dependencies.
```sh
cd deepSRAMP
pip install .
```

### Inference Setup
## Usage
### Inference

1. Download `BLAST` and `Muscle`;
1. Download `BLAST` and `Muscle`.
```sh
sh setup_inference.sh
```
2.
3.
2. Prepare your query fasta and run
```sh
deepsramp predict \
--fasta /path/to/fasta.fa \
--db /path/to/database/hg38_mature \
--blast /path/to/blast/bin \
--model /path/to/model/full_400_mature.model \
--out ./result.csv
```


### Training Setup
### Train
1. Download `GTF` and `FASTA` files for training;
```sh
sh download.sh
```
2. See [tutorials](#Tutorials) for training.


<!-- 2. Install `deepSRAMP` through
Expand All @@ -58,17 +69,6 @@ pip install deepsramp
<!-- , especially for `data` and `model` folder; -->


## Usage

```sh
deepsramp predict \
--fasta /path/to/fasta.fa \
--db /path/to/database/hg38_mature \
--blast /path/to/blast/bin \
--model /path/to/model/full_400_mature.model \
--out ./result.csv
```


## Pretrained Models

Expand Down Expand Up @@ -101,7 +101,7 @@ The reproduction of figures in the paper can be found in `ipynb` files.

## Citation

paper
[paper]



Expand Down
3 changes: 2 additions & 1 deletion setup_inference.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ wget -c https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/ncbi-blast-
wget -c https://github.com/rcedgar/muscle/releases/download/v5.2/muscle-linux-x86.v5.2

tar zxvf ncbi-blast-2.16.0+-x64-linux.tar.gz
mv -r ncbi-blast-2.16.0+-x64-linux/bin ./bin
mv ncbi-blast-2.16.0+/bin ./bin
mv muscle-linux-x86.v5.2 bin/muscle
rm -rf ncbi-blast-2.16.0+/

# wget -c []

0 comments on commit fd137d8

Please sign in to comment.