WGSExtract / WGSExtract-Dev

WGS Extract Developers Repository
GNU General Public License v3.0
20 stars 7 forks source link

NameError: name 'called_chrom' is not defined #5

Closed rmalkevy closed 3 years ago

rmalkevy commented 3 years ago

Hello)

I converted my .cram file from Nebula Genomics to .bam by this command: ./samtools view -b -o my.bam -T GRCh38_latest_genomic.fna my.cram

Then with WGSExtract I tried to create any of the files - but got errors and files with headers.

➜ WGSExtract sh Start_MacOSX.sh
Starting WGSExtract... This little window shows what WGSExtract is doing in the background while it runs tasks that the user initiated. This can be a help if you experience any errors. The window can be minimized if there are no errors. dos2unix: converting file /Users/henprokuror/Downloads/WGSExtract/temp/get_samtools_stats.sh to Unix format... dos2unix: converting file /Users/henprokuror/Downloads/WGSExtract/temp/extract23.sh to Unix format... Starting mpileup... Please be patient! [warning] samtools mpileup option v is functional, but deprecated. Please switch to using bcftools mpileup in future. [mpileup] 1 samples in 1 input files Mpileup completed. Starting SNP calling... Note: none of --samples-file, --ploidy or --ploidy-file given, assuming all sites are diploid SNP calling completed. Starting annotation... Annotation completed. Starting extraction from VCF ... Extraction from VCF completed. Sorting by chromosome and position ... Converting positions to maintain compatibility... dos2unix: converting file /Users/henprokuror/Downloads/WGSExtract/temp/sort-converted-positions.sh to Unix format... /Users/henprokuror/Downloads/WGSExtract/temp/add_header.sh: line 2: gcat: command not found /Users/henprokuror/Downloads/WGSExtract/temp/add_header.sh: line 3: gcat: command not found dos2unix: converting file /Users/henprokuror/Downloads/WGSExtract/results_outputs/my__CombinedKit_All_SNPs_RECOMMENDED.txt to Unix format... adding: my__CombinedKit_All_SNPs_RECOMMENDED.txt (stored 0%) Generating file in format MyHeritage_V2 Traceback (most recent call last): File "/Users/henprokuror/Downloads/WGSExtract/programs/wgsextract/aconv.py", line 241, in convert_adna() File "/Users/henprokuror/Downloads/WGSExtract/programs/wgsextract/aconv.py", line 185, in convert_adna while pos1_smaller_than_pos2(called_chrom, called_pos, templ_chrom, templ_pos) \ NameError: name 'called_chrom' is not defined dos2unix: converting file /Users/henprokuror/Downloads/WGSExtract/results_outputs/my_MyHeritage_V2.csv to Unix format... adding: my_MyHeritage_V2.csv (deflated 31%)

Where did I make a mistake?

RandyHarr commented 3 years ago

Thank you for using the Issues here.

Based on your title and looking at your CRAM conversion line, you used an incorrect reference model in converting your CRAM. Also, you did not include the header in converting the CRAM either (-h option to samtools view). See the doc https://bit.ly/31TeqYH for converting your CRAM.

The actual error being reported is the command "gcat" could not be found. What host OS are you using? Am guessing MacOSX by your path shown. Note that MacOSX often gives errorrs when being run out of the Documents or Downloads folders. You usually s should put it in your root. This is part of their gatekeeper security.

rmalkevy commented 3 years ago

Thanks for the instruction about cram conversion. After I wrote this issue, I saw the recommendation in the other issues about conversion. But I don't know that I need to use WGS outside the Download directory))) Now, I am trying to run WGS in the root. Hope it will help)

I spent lots of time to find all these instructions about converting cram to bam. Maybe it will be helpful to add this info to README.MD

RandyHarr commented 3 years ago

The new release we are testing has CRAM handling built in :) But yes, probably should mention it on the install page. DONE.

The gcat command is found in /opt/local/bin and installed by MacPorts. The other thing I should have asked if you did the MacOSX patch and run its installer. I had to dig back because we removed this dependency in our development code back in March.

rmalkevy commented 3 years ago

@RandyHarr I tried to move bam file and WGSExtract to the root directory. But got the same error as I mentioned at the first comment. And also gcat: command not found /Users/henprokuror/Downloads/WGSExtract/temp/add_header.sh: line 3: gcat: command not found Yes, I installed the MacOSX patch. Checked - have gcat in /opt/local/bin

When to expect a new version with CRAM built in?

RandyHarr commented 3 years ago

Had hoped in June.

But this issue is more basic and I cannot recreate it.

Your comment above still uses the Downloads folder for the WGS Extract program.

The shell script created in the temp directory should give the full path to find the gcat command in /opt/local/bin. If the program fails, hopefully that directory is not cleared out. Try to look at that script file if you can. (new release has debug mode which keeps from clearing out that temp directory. Know I keep baiting you but...) You can always run them by hand. No parameters. ./add_header.sh, for example, in the Terminal.

rmalkevy commented 3 years ago

I added full path to the gcat and everything works fine) Thank you for your help :)

Screenshot 2020-11-08 at 09 18 13
RandyHarr commented 3 years ago

Bug in hg38tohg19.py liftover wrapper does not provide full path to use of cat / gcat command in Betav2 released 15 Feb 2020.

This and a few other recently discovered bugs have been documented in the v2 manual section covering issues. Known workarounds and effect are there as well.