Loading .gitignore +2 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ tests/*.sam tests/*.fai tests/pysam_data tests/cbcf_data tests/tabix_data samtools/config.h htslib/config.status Loading Loading @@ -52,6 +53,7 @@ var/ *.egg-info/ .installed.cfg *.egg doc/_build # Installer logs pip-log.txt Loading MANIFEST.in +6 −34 Original line number Diff line number Diff line Loading @@ -17,16 +17,22 @@ include pysam/libc*.c include pysam/*.c include pysam/*.h # exclude tests from pypi tar-ball - they # require additional data prune tests/ # samtools include samtools/configure include samtools/config.mk.in include samtools/config.h.in include samtools/*.h include samtools/*.c exclude samtools/config.h include samtools/*/*.h # bcftools include bcftools/*.h include bcftools/*.c exclude bcftools/config.h # htslib Loading @@ -50,39 +56,5 @@ include cy_build.py include pysam.py include requirements.txt # pysam tests include tests/00README.txt include tests/pysam_data include tests/tabix_data include tests/*.py #ex1.fa #include tests/ex1.sam.gz #include tests/ex3.sam #include tests/ex4.sam #include tests/ex5.sam #include tests/ex6.sam #include tests/ex7.sam #include tests/ex8.sam #include tests/ex9_fail.bam #include tests/ex9_nofail.bam #include tests/ex10.sam #include tests/example.py #include tests/pysam_test.py #include tests/segfault_tests.py #include tests/example_*.sam #include tests/example_btag.bam #include tests/tag_bug.bam #include tests/example.vcf40 #include tests/example_empty_header.bam #include tests/test_unaligned.bam #include tests/issue100.bam # tabix tests #include tests/example.gtf.gz #include tests/example.gtf.gz.tbi #include tests/example.bed.gz #include tests/example.bed.gz.tbi #include tests/vcf-examples/*.vcf # documentation include doc/* NEWS +49 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,55 @@ http://pysam.readthedocs.io/en/latest/release.html Release notes ============= Release 0.14.0 ============== This release wraps htslib/samtools versions 1.7.0. * SAM/BAM/CRAM headers are now managed by a separate AlignmentHeader class. * AlignmentFile.header.as_dict() returns an ordered dictionary. * Use "stop" instead of "end" to ensure consistency to VariantFile. The end designations have been kept for backwards compatibility. * [#611] and [#293] CRAM repeated fetch now works, each iterator reloads index if multiple_iterators=True * [#608] pysam now wraps htslib 1.7 and samtools 1.7. * [#580] reference_name and next_reference_name can now be set to "*" (will be converted to None to indicate an unmapped location) * [#302] providing no coordinate to count_coverage will not count from start/end of contig. * [#325] @SQ records will be automatically added to header if they are absent from text section of header. * [#529] add get_forward_sequence() and get_forward_qualities() methods * [#577] add from_string() and to_dict()/from_dict() methods to AlignedSegment. Rename tostring() to to_string() throughout for consistency * [#589] return None from build_alignment_sequence if no MD tag is set * [#528] add PileupColumn.__len__ method Backwards incompatible changes: * AlignmentFile.header now returns an AlignmentHeader object. Use AlignmentFile.header.to_dict() to get the dictionary as previously. Most dictionary accessor methods (keys(), values(), __getitem__, ...) have been implemented to ensure some level of backwards compatibility when only reading. The rationale for this change is to have consistency between AlignmentFile and VariantFile. * AlignmentFile and FastaFile now raise IOError instead of OSError Medium term we plan to have a 1.0 release. The pysam interface has grown over the years and the API is cluttered with deprecated names (Samfile, getrname(), gettid(), ...). To work towards this, the next release (0.15.0) will yield DeprecationWarnings for any parts of the API that are considered obsolete and will not be in 1.0. Once 1.0 has been reached, we will use semantic versioning. Release 0.13.0 =============== Loading @@ -20,7 +69,6 @@ contains a series of bugfixes. * [#537] allow tabix index files to be created in a custom location. * [#530] add get_index_statistics() method Release 0.12.0.1 ================ Loading bcftools/HMM.c.pysam.c +1 −1 Original line number Diff line number Diff line #include "pysam.h" #include "bcftools.pysam.h" /* The MIT License Loading bcftools/bam2bcf.c.pysam.c +5 −5 Original line number Diff line number Diff line #include "pysam.h" #include "bcftools.pysam.h" /* bam2bcf.c -- variant calling. Loading Loading @@ -108,7 +108,7 @@ static int get_position(const bam_pileup1_t *p, int *len) if ( cig==BAM_CHARD_CLIP ) continue; if ( cig==BAM_CPAD ) continue; if ( cig==BAM_CREF_SKIP ) continue; fprintf(pysam_stderr,"todo: cigar %d\n", cig); fprintf(bcftools_stderr,"todo: cigar %d\n", cig); assert(0); } *len = n_tot_bases; Loading Loading @@ -504,7 +504,7 @@ void calc_SegBias(const bcf_callret1_t *bcr, bcf_call_t *call) double sum = 0; const double log2 = log(2.0); // fprintf(pysam_stderr,"M=%.1f p=%e q=%e f=%f dp=%d\n",M,p,q,f,avg_dp); // fprintf(bcftools_stderr,"M=%.1f p=%e q=%e f=%f dp=%d\n",M,p,q,f,avg_dp); int i; for (i=0; i<call->n; i++) { Loading @@ -519,7 +519,7 @@ void calc_SegBias(const bcf_callret1_t *bcr, bcf_call_t *call) else tmp = log(2*f*(1-f)*exp(-q) + f*f*exp(-2*q) + (1-f)*(1-f)) + p; sum += tmp; // fprintf(pysam_stderr,"oi=%d %e\n", oi,tmp); // fprintf(bcftools_stderr,"oi=%d %e\n", oi,tmp); } call->seg_bias = sum; } Loading Loading @@ -683,7 +683,7 @@ int bcf_call_combine(int n, const bcf_callret1_t *calls, bcf_callaux_t *bca, int } } // if (ref_base < 0) fprintf(pysam_stderr, "%d,%d,%f,%d\n", call->n_alleles, x, sum_min, call->unseen); // if (ref_base < 0) fprintf(bcftools_stderr, "%d,%d,%f,%d\n", call->n_alleles, x, sum_min, call->unseen); call->shift = (int)(sum_min + .499); } // combine annotations Loading Loading
.gitignore +2 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ tests/*.sam tests/*.fai tests/pysam_data tests/cbcf_data tests/tabix_data samtools/config.h htslib/config.status Loading Loading @@ -52,6 +53,7 @@ var/ *.egg-info/ .installed.cfg *.egg doc/_build # Installer logs pip-log.txt Loading
MANIFEST.in +6 −34 Original line number Diff line number Diff line Loading @@ -17,16 +17,22 @@ include pysam/libc*.c include pysam/*.c include pysam/*.h # exclude tests from pypi tar-ball - they # require additional data prune tests/ # samtools include samtools/configure include samtools/config.mk.in include samtools/config.h.in include samtools/*.h include samtools/*.c exclude samtools/config.h include samtools/*/*.h # bcftools include bcftools/*.h include bcftools/*.c exclude bcftools/config.h # htslib Loading @@ -50,39 +56,5 @@ include cy_build.py include pysam.py include requirements.txt # pysam tests include tests/00README.txt include tests/pysam_data include tests/tabix_data include tests/*.py #ex1.fa #include tests/ex1.sam.gz #include tests/ex3.sam #include tests/ex4.sam #include tests/ex5.sam #include tests/ex6.sam #include tests/ex7.sam #include tests/ex8.sam #include tests/ex9_fail.bam #include tests/ex9_nofail.bam #include tests/ex10.sam #include tests/example.py #include tests/pysam_test.py #include tests/segfault_tests.py #include tests/example_*.sam #include tests/example_btag.bam #include tests/tag_bug.bam #include tests/example.vcf40 #include tests/example_empty_header.bam #include tests/test_unaligned.bam #include tests/issue100.bam # tabix tests #include tests/example.gtf.gz #include tests/example.gtf.gz.tbi #include tests/example.bed.gz #include tests/example.bed.gz.tbi #include tests/vcf-examples/*.vcf # documentation include doc/*
NEWS +49 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,55 @@ http://pysam.readthedocs.io/en/latest/release.html Release notes ============= Release 0.14.0 ============== This release wraps htslib/samtools versions 1.7.0. * SAM/BAM/CRAM headers are now managed by a separate AlignmentHeader class. * AlignmentFile.header.as_dict() returns an ordered dictionary. * Use "stop" instead of "end" to ensure consistency to VariantFile. The end designations have been kept for backwards compatibility. * [#611] and [#293] CRAM repeated fetch now works, each iterator reloads index if multiple_iterators=True * [#608] pysam now wraps htslib 1.7 and samtools 1.7. * [#580] reference_name and next_reference_name can now be set to "*" (will be converted to None to indicate an unmapped location) * [#302] providing no coordinate to count_coverage will not count from start/end of contig. * [#325] @SQ records will be automatically added to header if they are absent from text section of header. * [#529] add get_forward_sequence() and get_forward_qualities() methods * [#577] add from_string() and to_dict()/from_dict() methods to AlignedSegment. Rename tostring() to to_string() throughout for consistency * [#589] return None from build_alignment_sequence if no MD tag is set * [#528] add PileupColumn.__len__ method Backwards incompatible changes: * AlignmentFile.header now returns an AlignmentHeader object. Use AlignmentFile.header.to_dict() to get the dictionary as previously. Most dictionary accessor methods (keys(), values(), __getitem__, ...) have been implemented to ensure some level of backwards compatibility when only reading. The rationale for this change is to have consistency between AlignmentFile and VariantFile. * AlignmentFile and FastaFile now raise IOError instead of OSError Medium term we plan to have a 1.0 release. The pysam interface has grown over the years and the API is cluttered with deprecated names (Samfile, getrname(), gettid(), ...). To work towards this, the next release (0.15.0) will yield DeprecationWarnings for any parts of the API that are considered obsolete and will not be in 1.0. Once 1.0 has been reached, we will use semantic versioning. Release 0.13.0 =============== Loading @@ -20,7 +69,6 @@ contains a series of bugfixes. * [#537] allow tabix index files to be created in a custom location. * [#530] add get_index_statistics() method Release 0.12.0.1 ================ Loading
bcftools/HMM.c.pysam.c +1 −1 Original line number Diff line number Diff line #include "pysam.h" #include "bcftools.pysam.h" /* The MIT License Loading
bcftools/bam2bcf.c.pysam.c +5 −5 Original line number Diff line number Diff line #include "pysam.h" #include "bcftools.pysam.h" /* bam2bcf.c -- variant calling. Loading Loading @@ -108,7 +108,7 @@ static int get_position(const bam_pileup1_t *p, int *len) if ( cig==BAM_CHARD_CLIP ) continue; if ( cig==BAM_CPAD ) continue; if ( cig==BAM_CREF_SKIP ) continue; fprintf(pysam_stderr,"todo: cigar %d\n", cig); fprintf(bcftools_stderr,"todo: cigar %d\n", cig); assert(0); } *len = n_tot_bases; Loading Loading @@ -504,7 +504,7 @@ void calc_SegBias(const bcf_callret1_t *bcr, bcf_call_t *call) double sum = 0; const double log2 = log(2.0); // fprintf(pysam_stderr,"M=%.1f p=%e q=%e f=%f dp=%d\n",M,p,q,f,avg_dp); // fprintf(bcftools_stderr,"M=%.1f p=%e q=%e f=%f dp=%d\n",M,p,q,f,avg_dp); int i; for (i=0; i<call->n; i++) { Loading @@ -519,7 +519,7 @@ void calc_SegBias(const bcf_callret1_t *bcr, bcf_call_t *call) else tmp = log(2*f*(1-f)*exp(-q) + f*f*exp(-2*q) + (1-f)*(1-f)) + p; sum += tmp; // fprintf(pysam_stderr,"oi=%d %e\n", oi,tmp); // fprintf(bcftools_stderr,"oi=%d %e\n", oi,tmp); } call->seg_bias = sum; } Loading Loading @@ -683,7 +683,7 @@ int bcf_call_combine(int n, const bcf_callret1_t *calls, bcf_callaux_t *bca, int } } // if (ref_base < 0) fprintf(pysam_stderr, "%d,%d,%f,%d\n", call->n_alleles, x, sum_min, call->unseen); // if (ref_base < 0) fprintf(bcftools_stderr, "%d,%d,%f,%d\n", call->n_alleles, x, sum_min, call->unseen); call->shift = (int)(sum_min + .499); } // combine annotations Loading