watch and bam: panics, and asked output that is missing with exit 0
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- go
- Ambito
- bioinformatics, cli
Direzione di ricerca
Start with the watch and bam command entry points and their tests; reproduce the listed cases using the supplied FASTQ, SAM/BAM, and configuration examples. Trace each panic, silent output, and option error to its handling path, then add regression coverage. Done means invalid inputs return tagged errors with exit 255, valid BAM records are preserved in the stated modes, and the listed edge cases no longer panic.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Version: seqkit v2.14.0 (bioconda), Linux x86_64
Test files. The bam examples use two small BAM files made with samtools:
$ printf '@SQ\tSN:chr1\tLN:40\nr1\t0\tchr1\t1\t60\t10M\t*\t0\t0\tACGTACGTAC\tIIIIIIIIII\tNM:i:0\nr2\t0\tchr1\t5\t30\t10M\t*\t0\t0\tACGTACGTAC\tIIIIIIIIII\n' > x.sam
$ samtools view -b -o x.bam x.sam # r2 has no NM tag
$ sed 's/IIIIIIIIII$/IIIIIIIIII\tNM:i:0/' x.sam > z.sam
$ samtools view -b -o z.bam z.sam # every record has NM
$ printf '>chr1\nACGT\n' > notbam.bam # not a BAM file
$ printf '@a\nACGT\n+\n#III\n' > q.fq
watch and bam: the histogram and picture code panics
$ : > empty.fq
$ seqkit watch empty.fq # on a terminal
panic: runtime error: index out of range [0] with length 0
$ printf '@a\nAAAA\n+\nIIII\n' > noGC.fq
$ seqkit watch -f GCSkew -O h.png noGC.fq
panic: runtime error: index out of range [0] with length 0
$ seqkit watch -O h.xyz q.fq # also with no extension
panic: unsupported format: "xyz" # and an empty h.xyz is left
$ seqkit watch -O /nonexist/h.png q.fq
panic: open /nonexist/h.png: no such file or directory
$ seqkit bam -f MapQual -O h.txt -Q x.bam
panic: unsupported format: "txt"
Each exits 2.
Expected
An [ERRO] message and exit 255, as for other bad input. No empty file is
left.
watch -f MeanQual: a quality letter below -b panics
$ seqkit watch -f MeanQual -y -b 40 q.fq
panic: runtime error: index out of range [-5]
$ echo $?
2
The same class of problem as #598.
Expected
An error that names the bad quality letter, exit 255.
watch: a terminal narrower than 11 columns panics
$ printf '>a\nACGT\n>b\nACGTACGTAC\n' > two.fa
$ script -qec "stty cols 5; seqkit watch -y two.fa" /dev/null
panic: runtime error: makeslice: len out of range
Exit code 2, also with -y (no plot).
Expected
The automatic bin count is at least 1.
watch -f and bam -f: a bad field name exits 1 with no [ERRO] tag
$ seqkit watch -f foo q.fq
Invalid field: foo
$ echo $?
1
$ seqkit bam -f foo x.bam > out.txt
Invalid field: foo
The valid fields are:
$ echo $?
1
$ head -2 out.txt # the field list goes to stdout
Read
Ref
All other option errors give [ERRO] and exit 255.
Expected
[ERRO] Invalid field: foo, exit 255, and the field list on stderr.
bam: a mapped record with no NM tag panics
What happens
The NM tag is optional in SAM, but seqkit bam x.bam (the default table)
panics at the first mapped record that has no NM tag. The output is cut.
-f Acc, the top mode and the toolbox do the same.
$ seqkit bam x.bam
Read Ref Pos EndPos MapQual Acc ...
r1 chr1 0 10 60 100 ...
panic: no NM tag
$ echo $?
2
$ seqkit bam -T '{AccStats: {Tsv: "-"}, Sink: True}' x.bam
panic: No NM tag in the BAM record!
Expected
An error that names the read, exit 255. Or the accuracy fields are computed
from MD/CIGAR, or left empty for that record.
bam -?: a negative value panics
$ seqkit bam -f MapQual -@ top.bam -? -1 -Q x.bam
panic: runtime error: makeslice: len out of range
Exit code 2.
Expected
An error such as value of flag --top-size should not be negative.
bam -x: the field table mode and -s pass no records (exit 0)
$ seqkit bam -x -f Read,MapQual z.bam > pass.bam
$ echo $?
0
$ samtools view -c pass.bam
[W::bam_hdr_read] EOF marker is absent. The input is probably truncated
0
$ seqkit bam -x -s z.bam | wc -c
0
With one field, -x passes the records.
Expected
pass.bam holds the 2 input records. With -s, the records pass or an error
says that -x and -s cannot be used together.
bam -T: an input that is not BAM panics
$ seqkit bam -T '{AccStats: {Tsv: "-"}, Sink: True}' notbam.bam
panic: runtime error: invalid memory address or nil pointer dereference
$ seqkit bam -s notbam.bam
[ERRO] gzip: invalid header
Expected
The same [ERRO] gzip: invalid header as the other modes, exit 255.
bam -@: no top file, no message, exit 0
With no -f, with two fields, or with a text field such as Ref, the file of
-@ is not written and nothing says why.
$ seqkit bam -f Ref -@ top.bam -? 3 -Q z.bam > /dev/null; echo $?
0
$ ls top.bam
ls: cannot access 'top.bam': No such file or directory
Expected
An error such as --top-bam requires a single numeric --field.
bam -s: one bad file removes the lines of the good files
$ cp z.bam w.bam
$ seqkit bam -s z.bam w.bam
PrimAlnPerc MultimapPerc PrimAln ... File
100.00 0.00 2 ... z.bam
100.00 0.00 2 ... w.bam
$ seqkit bam -s z.bam notbam.bam w.bam
[ERRO] gzip: invalid header
$ echo $?
255
$ cat z.bam | seqkit bam -s - -
[ERRO] EOF
Expected
The header and the line for z.bam, then the error. (stats has the same
kind of problem, #599.)
bam -T Dump: an unknown field name is dropped with no message
$ cat dump.yml
Dump:
Tsv: "-"
Fields: ["Read","Foo"]
Sink: True
$ seqkit bam -T '{Yaml: "dump.yml"}' z.bam
Read
r1
r2
$ echo $?
0
Expected
An error such as Dump: unknown field: Foo.
- Lingua principale
- Go
- Stelle
- 1.6k
- Fork
- 189
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di shenwei356/seqkit
-
convert: no range check between Phred encodings, so a wrong --from writes a broken FASTQ (exit 0)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
shenwei356/seqkit#612 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
shenwei356/seqkit#620 ·
-
sliding, merge-slides, mutate, translate, replace: panics, lost windows and wrong output with exit 0Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
shenwei356/seqkit#619 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
shenwei356/seqkit#618 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
shenwei356/seqkit#617 ·
Tutte le issue di shenwei356/seqkit
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 60/100
-
✨ Propose the missing gate after three same-class findings instead of filing a fourthForse già presa @hivecommons-hive l’ha presa oggi. Apertaenhancement help wanted hive/claimed-by-scanner stage/040-covered-by-pr
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
hivecommons/hive#13428 · 3 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
🕷️ bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
sysadminsmedia/homebox#1805 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100