---
# System prepended metadata

title: Generating in silico nanopore reads

---

# Generating in silico nanopore reads

- [Start](#start)
	* [Downloading of mock data](#downloading-of-mock-data)
	* [Installing NanoSim](#installing-nanosim)
- [Read generation](#read-generation)

## Start
### Downloading of mock data
```
cd <your folder of choice>
curl -L -o mock-bug-and-human.fa.gz https://figshare.com/ndownloader/files/31454380
gunzip mock-bug-and-human.fa.gz
curl -L -o prepareDataForNanosim.py https://figshare.com/ndownloader/files/31468265
```

### Installing NanoSim
More info on NanoSim [here](https://github.com/bcgsc/NanoSim).
```
git clone https://github.com/bcgsc/NanoSim.git
conda create --name nanosim python=3.7
conda activate nanosim
conda install --file NanoSim/requirements.txt -c conda-forge -c bioconda
conda install scikit-learn=0.22
gunzip NanoSim/pre-trained_models/metagenome_ERR3152366_Log.tar.gz
```

## Read generation
If you want to generate more than 1000 reads, change the number below accordingly. The resulting file will be available in the folder `out/`.
```
mkdir -p tmp
mkdir -p tmp/genomes
mkdir -p out

python prepareDataForNanosim.py mock-bug-and-human.fa tmp/ 1000

simulator.py metagenome -gl tmp/genomeList.tsv -a tmp/abundance.tsv -dl tmp/dnaType.tsv -b albacore -c NanoSim/pre-trained_models/metagenome_ERR3152366_Log/training -o out/meta --fastq -t 4

mv out/meta_sample0_aligned_reads.fastq out/simulated-bug-and-human-nanopore.fq
rm out/meta_sample0_aligned_error_profile out/meta_sample0_unaligned_reads.fastq
rm -r tmp
```