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
9 changes: 9 additions & 0 deletions singlecellmultiomics/bamProcessing/bamCopyNumber.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,15 @@ def bulk_trace(pdf_path, copy_mat, cell_cluster_names, cell_order,segmented_matr
ignore_contigs = None if args.ignore_contigs is None else args.ignore_contigs.split(',')

reference = pysam.FastaFile(args.ref)
# Determine contig lengths and skip contigs which are smaller than the provided bin size:
for contig, clen in zip(reference.references, reference.lengths):
if clen < bin_size:
if ignore_contigs is None:
ignore_contigs = [contig]
elif contig not in ignore_contigs:
ignore_contigs.append(contig)


h=GenomicPlot(reference, ignore_contigs=ignore_contigs)
contigs = GenomicPlot(reference).contigs

Expand Down
6 changes: 4 additions & 2 deletions singlecellmultiomics/bamProcessing/bamToCountTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def create_count_table(args, return_df=False):
for i, read in enumerate(pysam_iterator):
if i % 1_000_000 == 0:
print(
f"{bamFile} Processed {i} reads, assigned {assigned}, completion:{100*(i/(0.001+f.mapped+f.unmapped+f.nocoordinate))}%")
f"{bamFile} Processed {i} reads, assigned {assigned}, completion:{100*(i/(0.001+f.mapped+f.unmapped+f.nocoordinate)):.2f}%")

if args.head is not None and i > args.head:
break
Expand Down Expand Up @@ -547,7 +547,9 @@ def create_count_table(args, return_df=False):
f"Finished: {bamFile} Processed {i} reads, assigned {assigned}")
print(f"Finished counting, now exporting to {args.o}")
df = pd.DataFrame.from_dict(countTable)

# Sort indices:
df = df.sort_index(axis=1).sort_index(axis=0)

# Set names of indices
if not args.noNames:
df.columns.set_names([tagToHumanName(t, TagDefinitions)
Expand Down
2 changes: 1 addition & 1 deletion singlecellmultiomics/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '0.1.41'
__version__ = '0.1.43'