Skip to content
Open
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 misopy/pe_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def compute_insert_len(bams_to_process,
raise Exception, "Error: Insert length computation failed."

# Load mapped BAM filename
mapped_bam = pysam.Samfile(mapped_bam_filename, "rb")
mapped_bam = pysam.AlignmentFile(mapped_bam_filename, "rb")
###
### TODO: Rewrite this so that you only pair reads within an interval
###
Expand Down
6 changes: 3 additions & 3 deletions misopy/run_events_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ def check_gff_and_bam(gff_dir, bam_filename, main_logger,
%(bam_index_fname))
main_logger.warning("Are you sure your BAM file is indexed?")
print "Checking if BAM has mixed read lengths..."
bam_file = pysam.Samfile(bam_filename, "rb")
bam_file = pysam.AlignmentFile(bam_filename, "rb")
n = 0
seq_lens = {}
for bam_read in bam_file:
# Check more of the reads for mixed read lengths
if n >= (num_reads * 10):
break
seq_lens[len(bam_read.seq)] = True
seq_lens[bam_read.query_alignment_length] = True
n += 1
all_seq_lens = seq_lens.keys()
if len(all_seq_lens) > 1:
Expand Down Expand Up @@ -152,7 +152,7 @@ def check_gff_and_bam(gff_dir, bam_filename, main_logger,
gff_starts_with_chr = True
n += 1
# Read first few BAM reads chromosomes
bam_file = pysam.Samfile(bam_filename, "rb")
bam_file = pysam.AlignmentFile(bam_filename, "rb")
bam_chroms = {}
bam_starts_with_chr = False
n = 0
Expand Down
2 changes: 1 addition & 1 deletion misopy/sam_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def load_bam_reads(bam_filename,
"""
print "Loading BAM filename from: %s" %(bam_filename)
bam_filename = os.path.abspath(os.path.expanduser(bam_filename))
bamfile = pysam.Samfile(bam_filename, "rb",
bamfile = pysam.AlignmentFile(bam_filename, "rb",
template=template)
return bamfile

Expand Down
2 changes: 1 addition & 1 deletion misopy/sashimi_plot/plot_utils/plot_gene.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def plot_density_single(settings, sample_label,
Plot MISO events using BAM files and posterior distribution files.
TODO: If comparison files are available, plot Bayes factors too.
"""
bamfile = pysam.Samfile(bam_filename, 'rb')
bamfile = pysam.AlignmentFile(bam_filename, 'rb')
try:
subset_reads = bamfile.fetch(reference=chrom, start=tx_start,end=tx_end)
except ValueError as e:
Expand Down