/usr/lib/python2.7/dist-packages/pysam/csamtools.pxd is in python-pysam 0.7.7-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | cdef extern from "string.h":
ctypedef int size_t
void *memcpy(void *dst,void *src,size_t len)
void *memmove(void *dst,void *src,size_t len)
void *memset(void *b,int c,size_t len)
cdef extern from "stdlib.h":
void free(void *)
void *malloc(size_t)
void *calloc(size_t,size_t)
void *realloc(void *,size_t)
int c_abs "abs" (int)
void qsort(void *base, size_t nmemb, size_t size,
int (*compar)(void *,void *))
cdef extern from "math.h":
double sqrt(double x)
cdef extern from "stdio.h":
ctypedef struct FILE:
pass
FILE *fopen(char *,char *)
FILE *freopen(char *path, char *mode, FILE *stream)
int fileno(FILE *stream)
int dup2(int oldfd, int newfd)
int fflush(FILE *stream)
FILE * stderr
FILE * stdout
int fclose(FILE *)
int sscanf(char *str,char *fmt,...)
int printf(char *fmt,...)
int sprintf(char *str,char *fmt,...)
int fprintf(FILE *ifile,char *fmt,...)
char *fgets(char *str,int size,FILE *ifile)
cdef extern from "ctype.h":
int toupper(int c)
int tolower(int c)
cdef extern from "unistd.h":
char *ttyname(int fd)
int isatty(int fd)
cdef extern from "string.h":
int strcmp(char *s1, char *s2)
int strncmp(char *s1,char *s2,size_t len)
char *strcpy(char *dest,char *src)
char *strncpy(char *dest,char *src, size_t len)
char *strdup(char *)
char *strcat(char *,char *)
size_t strlen(char *s)
int memcmp( void * s1, void *s2, size_t len )
cdef extern from "Python.h":
long _Py_HashPointer(void*)
FILE* PyFile_AsFile(object)
cdef extern from "razf.h":
pass
cdef extern from "stdint.h":
ctypedef int int8_t
ctypedef int int16_t
ctypedef int int32_t
ctypedef int int64_t
ctypedef int uint8_t
ctypedef int uint16_t
ctypedef int uint32_t
ctypedef int uint64_t
cdef extern from "bam.h":
# constants
int BAM_DEF_MASK
# IF _IOLIB=2, bamFile = BGZF, see bgzf.h
# samtools uses KNETFILE, check how this works
ctypedef struct tamFile:
pass
ctypedef struct bamFile:
pass
ctypedef struct bam1_core_t:
int32_t tid
int32_t pos
uint32_t bin
uint32_t qual
uint32_t l_qname
uint32_t flag
uint32_t n_cigar
int32_t l_qseq
int32_t mtid
int32_t mpos
int32_t isize
ctypedef struct bam1_t:
bam1_core_t core
int l_aux
int data_len
int m_data
uint8_t *data
ctypedef struct bam_pileup1_t:
bam1_t *b
int32_t qpos
int indel
int level
uint32_t is_del
uint32_t is_head
uint32_t is_tail
ctypedef int (*bam_pileup_f)(uint32_t tid, uint32_t pos, int n, bam_pileup1_t *pl, void *data)
ctypedef int (*bam_fetch_f)(bam1_t *b, void *data)
ctypedef struct bam_header_t:
int32_t n_targets
char **target_name
uint32_t *target_len
void *hash
void *rg2lib
int l_text
char *text
ctypedef struct bam_index_t:
int32_t n
uint64_t n_no_coor
ctypedef struct bam_plbuf_t:
pass
ctypedef struct pair64_t:
uint64_t u, v
ctypedef struct bam_iter_t:
int from_first
int tid, beg, end, n_off, i, finished
uint64_t curr_off
pair64_t *off
# ctypedef __bam_iter_t * bam_iter_t
bam1_t * bam_init1()
void bam_destroy1(bam1_t *)
bamFile razf_dopen(int data_fd, char *mode)
int64_t bam_seek( bamFile fp, uint64_t voffset, int where)
int64_t bam_tell( bamFile fp )
# void bam_init_header_hash(bam_header_t *header)
###############################################
# stand-ins for samtools macros
uint32_t * bam1_cigar( bam1_t * b)
char * bam1_qname( bam1_t * b)
uint8_t * bam1_seq( bam1_t * b)
uint8_t * bam1_qual( bam1_t * b)
uint8_t * bam1_aux( bam1_t * b)
###############################################
# bam iterator interface
bam_iter_t bam_iter_query( bam_index_t *idx, int tid, int beg, int end)
int bam_iter_read(bamFile fp, bam_iter_t iter, bam1_t *b)
void bam_iter_destroy(bam_iter_t iter)
###############################################
bam1_t * bam_dup1( bam1_t *src )
bam1_t * bam_copy1(bam1_t *bdst, bam1_t *bsrc)
bam_index_t *bam_index_load(char *f )
void bam_index_destroy(bam_index_t *idx)
int bam_parse_region(bam_header_t *header, char *str, int *ref_id, int *begin, int *end)
###############################################
bam_plbuf_t *bam_plbuf_init(bam_pileup_f func, void *data)
int bam_fetch(bamFile fp, bam_index_t *idx, int tid, int beg, int end, void *data, bam_fetch_f func)
int bam_plbuf_push(bam1_t *b, bam_plbuf_t *buf)
void bam_plbuf_destroy(bam_plbuf_t *buf)
########################################
# pileup iterator interface
ctypedef struct bam_plp_t:
pass
ctypedef bam_pileup1_t * const_bam_pileup1_t_ptr "const bam_pileup1_t *"
ctypedef int (*bam_plp_auto_f)(void *data, bam1_t *b)
bam_plp_t bam_plp_init( bam_plp_auto_f func, void *data)
int bam_plp_push( bam_plp_t iter, bam1_t *b)
bam_pileup1_t * bam_plp_next( bam_plp_t iter, int *_tid, int *_pos, int *_n_plp)
bam_pileup1_t * bam_plp_auto( bam_plp_t iter, int *_tid, int *_pos, int *_n_plp)
void bam_plp_set_mask(bam_plp_t iter, int mask)
void bam_plp_reset(bam_plp_t iter)
void bam_plp_destroy(bam_plp_t iter)
void bam_plp_set_maxcnt(bam_plp_t iter, int maxcnt)
##################################################
int bam_read1( bamFile fp, bam1_t *b)
int bam_validate1( bam_header_t *header, bam1_t *b)
int bam_write1( bamFile fp, bam1_t *b)
bam_header_t *bam_header_init()
int bam_header_write( bamFile fp, bam_header_t *header)
bam_header_t *bam_header_read( bamFile fp )
void bam_header_destroy(bam_header_t *header)
bam1_t * bam_dup1( bam1_t *src )
bam1_t * bam_copy1(bam1_t *bdst, bam1_t *bsrc)
uint8_t *bam_aux_get(bam1_t *b, char tag[2])
int32_t bam_aux2i(uint8_t *s)
float bam_aux2f(uint8_t *s)
double bam_aux2d(uint8_t *s)
char bam_aux2A( uint8_t *s)
char *bam_aux2Z( uint8_t *s)
int bam_reg2bin(uint32_t beg, uint32_t end)
uint32_t bam_calend(bam1_core_t *c, uint32_t *cigar)
int bam_aux_type2size( int )
cdef extern from *:
ctypedef char* const_char_ptr "const char*"
cdef extern from "sam.h":
ctypedef struct samfile_t_un:
tamFile tamr
bamFile bam
FILE *tamw
ctypedef struct samfile_t:
int type
samfile_t_un x
bam_header_t *header
samfile_t *samopen( const_char_ptr fn, char * mode, void *aux)
int sampileup( samfile_t *fp, int mask, bam_pileup_f func, void *data)
void samclose(samfile_t *fp)
int samread(samfile_t *fp, bam1_t *b)
int samwrite(samfile_t *fp, bam1_t *b)
int bam_prob_realn(bam1_t *b, char *ref)
int bam_cap_mapQ(bam1_t *b, char *ref, int thres)
#cdef extern from "glf.h":
# ctypedef struct glf1_t:
# pass
#cdef extern from "bam_maqcns.h":
#
# ctypedef struct bam_maqcns_t:
# float het_rate, theta
# int n_hap, cap_mapQ, errmod, min_baseQ
# float eta, q_r
# double *fk, *coef
# double *lhet
# void *aux
# glf1_t *bam_maqcns_glfgen(int n,
# bam_pileup1_t *pl,
# uint8_t ref_base,
# bam_maqcns_t *bm)
# ctypedef struct bam_maqindel_opt_t:
# int q_indel
# float r_indel
# float r_snp
# int mm_penalty, indel_err, ambi_thres
# uint32_t bam_maqcns_call(int n, bam_pileup1_t *pl, bam_maqcns_t *bm)
# bam_maqcns_t * bam_maqcns_init()
# void bam_maqcns_destroy(bam_maqcns_t *bm)
# void bam_maqcns_prepare(bam_maqcns_t *bm)
# uint32_t glf2cns(glf1_t *g, int q_r)
# int BAM_ERRMOD_MAQ2
# int BAM_ERRMOD_MAQ
# int BAM_ERRMOD_SOAP
# ctypedef struct bam_maqindel_ret_t:
# int indel1
# int indel2
# int cnt1
# int cnt2
# int cnt_anti
# int cnt_ref
# int cnt_ambi
# char *s[2]
# int gt
# int gl[2]
# int q_cns
# int q_ref
# void bam_maqindel_ret_destroy( bam_maqindel_ret_t * )
# bam_maqindel_opt_t *bam_maqindel_opt_init()
# bam_maqindel_ret_t * bam_maqindel(int n,
# int pos,
# bam_maqindel_opt_t * mi,
# bam_pileup1_t * pl,
# char *ref,
# int _n_types,
# int * _types )
cdef extern from "faidx.h":
ctypedef struct faidx_t:
pass
int fai_build(char *fn)
void fai_destroy(faidx_t *fai)
faidx_t *fai_load(char *fn)
char *fai_fetch(faidx_t *fai, char *reg, int *len)
int faidx_fetch_nseq(faidx_t *fai)
char *faidx_fetch_seq(faidx_t *fai, char *c_name,
int p_beg_i, int p_end_i, int *len)
cdef extern from "pysam_util.h":
int pysam_pileup_next(bam1_t *b,
bam_plbuf_t *buf,
bam_pileup1_t ** plp,
int * tid,
int * pos,
int * n_plp )
int pysam_dispatch(int argc, char *argv[] )
# stand-in functions for samtools macros
void pysam_bam_destroy1( bam1_t * b)
# add *nbytes* into the variable length data of *src* at *pos*
bam1_t * pysam_bam_update( bam1_t * b,
size_t nbytes_old,
size_t nbytes_new,
uint8_t * pos )
# translate char to unsigned char
unsigned char pysam_translate_sequence( char s )
unsigned char * bam_nt16_table
int pysam_reference2tid( bam_header_t *header, char * s )
void pysam_set_stderr( int fd )
void pysam_unset_stderr()
# return mapped/unmapped reads on tid
uint32_t pysam_get_mapped( bam_index_t *idx, int tid )
uint32_t pysam_get_unmapped( bam_index_t *idx, int tid )
# uint32_t pysam_glf_depth( glf1_t * g )
# void pysam_dump_glf( glf1_t * g, bam_maqcns_t * c )
ctypedef struct gzFile:
pass
ctypedef struct kstring_t:
size_t l
size_t m
char *s
ctypedef struct kseq_t:
kstring_t name
kstring_t comment
kstring_t seq
kstring_t qual
gzFile gzopen( char *, char * )
kseq_t * kseq_init( gzFile )
int kseq_read( kseq_t * )
void kseq_destroy( kseq_t * )
void gzclose( gzFile )
####################################################################
# Utility types
ctypedef struct __iterdata:
samfile_t * samfile
bam_iter_t iter
faidx_t * fastafile
int tid
char * seq
int seq_len
####################################################################
#
# Exposing pysam extension classes
#
# Note: need to declare all C fields and methods here
#
cdef class Fastafile:
cdef object _filename, _references, _lengths, reference2length
cdef faidx_t* fastafile
cdef char* _fetch(self, char* reference, int start, int end, int* length)
cdef class FastqProxy:
cdef kseq_t * _delegate
cdef class Fastqfile:
cdef object _filename
cdef gzFile fastqfile
cdef kseq_t * entry
cdef kseq_t * getCurrent( self )
cdef int cnext(self)
cdef class AlignedRead:
# object that this AlignedRead represents
cdef bam1_t * _delegate
cdef class Samfile:
cdef object _filename
# pointer to samfile
cdef samfile_t * samfile
# pointer to index
cdef bam_index_t *index
# true if file is a bam file
cdef int isbam
# true if not a file but a stream
cdef int isstream
# true if file is not on the local filesystem
cdef int isremote
# current read within iteration
cdef bam1_t * b
# file opening mode
cdef char * mode
# beginning of read section
cdef int64_t start_offset
cdef bam_header_t * _buildHeader( self, new_header )
cdef bam1_t * getCurrent( self )
cdef int cnext(self)
# write an aligned read
cpdef int write( self, AlignedRead read )
cdef char * _getrname( self, int tid )
cdef class PileupProxy:
cdef bam_pileup1_t ** plp
cdef int tid
cdef int pos
cdef int n_pu
cdef class PileupRead:
cdef AlignedRead _alignment
cdef int32_t _qpos
cdef int _indel
cdef int _level
cdef uint32_t _is_del
cdef uint32_t _is_head
cdef uint32_t _is_tail
cdef class IteratorRow:
pass
cdef class IteratorRowRegion(IteratorRow):
cdef bam_iter_t iter # iterator state object
cdef bam1_t * b
cdef int retval
cdef Samfile samfile
cdef samfile_t * fp
# true if samfile belongs to this object
cdef int owns_samfile
cdef bam1_t * getCurrent( self )
cdef int cnext(self)
cdef class IteratorRowAll(IteratorRow):
cdef bam1_t * b
cdef samfile_t * fp
cdef int owns_samfile
cdef bam1_t * getCurrent( self )
cdef int cnext(self)
cdef class IteratorRowAllRefs(IteratorRow):
cdef Samfile samfile
cdef int tid
cdef IteratorRowRegion rowiter
cdef class IteratorRowSelection(IteratorRow):
cdef bam1_t * b
cdef int current_pos
cdef samfile_t * fp
cdef positions
# true if samfile belongs to this object
cdef int owns_samfile
cdef bam1_t * getCurrent( self )
cdef int cnext(self)
cdef class IteratorColumn:
# result of the last plbuf_push
cdef IteratorRowRegion iter
cdef int tid
cdef int pos
cdef int n_plp
cdef int mask
cdef const_bam_pileup1_t_ptr plp
cdef bam_plp_t pileup_iter
cdef __iterdata iterdata
cdef Samfile samfile
cdef Fastafile fastafile
cdef stepper
cdef int max_depth
cdef int cnext(self)
cdef char * getSequence( self )
cdef setMask( self, mask )
cdef setupIteratorData( self,
int tid,
int start,
int end,
int reopen = ? )
cdef reset( self, tid, start, end )
cdef class IteratorColumnRegion(IteratorColumn):
cdef int start
cdef int end
cdef int truncate
cdef class IteratorColumnAllRefs(IteratorColumn):
pass
cdef class IndexedReads:
cdef Samfile samfile
cdef samfile_t * fp
cdef index
# true if samfile belongs to this object
cdef int owns_samfile
|