GithubHelp home page GithubHelp logo

brentp / hts-python Goto Github PK

View Code? Open in Web Editor NEW
49.0 12.0 18.0 621 KB

pythonic wrapper for libhts (moved to: https://github.com/quinlan-lab/hts-python)

Home Page: https://github.com/quinlan-lab/hts-python

License: MIT License

Python 57.56% C 41.79% Shell 0.65%
genomics python htslib bioinformatics bam sam fasta

hts-python's Introduction

hts-python has moved here

hts-python's People

Contributors

brentp avatar jimhavrilla avatar lrowe avatar slowkow avatar tomsasani avatar vals avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hts-python's Issues

Issue parsing some tags

Hey Brent :)

hts-python is having some difficulty parsing some tags in a specific BAM file:

>>>> import hts
>>>> in_file = hts.Bam('./actual.bam')
>>>> for read in in_file: print read.tags
[('MC', 'Z', '101M'), ('MD', 'Z', '16T2C80'), ('PG', 'Z', 'bwa-meth'), ('RG', 'Z', '44_Mm08_WEAd_Db2_WGBS_E_1_L001__trimmed'), ('NM', 'C', 28), ('MQ', 'C', 60), ('UQ', 'S', 40), ('\x04A', 'S', 67), ('WX', 'S', 67)] 
[('MC', 'Z', '7M1D94M'), ('MD', 'Z', '9T2C87'), ('PG', 'Z', 'bwa-meth'), ('RG', 'Z', '44_Mm08_WEAd_Db2_WGBS_E_1_L001__trimmed'), ('NM', 'C', 27), ('MQ', 'C', 25), ('UQ', 'S', 213), ('\x03A', 'S', 67), ('WX', 'S', 67)] 
...

Note the '\x03A' and '\x04a'. A 10-read sample of the full bam can be found here: http://ac.gt/actual.bam

Parsing these tags works in samtools and pysam, so it's a real/reproducible issue. If its any consolation, both pysam and samtools fail to parse another BAM file i have which only contains unmapped reads (no chromosome data, which causes the error), so perhaps i'm just having a bad day ;)
If you need more data, or anything else on my end, not a problem! โœŒ๏ธ

Memory leak in string construction

Hello,

I am inspired by your code and currently developing a cffi-based pysam alternative which works with Pypy. While testing your code I found that

ffi.new('kstring_t *', {'m': 0, 'l': 0, 's': ffi.NULL})

causes memory leak, so I replaced it with Pythonic way. You can find the change here:

HiDiHlabs@cd35d6f

Maybe there would be better way to do this? Thank you so much for your contribution!

Best regards,
Jeongbin Park

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.