Skip to content

Commit e645f20

Browse files
authored
Merge pull request #17 from KCCG/cram2
CRAM
2 parents 54dccc8 + 31bf82e commit e645f20

21 files changed

+365
-17
lines changed

.gitattributes

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
test/*.bam filter=lfs diff=lfs merge=lfs -text
2-
test/*.bai filter=lfs diff=lfs merge=lfs -text
1+
*.cram filter=lfs diff=lfs merge=lfs -text
2+
*.bam filter=lfs diff=lfs merge=lfs -text
3+
*.bai filter=lfs diff=lfs merge=lfs -text
4+
*.crai filter=lfs diff=lfs merge=lfs -text

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ RUN \
5656
#RUN pip install -i https://test.pypi.org/simple/ mitywgs==0.2.2rc2
5757

5858
# Install mity
59-
RUN pip install mitywgs==0.3.1
59+
RUN pip install mitywgs==0.4.0
6060

6161
WORKDIR /home
6262

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Installation instructions via Docker, pip, or manually are available in [INSTALL
2626
This is an example of calling variants in the Ashkenazim Trio.
2727

2828
## mity call
29-
First run `mity call` on three MT BAMs provided in [mity/test_in](https://github.com/KCCG/mity/blob/master/test_in).
29+
First run `mity call` on three MT BAMs provided in [mity/test_in](https://github.com/KCCG/mity/blob/master/test_in). CRAM files are supported.
3030

3131
We recommend always using `--normalise`, or `mity report` won't work:
3232
```bash
@@ -152,7 +152,7 @@ should interpret and validate tier 3 variant still holds.
152152
We would appreciate any feedback you may have on this.
153153

154154
## CRAM support
155-
mity currently does not support CRAM, but we plan to add this.
155+
CRAM support was added to `mity call` in v0.4.0.
156156

157157
# Acknowledgements
158158
We would like to thank:

Readme.Developer.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ samtools view -b -o NA12878.alt_bwamem_GRCh38DH.20150718.CEU.low_coverage.chrM.b
186186

187187
# Docker
188188
```
189-
version=0.3.1
189+
version=0.4.0
190190
docker build --tag=latest --tag=$version --tag=drmjc/mity:latest --tag=drmjc/mity:$version .
191191
docker push drmjc/mity # equivalent to docker push drmjc/mity:latest
192192
docker push drmjc/mity:$version

build.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ function docker {
2929
docker run drmjc/mity version
3030
}
3131
#test
32-
public && docker
32+
public
33+
wait 20 && docker

mitylib/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.3.1"
1+
__version__ = "0.4.0"

mitylib/call.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def do_call(bam_files, reference, genome=None, prefix=None, min_mq=30, min_bq=24
1111
out_folder_path=".", region=None):
1212
"""
1313
Run mity call.
14-
:param bam_files: a list of bam_files
14+
:param bam_files: a list of bam or cram files
1515
:param reference: the path to the reference genome file (fasta format)
1616
:param genome: the path to the reference genome file for gsort (genome format). Required if normalise=True
1717
:param prefix: The result filename prefix. If None, then the first bam_file prefix
@@ -34,13 +34,13 @@ def do_call(bam_files, reference, genome=None, prefix=None, min_mq=30, min_bq=24
3434

3535
if len(bam_files) > 1 and prefix is None:
3636
raise ValueError(
37-
"If there is more than one bam file, --prefix must be set")
37+
"If there is more than one bam/cram file, --prefix must be set")
3838

3939
check_missing_file(bam_files, die=True)
4040
prefix = create_prefix(bam_files[0], prefix)
4141

4242
if not all(map(bam_has_RG, bam_files)):
43-
logging.error("At least one BAM file lacks an @RG header")
43+
logging.error("At least one BAM/CRAM file lacks an @RG header")
4444
exit(1)
4545

4646
if normalise and genome is None:

mitylib/util.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def tmp_mity_file_name():
4949
def create_prefix(file_name, prefix=None):
5050
"""
5151
Most mity functions have an optional prefix. If a prefix is not specified,
52-
then use the file name (minus the .vcf.gz or .bam suffix) as the prefix.
53-
:param file_name: The vcf, bam, bed filename
52+
then use the file name (minus the .vcf.gz, .bam or .cram suffix) as the prefix.
53+
:param file_name: The vcf, bam, cram, bed filename
5454
:param prefix: The optional prefix. If None, then create a prefix from
5555
file_name, else return prefix
5656
:return: str prefix
@@ -61,6 +61,8 @@ def create_prefix(file_name, prefix=None):
6161
prefix = [os.path.basename(file_name).split(".vcf")[0], prefix][prefix is not None]
6262
elif ".bam" in file_name:
6363
prefix = [os.path.basename(file_name).split(".bam")[0], prefix][prefix is not None]
64+
elif ".cram" in file_name:
65+
prefix = [os.path.basename(file_name).split(".cram")[0], prefix][prefix is not None]
6466
else:
6567
raise ValueError("Unsupported file type")
6668
return prefix
@@ -332,7 +334,7 @@ def vcf_get_mt_contig(vcf):
332334
def bam_get_mt_contig(bam, as_string=False):
333335
"""
334336
get the mitochondrial contig name and length from a BAM file
335-
:param bam: path to a bam file
337+
:param bam: path to a bam or cram file
336338
:return: a tuple of contig name as str and length as int
337339
338340
>>> bam_get_mt_contig('NA12878.alt_bwamem_GRCh38DH.20150718.CEU.low_coverage.chrM.bam', False)
@@ -355,9 +357,9 @@ def bam_get_mt_contig(bam, as_string=False):
355357

356358
def bam_has_RG(bam):
357359
"""
358-
Does the BAM File have an @RG header? This is critical for mity to correctly call variants.
360+
Does the BAM or CRAM File have an @RG header? This is critical for mity to correctly call variants.
359361
360-
:param bam: str: path to bam file
362+
:param bam: str: path to bam or cram file
361363
:return: True/False
362364
>>> bam_has_RG('NA12878.alt_bwamem_GRCh38DH.20150718.CEU.low_coverage.chrM.bam')
363365
"""

0 commit comments

Comments
 (0)