modos.genomics.formats#
Classes#
Genomic region consisting of a chromosome (aka reference) name |
|
Enumeration of all supported genomic file suffixes. |
Functions#
|
Automatically instantiate a pysam file object from input path and passes any additional kwarg to it. |
Module Contents#
- class modos.genomics.formats.Region[source]#
Genomic region consisting of a chromosome (aka reference) name and a 0-indexed half-open coordinate interval. Note that the end may not be specified, in which it will be set to math.inf.
- to_htsget_query()[source]#
Serializes the region into an htsget URL query.
Example
>>> Region(chrom='chr1', start=0, end=100).to_htsget_query() 'referenceName=chr1&start=0&end=100'
- classmethod from_htsget_query(url)[source]#
Instantiate from an htsget URL query
Example
>>> Region.from_htsget_query( ... "http://localhost/htsget/reads/ex/demo1?format=CRAM&referenceName=chr1&start=0" ... ) Region(chrom='chr1', start=0, end=inf)
- Parameters:
url (str)
- classmethod from_ucsc(ucsc)[source]#
Instantiate from a UCSC-formatted region string.
Example
>>> Region.from_ucsc('chr-1ba:10-320') Region(chrom='chr-1ba', start=10, end=320) >>> Region.from_ucsc('chr1:-320') Region(chrom='chr1', start=0, end=320) >>> Region.from_ucsc('chr1:10-') Region(chrom='chr1', start=10, end=inf) >>> Region.from_ucsc('chr1:10') Region(chrom='chr1', start=10, end=inf)
Note
For more information about the UCSC coordinate system, see: http://genomewiki.ucsc.edu/index.php/Coordinate_Transforms
- classmethod from_pysam(record)[source]#
- Parameters:
record (pysam.VariantRecord | pysam.AlignedSegment)
- Return type:
- class modos.genomics.formats.GenomicFileSuffix[source]#
-
Enumeration of all supported genomic file suffixes.
- classmethod from_path(path)[source]#
- Parameters:
path (pathlib.Path)
- Return type:
- modos.genomics.formats.read_pysam(path, region=None, **kwargs)[source]#
Automatically instantiate a pysam file object from input path and passes any additional kwarg to it.
- Parameters:
path (pathlib.Path)
region (Optional[modos.genomics.region.Region])
- Return type:
Iterator[pysam.AlignedSegment | pysam.VariantRecord]