Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: cannot unpack non-iterable NoneType object #76

Open
padro89 opened this issue Feb 19, 2023 · 6 comments
Open

TypeError: cannot unpack non-iterable NoneType object #76

padro89 opened this issue Feb 19, 2023 · 6 comments

Comments

@padro89
Copy link

padro89 commented Feb 19, 2023

Hello! First of all, thank you for the package!

I am trying to automatically demultiplex blood cells coming from a patient with a bone marrow alotransplantation. I know that about 10% of the cells I have come from the patient, where the rest should be from the donor. I don't think vireo was developed for this, but in theory it should work.

I tried to run it without VCF from donor or patient, and it left 1/3 of the cells unassigned, a lot of doublets and the rest of the cells were assigned 50% to the patient and 50% to the donor. Since this results do not make much sense to me I got hands on a VCF from the patient before translpantation, thinking it could aid in separating the cells.

This is the script I ran (vireo_demultiplex.sh):

`
#!/bin/bash

CELL_DATA=/home/joan/OneDrive/Projectes/SC-TCR-Batlle/Resultats/cellsnp-lite/VCF
CELL_DATA_VCF=/home/joan/OneDrive/Projectes/SC-TCR-Batlle/Resultats/cellsnp-lite/VCF/cellSNP.cells.vcf.gz
POSITIONS=/home/joan/OneDrive/Projectes/SC-TCR-Batlle/Resultats/cellsnp-lite/VCF/cellSNP.base.vcf.gz
OUT_DIR=/home/joan/OneDrive/Projectes/SC-TCR-Batlle/Resultats/vireo/vireo_results_mtx_last
DONOR_GT=/home/joan/OneDrive/Projectes/SC-TCR-Batlle/Dades/VCF_pacient/S13.vcf.gz
n_donor=2
RAND_SEED=2
NPROC=10

#Compress the VCF file again

bcftools view $DONOR_GT -Oz -o donor_file.vcf.gz
bcftools index donor_file.vcf.gz

#Filtering
bcftools view donor_file.vcf.gz -R $CELL_DATA_VCF -Oz -o donor_filtrat.vcf.gz

#Running vireo
vireo -c $CELL_DATA -d donor_filtrat.vcf.gz -N $n_donor -o $OUT_DIR -p $NPROC --randSeed=$RAND_SEED`

I thought this should work, but I get a Python error, and I do not know the reason for it:

./vireo_demultiplex.sh [vireo] Loading cell folder ... [vireo] Loading donor VCF file ... Traceback (most recent call last): File "/home/joan/miniconda3/envs/sclast2/bin/vireo", line 8, in <module> sys.exit(main()) File "/home/joan/miniconda3/envs/sclast2/lib/python3.9/site-packages/vireoSNP/vireo.py", line 153, in main donor_vcf = load_VCF(options.donor_file, biallelic_only=True, File "/home/joan/miniconda3/envs/sclast2/lib/python3.9/site-packages/vireoSNP/utils/vcf_utils.py", line 157, in load_VCF RV["GenoINFO"], RV["n_SNP_tagged"] = parse_sample_info( TypeError: cannot unpack non-iterable NoneType object
Do you have any ideas on what could be the problem?

Thank you very much in advance!

@huangyh09
Copy link
Collaborator

Hi,

Thanks for sharing your experience and issue.

First, I think you made a good trial in the de novo mode, though the results indeed sound not satisfying. It seems more likely that the model doesn't converge well. You may check what candidate SNPs list you used for running cellsnp-lite. Is it the 1000 Genome common SNP list? If it's your own ones, what's the number of the SNPs? If it's more than 1 million, it should be OK. Also, you may check the coverage of your cells; usually, ~500,000 reads/cell should be sufficient.

Second, when using the donor VCF in your latter trial, you may double check you have the PL tag in your donor VCF, otherwise, please specify the right tag with --genoTag or -t.

Yuanhua

@padro89
Copy link
Author

padro89 commented Feb 20, 2023

Hello! Thanks for answering so quickly.

I used the 1000 Genome common SNP list for cellsnp-lite, as suggested. The coverage of my cells is a bit lower, maybe that is a problem for the model.

Anyway, in the donor VCF file the PL tag is present, so it should work in principle, right?

@huangyh09
Copy link
Collaborator

Hi,
Thanks for your updates. This is a bit odd. Maybe you can check if your donor VCF file contains SNPs with multiple alleles instead of only bi-allele?

You may also try to only keep SNPs in your donor VCF file, e.g., by the following command:

bcftools view -i 'TYPE="snp"'

@padro89
Copy link
Author

padro89 commented Mar 2, 2023

Hello! First of all, thanks for your help.

I have been manually analizing the VCF to see if something was wrong with it, and I did find some multiallellic sites. But after filtering them out and using the TYPE=snp filter beforehand I still get the same error.

The format of my VCF file is as follows:
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT S13
chr1 12992 . G A 13.3 . AC=1;AF=0.021;AN=48;BaseQRankSum=-1.383;DP=65;ExcessHet=3.0103;FS=0;InbreedingCoeff=-0.1059;MLEAC=1;MLEAF=0.021;MQ=24.28;MQRankSum=0.674;QD=3.32;ReadPosRankSum=-0.674;SOR=0.693 GT:AD:DP:GQ:PL0/0:3,0:3:9:0,9,102
chr1 13273 . G C 901.25 . AC=11;AF=0.162;AN=68;BaseQRankSum=-1.255;DP=236;ExcessHet=0.4626;FS=0.813;InbreedingCoeff=0.1358;MLEAC=11;MLEAF=0.162;MQ=29.97;MQRankSum=-0.366;QD=10.6;ReadPosRankSum=0.776;SOR=0.743 GT:AD:DP:GQ:PL0/0:12,0:12:36:0,36,385

I show it here in case it is useful, as I don't seem to find the problem, and can't understant why it is not working. Thank you very much!

@huangyh09
Copy link
Collaborator

Thanks for the updates. Not fully sure about the reason for this issue. Possibly you can upgrade it to v0.5.8 and see if it helps.

pip install -U git+https://github.com/single-cell-genetics/vireo

@padro89
Copy link
Author

padro89 commented Mar 6, 2023

Well, I already had tried updating to version 0.5.8. I really don't understand what is wrong. Thank you for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants