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

invalid contig #7

Closed
tongyin121 opened this issue Dec 17, 2021 · 7 comments
Closed

invalid contig #7

tongyin121 opened this issue Dec 17, 2021 · 7 comments
Labels
bug Something isn't working

Comments

@tongyin121
Copy link

Hi,
I got an error when I ran the third step, and here is the error reporting information.
Skipped filtering phase
Skipped pepper phase
Skipped margin phase
Skipped Flye phase
Finding breakpoints
Parsed 304552 reads 14590 split reads
Running: flye-minimap2 -ax asm5 -t 64 -K 5G /usr_storage/zyl/SY_haplotype/ZSP192L/ZSP192L.fasta /usr_storage/zyl/SY_haplotype/ZSP192L/hapdup/flye_hap_1/polished_1.fasta 2>/dev/null | flye-samtools sort -m 4G -@4 > /usr_storage/zyl/SY_haplotype/ZSP192L/hapdup/structural/liftover_hp1.bam
[bam_sort_core] merging from 0 files and 4 in-memory blocks...
Traceback (most recent call last):
File "/usr/local/bin/hapdup", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.8/dist-packages/hapdup/main.py", line 173, in main
bed_liftover(inversions_bed, minimap_out, open(inversions_hp, "w"))
File "/usr/local/lib/python3.8/dist-packages/hapdup/bed_liftover.py", line 76, in bed_liftover
proj_start_chr, proj_start_pos, proj_start_sign = project(bam_file, chr_id, chr_start)
File "/usr/local/lib/python3.8/dist-packages/hapdup/bed_liftover.py", line 9, in project
name, pos, sign = project_flank(bam_path, ref_seq, ref_pos, 1)
File "/usr/local/lib/python3.8/dist-packages/hapdup/bed_liftover.py", line 23, in project_flank
for pileup_col in samfile.pileup(ref_seq, max(0, ref_pos - flank), ref_pos + flank, truncate=True,
File "pysam/libcalignmentfile.pyx", line 1335, in pysam.libcalignmentfile.AlignmentFile.pileup
File "pysam/libchtslib.pyx", line 685, in pysam.libchtslib.HTSFile.parse_region
ValueError: invalid contig Contig125

@fenderglass
Copy link
Collaborator

Looks like a bug - I will get back to you in a few days.

In the mean time, your assemblies fastas actually have been generated: hapdup/flye_hap_1/polished_1.fasta and hapdup/flye_hap_2/polished_1.fasta. What you don't have yet is the coordinates of phased blocks within these assemblies.

@fenderglass fenderglass added the bug Something isn't working label Dec 19, 2021
@tongyin121
Copy link
Author

OK , thanks!
Best

@fenderglass
Copy link
Collaborator

Looks like if contigs ids are formatted in certain way, it may cause an error in pysam: pysam-developers/pysam#673

Could you please send me structural/liftover_hp1.bam and structural/inversions.bed files so I can check?

Mikhail

@tongyin121
Copy link
Author

sure, but the liftover_hp1.bam is too huge so I can not send it to you
inversions.txt

@fenderglass
Copy link
Collaborator

@tongyin121 sorry for the late response. If you are still interested in fixing this - perhaps you could send me the first 1000 lines of the bam file? You can use samtools view structural/liftover_hp1.bam | head -n 1000.

The inversions.bed file seems to contain just one line, which can't be true - otherwise the program would not run the code that crashed. Please make sure sending the entire structural/inversions.bed file.

@tongyin121
Copy link
Author

Sorry for my late response. I had run the hapdup again several times. When I had deleted the file generated before and ran hadpdup again,the error was not reported.
the bam file may have been rewritten after running the hapdup again and I send you the first 100 lines of the bam file because the 1000 lines of bam file still can not be sent to you.
inversions.txt
bamfile.zip

@fenderglass
Copy link
Collaborator

Thanks for sending the files - everything looks good to me now. Hard to tell what happened without looking at the original files that caused the crash. Could have been just a corrupted file...

Since the error does not show up anymore I'm closing the issue. But feel free to follow up if you encounter it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants