Skip to content

confused about the B allele count #30

Description

@lichen2018

Dear author,
In function cell_by_gene_lefthap_counts in file get_snp_matrix.py, the phased alternative allele depth phased_AD.T is stored in cell_snp_Ballele,
def cell_by_gene_lefthap_counts(cellsnp_folder, eagle_folder, barcode_list):
......
......
phased_AD = np.where( (df_snp.GT.values == "0|1").reshape(-1,1), AD.A, (DP-AD).A )
phased_AD = scipy.sparse.csr_matrix(phased_AD)

# re-order based on barcode_list
index = np.array([barcode_mapper[x] for x in barcode_list if x in barcode_mapper])
DP = DP[:, index]
phased_AD = phased_AD[:, index]    

# returned matrix has shape (N_cells, N_snps), which is the transpose of the original matrix
return (DP-phased_AD).T, phased_AD.T, df_snp.snp_id.values

cell_snp_Aallele, cell_snp_Ballele, unique_snp_ids = cell_by_gene_lefthap_counts(args.cellsnplite_result_dir, args.eagle_out_dir, barcode_list)

while in function summarize_counts_for_blocks in utils_IO.py, the single_X which should contain BAF information store cell_snp_Aallele counts, is it right?

for b in range(df_block_contents.shape[0]):
    # BAF (SNPs)
    involved_snps_ids = [x for x in df_block_contents.snp_id.values[b] if not x is None]
    involved_snp_idx = np.array([map_snp_index[x] for x in involved_snps_ids])
    if len(involved_snp_idx) > 0:
        single_X[b, 1, :] = np.sum( cell_snp_Aallele[:, involved_snp_idx], axis=1 )
        single_total_bb_RD[b, :] = np.sum( cell_snp_Aallele[:, involved_snp_idx], axis=1 ) + np.sum( cell_snp_Ballele[:, involved_snp_idx], axis=1 )
    # RDR (genes)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions