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

flair collapse generates a confusing pysam error when nothing aligned #435

Open
diekhans opened this issue Mar 6, 2025 · 3 comments
Open
Assignees
Labels
bug Something isn't working Error handling Issues with error handling and logging mod; collapse

Comments

@diekhans
Copy link
Collaborator

diekhans commented Mar 6, 2025

rm -rf output/test-collapse-seg1.tmp
flair collapse -r input/seg1.cdna-ont.fastq -q expected/test-correct-seg1_all_corrected.bed -g input.tmp/genome.fa -t 4 --generate_map --temp_dir output/test-collapse-seg1.tmp --keep_intermediate -f input/annotation.gtf -o output/test-collapse-seg1 -p input/seg1.promoter-regions.bedx --annotation_reliant generate --stringent
Starting collapse...
Filtering out reads without promoter-supported TSS
Exception ignored in: <function Popen.__del__ at 0x7f37b29ad8a0>
Traceback (most recent call last):
  File "/cluster/home/markd/opt/miniforge3/envs/flair-dev/lib/python3.12/site-packages/pipettor/processes.py", line 624, in __del__
    self.close()
  File "/cluster/home/markd/opt/miniforge3/envs/flair-dev/lib/python3.12/site-packages/pipettor/processes.py", line 619, in close
    self.wait()
  File "/cluster/home/markd/opt/miniforge3/envs/flair-dev/lib/python3.12/site-packages/pipettor/processes.py", line 708, in wait
    super(Popen, self).wait()
  File "/cluster/home/markd/opt/miniforge3/envs/flair-dev/lib/python3.12/site-packages/pipettor/processes.py", line 471, in wait
    self._wait_guts()
  File "/cluster/home/markd/opt/miniforge3/envs/flair-dev/lib/python3.12/site-packages/pipettor/processes.py", line 464, in _wait_guts
    self._raise_if_failed()
  File "/cluster/home/markd/opt/miniforge3/envs/flair-dev/lib/python3.12/site-packages/pipettor/processes.py", line 427, in _raise_if_failed
    raise ex
  File "/cluster/home/markd/opt/miniforge3/envs/flair-dev/lib/python3.12/site-packages/pipettor/processes.py", line 424, in _raise_if_failed
    raise p.procExcept
pipettor.exceptions.ProcessException: process exited 1: bedtools intersect -a output/test-collapse-seg1.tmp/tmptqxmzob2.tss.bed -b input/seg1.promoter-regions.bedx:
Error: Unable to open file input/seg1.promoter-regions.bedx. Exiting.

Making transcript fasta using annotated gtf and genome sequence
Aligning reads to reference transcripts
Counting supporting reads for annotated transcripts
Setting up unassigned reads for flair-collapse novel isoform detection
Renaming isoforms using gtf
Aligning reads to first-pass isoform reference
Aligning reads to firstpass transcripts
Counting supporting reads for firstpass transcripts
Traceback (most recent call last):
  File "/hive/users/markd/flair/projs/src/flair-markd/test/../bin/flair", line 109, in <module>
    main()
  File "/hive/users/markd/flair/projs/src/flair-markd/test/../bin/flair", line 67, in main
    [isoforms, isoform_sequences] = collapse()
                                    ^^^^^^^^^^
  File "/hive/users/markd/flair/projs/src/flair-markd/src/flair/flair_collapse.py", line 416, in collapse
    pipettor.run([mm2_cmd, count_cmd])
  File "/cluster/home/markd/opt/miniforge3/envs/flair-dev/lib/python3.12/site-packages/pipettor/__init__.py", line 32, in run
    Pipeline(cmds, stdin=stdin, stdout=stdout, stderr=stderr, logger=logger, logLevel=logLevel).wait()
  File "/cluster/home/markd/opt/miniforge3/envs/flair-dev/lib/python3.12/site-packages/pipettor/processes.py", line 471, in wait
    self._wait_guts()
  File "/cluster/home/markd/opt/miniforge3/envs/flair-dev/lib/python3.12/site-packages/pipettor/processes.py", line 464, in _wait_guts
    self._raise_if_failed()
  File "/cluster/home/markd/opt/miniforge3/envs/flair-dev/lib/python3.12/site-packages/pipettor/processes.py", line 427, in _raise_if_failed
    raise ex
  File "/cluster/home/markd/opt/miniforge3/envs/flair-dev/lib/python3.12/site-packages/pipettor/processes.py", line 424, in _raise_if_failed
    raise p.procExcept
pipettor.exceptions.ProcessException: process exited 1: count_sam_transcripts.py --sam - -o output/test-collapse-seg1.firstpass.q.counts -t 4 --quality 1 -w 100 --stringent -i output/test-collapse-seg1.firstpass.bed --generate_map output/test-collapse-seg1.isoform.read.map.txt:
/hive/users/markd/flair/projs/src/flair-markd/test/../src/flair/count_sam_transcripts.py:127: SyntaxWarning: invalid escape sequence '\d'
  mdblocks = re.findall('\d+|\D+', md)  # ['531', '^CCAGGTGAGCCGCCCGCG', '50', 'G', '2031']
Traceback (most recent call last):
  File "/hive/users/markd/flair/projs/src/flair-markd/test/../src/flair/count_sam_transcripts.py", line 283, in <module>
    transcripttoreads = parsesam(args, transcripttoexons)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/hive/users/markd/flair/projs/src/flair-markd/test/../src/flair/count_sam_transcripts.py", line 224, in parsesam
    samfile = pysam.AlignmentFile(args.sam, 'r')
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pysam/libcalignmentfile.pyx", line 751, in pysam.libcalignmentfile.AlignmentFile.__cinit__
  File "pysam/libcalignmentfile.pyx", line 1000, in pysam.libcalignmentfile.AlignmentFile._open
ValueError: file has no sequences defined (mode='r') - is it SAM/BAM format? Consider opening with check_sq=False

make: *** [Makefile:122: test-collapse-seg1] Error 1

@diekhans diekhans added bug Something isn't working Error handling Issues with error handling and logging labels Mar 6, 2025
@diekhans diekhans self-assigned this Mar 6, 2025
@diekhans
Copy link
Collaborator Author

diekhans commented Mar 7, 2025

this also happens with an empty BED file

@diekhans diekhans changed the title flair collapse with an missing promoter BED file generates a confusing pysam error flair collapse generates a confusing pysam error Mar 7, 2025
@diekhans
Copy link
Collaborator Author

diekhans commented Mar 7, 2025

This appears to be caused not my the invalid promoter file, but by no alignments being produced.

looks like on second pass

@diekhans
Copy link
Collaborator Author

diekhans commented Mar 7, 2025

these files are all empty

output/test-collapse-seg1.firstpass.bed                                                                       
output/test-collapse-seg1.firstpass.fa                                                                        
output/test-collapse-seg1.firstpass.unfiltered.bed                                                            

@diekhans diekhans changed the title flair collapse generates a confusing pysam error flair collapse generates a confusing pysam error when nothing aligned Mar 7, 2025
This was referenced Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Error handling Issues with error handling and logging mod; collapse
Projects
None yet
Development

No branches or pull requests

1 participant