|
|
def | __init__ (self) |
| |
| def | __add__ (self, rsc) |
| |
| def | __eq__ (self, rsc) |
| |
| def | __getitem__ (self, key) |
| |
| def | __iadd__ (self, rsc) |
| |
| def | __len__ (self) |
| |
| def | add_entry (self, rsidx, e) |
| |
| def | add_entry_line (self, e) |
| |
| def | add_entry_from_args (self, chrom, rsid, pos, silent=False) |
| |
| def | get_by_chr_pos (self, chrom, pos) |
| |
| def | get_by_rsid (self, rsid) |
| |
| def | get_major (self, mut=True) |
| |
|
def | __init__ (self) |
| |
| def | __add__ (self, rsc) |
| |
| def | __eq__ (self, rsc) |
| |
| def | __getitem__ (self, key) |
| |
| def | __iadd__ (self, rsc) |
| |
| def | __len__ (self) |
| |
| def | add_entry (self, rsidx, e) |
| |
| def | add_entry_line (self, e) |
| |
| def | add_entry_from_args (self, chrom, rsid, pos, quiet=False) |
| |
| def | dump_vcf (self, fn, cons=False, is_maj=False, append=False) |
| |
| def | get_by_chr_pos (self, chrom, pos) |
| |
| def | get_by_rsid (self, rsid) |
| |
| def | get_major (self, mut=True) |
| |
|
| def | decode_bit (bit_code) |
| |
| def | encode_bit (var_list) |
| |
| def | filter_vcf (rsc_dir, fn_in, fn_out, pop=None, log_fn=None, quiet=False) |
| |
| def | get_chrom_from_filename (fn) |
| |
| def | load_from_file_full (fn, quiet=False) |
| |
| def | load_from_file_pop (fn, pop, quiet=False) |
| |
| def | open (fn) |
| |
| def | chrom_to_int (c) |
| |
| def | decode_bit (bit_code) |
| |
| def | encode_bit (var_list) |
| |
| def | filter_vcf (rsc_dir, fn_in, fn_out, pop=None, log_fn=None, cons=False, keep_samps=False, quiet=False) |
| |
| def | get_chrom_from_filename (fn) |
| |
| def | load_from_file_full (fn, quiet=False) |
| |
| def | load_from_file_pop (fn, pop, quiet=False) |
| |
| def | open (fn) |
| |
| def | sort_rsidx (rsidx) |
| |
| def | var_list_to_vcf (rsidx, var_list, cons=False) |
| |
|
|
| entries |
| |
|
| chr_pos_table |
| |
|
| rsid_table |
| |
◆ __add__() [1/2]
| def SlimRSCollection.BitRSCollection.__add__ |
( |
|
self, |
|
|
|
rsc |
|
) |
| |
Implement addition for two RSCollection objects.
◆ __add__() [2/2]
| def SlimRSCollection.BitRSCollection.__add__ |
( |
|
self, |
|
|
|
rsc |
|
) |
| |
Implement addition for two RSCollection objects.
◆ __eq__() [1/2]
| def SlimRSCollection.BitRSCollection.__eq__ |
( |
|
self, |
|
|
|
rsc |
|
) |
| |
Implement equality checking for two RSCollection objects.
◆ __eq__() [2/2]
| def SlimRSCollection.BitRSCollection.__eq__ |
( |
|
self, |
|
|
|
rsc |
|
) |
| |
Implement equality checking for two RSCollection objects.
◆ __getitem__() [1/2]
| def SlimRSCollection.BitRSCollection.__getitem__ |
( |
|
self, |
|
|
|
key |
|
) |
| |
Allow access to entries via the [] operator.
◆ __getitem__() [2/2]
| def SlimRSCollection.BitRSCollection.__getitem__ |
( |
|
self, |
|
|
|
key |
|
) |
| |
Allow access to entries via the [] operator.
◆ __iadd__() [1/2]
| def SlimRSCollection.BitRSCollection.__iadd__ |
( |
|
self, |
|
|
|
rsc |
|
) |
| |
Implement incremental addition.
◆ __iadd__() [2/2]
| def SlimRSCollection.BitRSCollection.__iadd__ |
( |
|
self, |
|
|
|
rsc |
|
) |
| |
Implement incremental addition.
◆ __len__() [1/2]
| def SlimRSCollection.BitRSCollection.__len__ |
( |
|
self | ) |
|
◆ __len__() [2/2]
| def SlimRSCollection.BitRSCollection.__len__ |
( |
|
self | ) |
|
◆ add_entry() [1/2]
| def SlimRSCollection.BitRSCollection.add_entry |
( |
|
self, |
|
|
|
rsidx, |
|
|
|
e |
|
) |
| |
Add entry from a variant list.
Parameters:
rsidx: Tuple of (rsid, chrom, pos)
e: List of variants (output from decode_bit)
◆ add_entry() [2/2]
| def SlimRSCollection.BitRSCollection.add_entry |
( |
|
self, |
|
|
|
rsidx, |
|
|
|
e |
|
) |
| |
Add entry from a variant list.
Parameters:
rsidx: Tuple of (rsid, chrom, pos)
e: List of variants (output from decode_bit)
◆ add_entry_from_args() [1/2]
| def SlimRSCollection.BitRSCollection.add_entry_from_args |
( |
|
self, |
|
|
|
chrom, |
|
|
|
rsid, |
|
|
|
pos, |
|
|
|
quiet = False |
|
) |
| |
Add an entry based on the given arguments.
Parameters:
chrom: Chromosome of the entry being added
rsid: RefSNP ID of the entry being added
pos: Position of the entry being added
quiet: Suppress progress information being printed
◆ add_entry_from_args() [2/2]
| def SlimRSCollection.BitRSCollection.add_entry_from_args |
( |
|
self, |
|
|
|
chrom, |
|
|
|
rsid, |
|
|
|
pos, |
|
|
|
silent = False |
|
) |
| |
Add an entry based on the given arguments.
Parameters:
chrom: Chromosome of the entry being added
rsid: RefSNP ID of the entry being added
pos: Position of the entry being added
silent: Whether to suppress progress information being printed
◆ add_entry_line() [1/2]
| def SlimRSCollection.BitRSCollection.add_entry_line |
( |
|
self, |
|
|
|
e |
|
) |
| |
Add entry from a line in a ConsDB file.
Parameters:
e: Line from a ConsDB file containing the entry to add
◆ add_entry_line() [2/2]
| def SlimRSCollection.BitRSCollection.add_entry_line |
( |
|
self, |
|
|
|
e |
|
) |
| |
Add entry from a line in a ConsDB file.
Parameters:
e: Line from a ConsDB file containing the entry to add
◆ chrom_to_int()
| def SlimRSCollection.BitRSCollection.chrom_to_int |
( |
|
c | ) |
|
|
static |
Function to use to sort chromosomes (numeric < X < Y < M)
Parameters:
c: Chromosome to convert
◆ decode_bit() [1/2]
| def SlimRSCollection.BitRSCollection.decode_bit |
( |
|
bit_code | ) |
|
|
static |
Convert from bit-packed int to list of variants.
Parameters:
bit_code: int that can be unpacked into a list of variants
◆ decode_bit() [2/2]
| def SlimRSCollection.BitRSCollection.decode_bit |
( |
|
bit_code | ) |
|
|
static |
Convert from bit-packed int to list of variants.
Parameters:
bit_code: int that can be unpacked into a list of variants
◆ dump_vcf()
| def SlimRSCollection.BitRSCollection.dump_vcf |
( |
|
self, |
|
|
|
fn, |
|
|
|
cons = False, |
|
|
|
is_maj = False, |
|
|
|
append = False |
|
) |
| |
Create a VCF file containing the variants in the BitRSCollection object.
If saving a consensus VCF file, makes sure that there is only one
alternate allele per line. The append argument allows support for
loading/saving in a piecewise fashion.
Parameters:
fn: File to save VCF to
cons: If this VCF file is a consensus VCF
is_maj: If this RSCollection object already contains only major alleles
append: If appending to an existing VCF file
◆ encode_bit() [1/2]
| def SlimRSCollection.BitRSCollection.encode_bit |
( |
|
var_list | ) |
|
|
static |
Create a bit-packed int from a list of variants.
Parameters:
var_list: List of variants
◆ encode_bit() [2/2]
| def SlimRSCollection.BitRSCollection.encode_bit |
( |
|
var_list | ) |
|
|
static |
Create a bit-packed int from a list of variants.
Parameters:
var_list: List of variants
◆ filter_vcf() [1/2]
| def SlimRSCollection.BitRSCollection.filter_vcf |
( |
|
rsc_dir, |
|
|
|
fn_in, |
|
|
|
fn_out, |
|
|
|
pop = None, |
|
|
|
log_fn = None, |
|
|
|
cons = False, |
|
|
|
keep_samps = False, |
|
|
|
quiet = False |
|
) |
| |
|
static |
Filter a given VCF file using ConsDB files stored in the given dir.
Remove all records that call a variant that is a major allele and write
all other records.
Parameters:
rsc_dir: Directory containing ConsDB files
fn_in: Input VCF file to filter
fn_out: Output filename
pop: Population to use
log_fn: Optional file to store progress/log output
cons: Making a consensus VCF (keep major alleles instead of minor)
keep_samps: Write sample information
quiet: Disable progress/log output to stdout
◆ filter_vcf() [2/2]
| def SlimRSCollection.BitRSCollection.filter_vcf |
( |
|
rsc_dir, |
|
|
|
fn_in, |
|
|
|
fn_out, |
|
|
|
pop = None, |
|
|
|
log_fn = None, |
|
|
|
quiet = False |
|
) |
| |
|
static |
Filter a given VCF file using ConsDB files stored in the given dir.
Remove all records that call a variant that is a major allele and write
all other records.
Parameters:
rsc_dir: Directory containing ConsDB files
fn_in: Input VCF file to filter
fn_out: Output filename
pop: Population to use
log_fn: Optional file to store progress/log output
quiet: Disable progress/log output to stdout
◆ get_by_chr_pos() [1/2]
| def SlimRSCollection.BitRSCollection.get_by_chr_pos |
( |
|
self, |
|
|
|
chrom, |
|
|
|
pos |
|
) |
| |
Return a list of all (rsid, chrom, pos) combinations that match the
given chrom and pos, and a list of corresponding entries.
Parameters:
chrom: Chromosome to get
pos: Position to get
◆ get_by_chr_pos() [2/2]
| def SlimRSCollection.BitRSCollection.get_by_chr_pos |
( |
|
self, |
|
|
|
chrom, |
|
|
|
pos |
|
) |
| |
Return a list of all (rsid, chrom, pos) combinations that match the
given chrom and position, and a list of corresponding entries.
Parameters:
chrom: Chromosome to get
pos: Position to get
◆ get_by_rsid() [1/2]
| def SlimRSCollection.BitRSCollection.get_by_rsid |
( |
|
self, |
|
|
|
rsid |
|
) |
| |
Return a list of all (rsid, chrom, pos) combinations that match the
given RefSNP ID, and a list of corresponding entries.
Parameters:
rsid: RefSNP ID number to get
◆ get_by_rsid() [2/2]
| def SlimRSCollection.BitRSCollection.get_by_rsid |
( |
|
self, |
|
|
|
rsid |
|
) |
| |
Return a list of all (rsid, chrom, pos) combinations that match the
given RefSNP ID, and a list of corresponding entries.
Parameters:
rsid: RefSNP ID number to get
◆ get_chrom_from_filename() [1/2]
| def SlimRSCollection.BitRSCollection.get_chrom_from_filename |
( |
|
fn | ) |
|
|
static |
Helper method to parse a filename and find which chromosome it is.
Parameters:
fn: Filename to use
◆ get_chrom_from_filename() [2/2]
| def SlimRSCollection.BitRSCollection.get_chrom_from_filename |
( |
|
fn | ) |
|
|
static |
Helper method to parse a filename and find which chromosome it is.
Parameters:
fn: Filename to use
◆ get_major() [1/2]
| def SlimRSCollection.BitRSCollection.get_major |
( |
|
self, |
|
|
|
mut = True |
|
) |
| |
Return a RSCollection object containing all major alleles.
Parameters:
mut: Whether to only include variants that are different between
reference and alternate allele
◆ get_major() [2/2]
| def SlimRSCollection.BitRSCollection.get_major |
( |
|
self, |
|
|
|
mut = True |
|
) |
| |
Return a BitRSCollection object containing all major alleles.
Parameters:
mut: Whether to only include variants that are different between
reference and alternate allele
◆ load_from_file_full() [1/2]
| def SlimRSCollection.BitRSCollection.load_from_file_full |
( |
|
fn, |
|
|
|
quiet = False |
|
) |
| |
|
static |
Load an entire ConsDB file.
Parameters:
fn: Filename to load
quiet: Disable progress/log output to stdout
◆ load_from_file_full() [2/2]
| def SlimRSCollection.BitRSCollection.load_from_file_full |
( |
|
fn, |
|
|
|
quiet = False |
|
) |
| |
|
static |
Load an entire ConsDB file.
Parameters:
fn: Filename to load
quiet: Disable progress/log output to stdout
◆ load_from_file_pop() [1/2]
| def SlimRSCollection.BitRSCollection.load_from_file_pop |
( |
|
fn, |
|
|
|
pop, |
|
|
|
quiet = False |
|
) |
| |
|
static |
Load an entire ConsDB file, setting the allele frequency as the AF of
the given population.
Skip variants that are not present in the given population.
Parameters:
fn: Filename to use
pop: Population to load
quiet: Disable progress/log output to stdout
◆ load_from_file_pop() [2/2]
| def SlimRSCollection.BitRSCollection.load_from_file_pop |
( |
|
fn, |
|
|
|
pop, |
|
|
|
quiet = False |
|
) |
| |
|
static |
Load an entire ConsDB file, setting the allele frequency as the AF of
the given population.
Skip variants that are not present in the given population.
Parameters:
fn: Filename to use
pop: Population to load
quiet: Disable progress/log output to stdout
◆ open() [1/2]
| def SlimRSCollection.BitRSCollection.open |
( |
|
fn | ) |
|
|
static |
Helper method to appropriately open the given file.
◆ open() [2/2]
| def SlimRSCollection.BitRSCollection.open |
( |
|
fn | ) |
|
|
static |
Helper method to appropriately open the given file.
Parameters:
fn: Filename to open
◆ sort_rsidx()
| def SlimRSCollection.BitRSCollection.sort_rsidx |
( |
|
rsidx | ) |
|
|
static |
Helper method to sort a list of rsidx. Meant to be used as a
key for sorting. Returns the chromosome and position of the rsidx, both
in int form.
Parameters:
rsidx: List/tuple of (rsid, chrom, pos)
◆ var_list_to_vcf()
| def SlimRSCollection.BitRSCollection.var_list_to_vcf |
( |
|
rsidx, |
|
|
|
var_list, |
|
|
|
cons = False |
|
) |
| |
|
static |
Helper method to convert a list of variants to vcf entry(ies).
Parameters:
rsidx: List/tuple of (rsid, chrom, pos)
var_list: List of variants (as returned from BitRSCollection.decode_bit)
cons: Making a consensus VCF file
◆ BASE_ENC
| dictionary SlimRSCollection.BitRSCollection.BASE_ENC |
|
static |
Initial value:= {
'A': 0,
'C': 1,
'G': 2,
'T': 3
}
The documentation for this class was generated from the following files:
- SlimRSCollection.old.py
- SlimRSCollection.py