-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate signatures from 10x single cell bam file (#539)
* Add reading 10x bam files * Add threads to arguments * Add pathos and bamnostic to requirements * Skip 10x test only if bamnostic not installed
- Loading branch information
Showing
8 changed files
with
729 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,5 @@ sphinx | |
alabaster | ||
recommonmark | ||
sphinxcontrib-napoleon | ||
pathos | ||
bamnostic>=0.9.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import os | ||
import bamnostic as bs | ||
|
||
|
||
def read_single_column(filename): | ||
"""Read single-column barcodes.tsv and genes.tsv files from 10x""" | ||
with open(filename) as f: | ||
lines = set(line.strip() for line in f) | ||
return lines | ||
|
||
|
||
def read_10x_folder(folder): | ||
"""Get QC-pass barcodes, genes, and bam file from a 10x folder""" | ||
barcodes = read_single_column(os.path.join(folder, 'barcodes.tsv')) | ||
|
||
bam_file = bs.AlignmentFile( | ||
os.path.join(folder, 'possorted_genome_bam.bam'), mode='rb') | ||
|
||
return barcodes, bam_file |
Oops, something went wrong.