Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fragment file path to a merged mudata object #133

Open
jolvhull opened this issue Mar 8, 2024 · 1 comment
Open

Add fragment file path to a merged mudata object #133

jolvhull opened this issue Mar 8, 2024 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@jolvhull
Copy link

jolvhull commented Mar 8, 2024

Dear muon-team,

I have converted my scATAC-seq SeuratObject to a mudata object but the information on the fragments files does not seem to be transferred. mdata.uns is empty.
My object is a merged object of multiple samples that each have a separate fragment file. I tried to run muon.atac.tl.locate_fragments by doing this for each subset in the object:
""""
samples = ['sample1', 'sample2', 'sample3']
fragment_dict = {
'sample1': os.path.join(work_dir, 'data/sample1_atac_fragments.tsv.gz),
sample2': os.path.join(work_dir, 'data/sample2_atac_fragments.tsv.gz),
sample3': os.path.join(work_dir, 'data/sample3_atac_fragments.tsv.gz)}

for x in samples:
muon.atac.tl.locate_fragments(mdata[mdata.obs.sample == x], fragments_dict[x])
""""

However, when I then try to continue with my QC, I still get the error "There is no fragments file located yet. Run muon.atac.tl.locate_fragments first."

When I subset my data, run muon.atac.tl.locate_fragments(sample1, fragments_dict['sample1'])
I am able to continue with QC (nucleosome signal)

How can I add the fragment file location for my complete dataset, where each subset, based on the value in an obs column, has its own fragment file?

Thank you!

@jolvhull jolvhull added the bug Something isn't working label Mar 8, 2024
@gtca
Copy link
Collaborator

gtca commented Apr 9, 2024

Hey @jolvhull,

If I understand the context correctly, the line mdata[mdata.obs.sample == x] returns a view into the part of the MuData object. You can read more about views vs copies here.

The views are read-only by definition, and the underlying data for the three samples would be the same in this case.

What we can do is to add a warning to the locate_fragments() function when the input is a view.

@gtca gtca added enhancement New feature or request and removed bug Something isn't working labels Apr 9, 2024
@gtca gtca added this to the v0.1.7 milestone Apr 9, 2024
@gtca gtca modified the milestones: v0.1.7, v0.2.0 Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants