Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samplot/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env python
__version__ = "1.1.5"
__version__ = "1.1.6"
15 changes: 12 additions & 3 deletions samplot/samplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,12 @@ def get_tabix_iter(chrm, start, end, datafile):
Used to avoid chrX vs. X notation issues when extracting data from
annotation files
"""
tbx = pysam.TabixFile(datafile)
try:
tbx = pysam.TabixFile(datafile)
except:
tbx = pysam.TabixFile(datafile, index=datafile+".csi")


itr = None
try:
itr = tbx.fetch(chrm, max(0, start - 1000), end + 1000)
Expand Down Expand Up @@ -2212,7 +2217,9 @@ def gff_file(transcript_file):

idx_file = transcript_file + ".tbi"
if not os.path.isfile(idx_file):
parser.error("transcript file {} is missing .tbi index file".format(transcript_file))
idx_file = transcript_file + ".csi"
if not os.path.isfile(idx_file):
parser.error("transcript file {} is missing .tbi/.csi index file".format(transcript_file))
return transcript_file

parser.add_argument(
Expand Down Expand Up @@ -2250,7 +2257,9 @@ def bed_file(annotation_file):

idx_file = annotation_file + ".tbi"
if not os.path.isfile(idx_file):
parser.error("annotation file {} is missing .tbi index file".format(annotation_file))
idx_file = annotation_file + ".csi"
if not os.path.isfile(idx_file):
parser.error("annotation file {} is missing .tbi index file".format(annotation_file))
return annotation_file

parser.add_argument(
Expand Down
Binary file added test/data/Alu.2_X.csionly.bed.gz
Binary file not shown.
Binary file added test/data/Alu.2_X.csionly.bed.gz.csi
Binary file not shown.
Binary file added test/data/Homo_sapiens.GRCh37.csionly.2_X.gff3.gz
Binary file not shown.
Binary file not shown.
21 changes: 21 additions & 0 deletions test/func/samplot_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -541,4 +541,25 @@ if [ $translocation ]; then
assert_no_stderr
fi


out_file_name=$func_path"csi-annotation.png"
bam=$data_path"2_59305747-59505747_X_151018513-151218513.BND.bam"
run translocation \
samplot plot\
-c $sv_chrm_1 -s $sv_start_1 -e $sv_end_1 \
-c $sv_chrm_2 -s $sv_start_2 -e $sv_end_2 \
-b $bam \
-o $out_file_name \
-t $sv_type \
-A $data_path"Alu.2_X.csionly.bed.gz" \
-T $data_path"Homo_sapiens.GRCh37.csionly.2_X.gff3.gz" \
--zoom 10000
if [ $translocation ]; then
assert_exit_code 0
assert_equal $out_file_name $( ls $out_file_name )
assert_no_stdout
assert_no_stderr
fi


rm -rf $func_path"img/" ssshtest