You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, dear developers and maintainers. I tried to use pysam to edit the contig information of the header of a vcf file, then write records into it. However, the contig name of the record newly written into the new file seems to encounter a bug. Here's my code:
##fileformat=VCFv4.2##FILTER=<ID=PASS,Description="All filters passed">##source=minipileup-1.0-r11##reference=rawdata/Vada.all.cds.fasta##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">##FORMAT=<ID=AD,Number=R,Type=Integer,Description="Allelic depths for the ref and alt alleles in the order listed">##bcftools_viewVersion=1.19+htslib-1.19##bcftools_viewCommand=view -Oz 2mismatch.vcf; Date=Sat Oct 19 16:46:14 2024
['Horvu_VADA_Un01G000200.1', 'mychr']
100Horvu_VADA_Un01G000200.11729Horvu_VADA_Un01G000200.11729 . CG1 . . GT:AD [./.:0](https://vscode-remote+ssh-002dremote-002b10-002e10-002e200-002e58.vscode-resource.vscode-cdn.net/home/data/ljb/proj/scripts/Python/test/pysam/.:0),0 [./.:0](https://vscode-remote+ssh-002dremote-002b10-002e10-002e200-002e58.vscode-resource.vscode-cdn.net/home/data/ljb/proj/scripts/Python/test/pysam/.:0),0 [./.:0](https://vscode-remote+ssh-002dremote-002b10-002e10-002e200-002e58.vscode-resource.vscode-cdn.net/home/data/ljb/proj/scripts/Python/test/pysam/.:0),01/1:0,1##fileformat=VCFv4.2##FILTER=<ID=PASS,Description="All filters passed">##source=minipileup-1.0-r11##reference=rawdata/Vada.all.cds.fasta##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">##FORMAT=<ID=AD,Number=R,Type=Integer,Description="Allelic depths for the ref and alt alleles in the order listed">##bcftools_viewVersion=1.19+htslib-1.19##bcftools_viewCommand=view -Oz 2mismatch.vcf; Date=Sat Oct 19 16:46:14 2024##contig=<ID=Horvu_VADA_Un01G000200.1,length=2673>##contig=<ID=mychr,length=100>##test meta=this is a test#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT [./result/02_align/2mismatch/L128-LGK2361_L1.dedup.bam](https://vscode-remote+ssh-002dremote-002b10-002e10-002e200-002e58.vscode-resource.vscode-cdn.net/home/data/ljb/proj/scripts/Python/test/pysam/result/02_align/2mismatch/L128-LGK2361_L1.dedup.bam) [./result/02_align/2mismatch/L136-LGK2362_L1.dedup.bam](https://vscode-remote+ssh-002dremote-002b10-002e10-002e200-002e58.vscode-resource.vscode-cdn.net/home/data/ljb/proj/scripts/Python/test/pysam/result/02_align/2mismatch/L136-LGK2362_L1.dedup.bam) [./result/02_align/2mismatch/L5-LGK2360_L1.dedup.bam](https://vscode-remote+ssh-002dremote-002b10-002e10-002e200-002e58.vscode-resource.vscode-cdn.net/home/data/ljb/proj/scripts/Python/test/pysam/result/02_align/2mismatch/L5-LGK2360_L1.dedup.bam) [./result/02_align/2mismatch/47-1.dedup.bam](https://vscode-remote+ssh-002dremote-002b10-002e10-002e200-002e58.vscode-resource.vscode-cdn.net/home/data/ljb/proj/scripts/Python/test/pysam/result/02_align/2mismatch/47-1.dedup.bam)mychr1729 . CG1 . . GT:AD [./.:0](https://vscode-remote+ssh-002dremote-002b10-002e10-002e200-002e58.vscode-resource.vscode-cdn.net/home/data/ljb/proj/scripts/Python/test/pysam/.:0),0 [./.:0](https://vscode-remote+ssh-002dremote-002b10-002e10-002e200-002e58.vscode-resource.vscode-cdn.net/home/data/ljb/proj/scripts/Python/test/pysam/.:0),0 [./.:0](https://vscode-remote+ssh-002dremote-002b10-002e10-002e200-002e58.vscode-resource.vscode-cdn.net/home/data/ljb/proj/scripts/Python/test/pysam/.:0),01/1:0,1
I firstly copied all the header information from an old vcf file except contigs. Then I mannually copied a specific contig ("Horvu_VADA_Un01G000200.1"), and added a new one ("mychr"). After that I tried to copy a single record from the old file.
Although the output of the print(rec.chrom)andprint(rec)shows correct contig name ("Horvu_VADA_Un01G000200.1"), after writing into the new file and re-open the file, it wiredly become "mychr", which is the same as the newly added header information. Is that a bug? I am working with python 3.12.2 and pysam 0.22.1.
The text was updated successfully, but these errors were encountered:
Hi, dear developers and maintainers. I tried to use pysam to edit the contig information of the header of a vcf file, then write records into it. However, the contig name of the record newly written into the new file seems to encounter a bug. Here's my code:
Here's the output:
I firstly copied all the header information from an old vcf file except contigs. Then I mannually copied a specific contig ("Horvu_VADA_Un01G000200.1"), and added a new one ("mychr"). After that I tried to copy a single record from the old file.
Although the output of the
print(rec.chrom)
andprint(rec)
shows correct contig name ("Horvu_VADA_Un01G000200.1"), after writing into the new file and re-open the file, it wiredly become "mychr", which is the same as the newly added header information. Is that a bug? I am working with python 3.12.2 and pysam 0.22.1.The text was updated successfully, but these errors were encountered: