r3fang / SnapTools

A module for working with snap files in Python
Apache License 2.0
35 stars 21 forks source link

snap-add-gmat error #5

Open plbngl opened 5 years ago

plbngl commented 5 years ago

Hello! I am trying to run your pipeline following your examples to create snap files but had a few errors:

1) When running the index-genome and the align-paired-end commands, I had tab/space/indentation errors coming from the alignment.py script, which I tried to edit but failed. So I decided to skip those steps and start with sorted bam files instead.

2) After successfully running snap-pre and snap-add-bmat, I encountered this error while running this command: snaptools snap-add-gmat \ --snap-file=pbmc1.snap \ --gene-file=gencode.v19.annotation.gene.bed \ --verbose=True File "/usr/local/bin/snaptools", line 38, in parse_args()
File "/usr/local/lib/python3.6/site-packages/snaptools/parser.py", line 184, in parse_args verbose=args.verbose) File "/usr/local/lib/python3.6/site-packages/snaptools/add_gmat.py", line 138, in snap_gmat dump_read(snap_file, fout_frag.name, buffer_size, None, tmp_folder, True); File "/usr/local/lib/python3.6/site-packages/snaptools/snap.py", line 836, in dump_read fout.write(("\t".join(map(str, item)) + "\n").encode()) TypeError: write() argument must be str, not bytes

Could you help with these issues? Thank you very much!!!!

Paola

r3fang commented 5 years ago

Hi Paola,

Thank you for trying it!! This is an error that I was about to fix it.

1) When running the index-genome and the align-paired-end commands, I had tab/space/indentation errors coming from the alignment.py script, which I tried to edit but failed. So I decided to skip those steps and start with sorted bam files instead.

It is an error caused by the tab and indentation in the demo command, has nothing to do with alignment.py. Sometimes copying the command from github will cause problem for space or tab.

After successfully running snap-pre and snap-add-bmat, I encountered this error while running this command: snaptools snap-add-gmat --snap-file=pbmc1.snap --gene-file=gencode.v19.annotation.gene.bed --verbose=True

This is a problem I was about to fix. One solution is, if you can install snaptools using python2.7, it does not raise this error. Also, you can run clustering without running this command.

Let me know if you need more help!

r3fang commented 5 years ago

When running the index-genome and the align-paired-end commands, I had tab/space/indentation errors coming from the alignment.py script, which I tried to edit but failed. So I decided to skip those steps and start with sorted bam files instead.

can you let me know where did you copy the command from?

plbngl commented 5 years ago

Thanks for the reply!

  1. Yes I copied the commands from the github (https://github.com/r3fang/SnapTools). I thought it was a the alignment.py script because the I got this sort of errors:

snaptools align-paired-end \ --input-reference=hg19.fa \ --input-fastq1=pbmc1.R1.fq.gz \ --input-fastq2=pbmc1.R2.fq.gz \ --output-bam=pbmc1.bam \ --aligner=bwa \ --path-to-aligner=/usr/bin/bwa \ --read-fastq-command=zcat \ --min-cov=0 \ --num-threads=8 \ --if-sort=True \ --tmp-folder=./ \ --overwrite=TRUE

Traceback (most recent call last): File "/home/pbenaglio/.local/bin/snaptools", line 38, in parse_args()
File "/home/pbenaglio/.local/lib/python3.6/site-packages/snaptools/parser.py", line 90, in parse_args from snaptools.alignment import run_align_pe File "/home/pbenaglio/.local/lib/python3.6/site-packages/snaptools/alignment.py", line 79 print("error: no barcode is selected") ^ TabError: inconsistent use of tabs and spaces in indentation

  1. I will try using python2.7

Thanks!

r3fang commented 5 years ago

hello,

Can you re-install snaptools to the latest version by

pip install snaptools==1.4.4

and re-run the analysis, i just updated the pipeline and fixed all the bugs.

Would you mind trying it again using python3.6?

Best,

plbngl commented 5 years ago

Thank you very much, I have installed your updated package it seems that everything is working now with python 3.6!

r3fang commented 5 years ago

Great! Let me know if you have more questions