KindLab / scDamAndTools

A set of functions for the processing of raw data generated by scDam&T-seq.
MIT License
3 stars 0 forks source link

Fetching GATC regions failed #3

Open BennyHz opened 6 months ago

BennyHz commented 6 months ago

Hello! I was trying to use fetch_region.py to conduct in silico digest. I trusted that we dowloaded the input genome.fa file correctly from Ensembl and used it to generate the GATC.position.bed.gz correctly viafind_motif_occurrences.py. But when the fetch_region.py was carried out like this: fetch_region.py -q -l 150 ./refarrays/genome.GATC.positions.bed.gz $FASTAFN, an error occurred: TypeError: a bytes-like object is required, not 'dict'. We find it trouble to understand why this error happened, cause there's not many space for customized operation in this code. It would be appreciated for any help!

krooijers commented 6 months ago

Hi!

I can't reproduce this issue. A stack trace leading up to the error, and a minimal reproducible example could be helpful to further diagnose.

Also, which python version are you using?

My python version:

python -V
Python 3.11.6

What I've done to verify this issue:

# Create some temp dir:
# cd /tmp/
# mkdir 2024.scDamAndTools.issue_3

# Create a venv for this issue
python -m venv .venv
source .venv/bin/activate

# Install the packages as per the instructions for scDamAndTools
pip install --upgrade pip wheel setuptools
pip install -I cython
pip install git+https://github.com/KindLab/scDamAndTools.git
# Create some example data
# mkdir data/
# vim data/reference.fa
cat data/reference.fa
>chr1
AGAAGATGACGAGACAGTGATGCA
TGAGAGACTGGAGATGATGGGAGA
TCACACAAACAAACAGTAAAAAAA

Generate the bed file:

find_motif_occurrences.py ./data/reference.fa GATC | gzip > data/motif_GATC.bed.gz
zcat data/motif_GATC.bed.gz 
chr1    46      50

Run fetch_regions.py:

fetch_regions.py -l 10 ./data/motif_GATC.bed.gz ./data/reference.fa 
>chr1_46_50_plus
GATCACACAA
>chr1_46_50_minus
GATCTCCCAT
BennyHz commented 6 months ago

Thanks a lot! I have fixed the problem by using a new virtual environment.