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

PD-2739 Add peakcalling to Multiome ATAC subpipeline #1391

Open
wants to merge 46 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
ce90d53
add peak calling
aawdeh Oct 16, 2024
82c5c45
added output for peaks
aawdeh Oct 16, 2024
6e833d2
fix
aawdeh Oct 16, 2024
76286b4
fix
aawdeh Oct 16, 2024
90805ca
test
aawdeh Oct 16, 2024
b27011c
remove ls
aawdeh Oct 17, 2024
c1f0e57
test
aawdeh Oct 18, 2024
90b193c
Merge branch 'develop' into aa-peakcall
aawdeh Oct 18, 2024
779fe9b
test
aawdeh Oct 18, 2024
6d52ad2
Merge branch 'aa-peakcall' of https://github.com/broadinstitute/warp …
aawdeh Oct 18, 2024
5743eff
test
aawdeh Oct 18, 2024
d3749c8
test
aawdeh Oct 18, 2024
1de1c85
test
aawdeh Oct 18, 2024
2d18756
test
aawdeh Oct 18, 2024
13a44f9
test
aawdeh Oct 21, 2024
3f12b9e
made another task
aawdeh Oct 21, 2024
08b2f24
test
aawdeh Oct 21, 2024
80c1416
test
aawdeh Oct 21, 2024
b5191e5
test
aawdeh Oct 21, 2024
4725080
test
aawdeh Oct 21, 2024
f139f84
test
aawdeh Oct 22, 2024
9a0ea9b
test
aawdeh Oct 22, 2024
04cf0d2
test
aawdeh Oct 22, 2024
f9bc871
change a line
aawdeh Oct 24, 2024
93d3360
test
aawdeh Oct 24, 2024
256c4e5
test
aawdeh Oct 24, 2024
cd849b5
test
aawdeh Oct 24, 2024
7c62fd1
test
aawdeh Oct 24, 2024
b15b146
test
aawdeh Oct 24, 2024
ff36c15
test
aawdeh Oct 24, 2024
27a4196
test
aawdeh Oct 24, 2024
987b5d2
Add peakcall to task
aawdeh Oct 28, 2024
cce5841
test
aawdeh Oct 28, 2024
39ef1a5
Merge branch 'develop' into aa-peakcall
aawdeh Oct 28, 2024
bf0e9ce
add parameters
aawdeh Oct 28, 2024
d9240d6
Merge branch 'aa-peakcall' of https://github.com/broadinstitute/warp …
aawdeh Oct 28, 2024
1ec5ff1
Merge branch 'develop' into aa-peakcall
aawdeh Oct 30, 2024
90172ee
Merge branch 'develop' into aa-peakcall
aawdeh Nov 4, 2024
18f77d8
test
aawdeh Nov 4, 2024
f7bdfa2
Merge branch 'aa-peakcall' of https://github.com/broadinstitute/warp …
aawdeh Nov 4, 2024
db59231
peak calling
rsc3 Dec 13, 2024
7b5a87e
looking for conflicts in atac.wdl
rsc3 Dec 13, 2024
0d4f010
remove bam_base_name from CreateFragments task
rsc3 Dec 13, 2024
987e1e5
separate task for macs3 consistent with create fragments
rsc3 Dec 13, 2024
0bc38f6
Update atac.wdl
rsc3 Dec 16, 2024
b136ba3
snapatac2 updates
rsc3 Dec 16, 2024
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
Next Next commit
add peak calling
  • Loading branch information
aawdeh committed Oct 16, 2024
commit ce90d5380c88f31f284839b2509f6ac16683ac0a
26 changes: 20 additions & 6 deletions pipelines/skylab/atac/atac.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ task CreateFragmentFile {
atac_gtf = "~{annotations_gtf}"
preindex = "~{preindex}"
atac_nhash_id = "~{atac_nhash_id}"
peakcalling_bool = true

# calculate chrom size dictionary based on text file
chrom_size_dict={}
Expand All @@ -553,10 +554,10 @@ task CreateFragmentFile {
import csv

# extract CB or BB (if preindex is true) tag from bam file to create fragment file
if preindex == "true":
data = pp.recipe_10x_metrics("~{bam}", "~{bam_base_name}.fragments.tsv", "temp_metrics.h5ad", is_paired=True, barcode_tag="BB", chrom_sizes=chrom_size_dict, gene_anno=atac_gtf, peaks=None)
elif preindex == "false":
data = pp.recipe_10x_metrics("~{bam}", "~{bam_base_name}.fragments.tsv", "temp_metrics.h5ad", is_paired=True, barcode_tag="CB", chrom_sizes=chrom_size_dict, gene_anno=atac_gtf, peaks=None)
if preindex:
data = pp.recipe_10x_metrics("~{bam}", "~{bam_base_name}.fragments.tsv", "temp_metrics.h5ad", is_paired=True, barcode_tag="BB", chrom_sizes=chrom_size_dict, gene_anno=atac_gtf, peaks=None)
else:
data = pp.recipe_10x_metrics("~{bam}", "~{bam_base_name}.fragments.tsv", "temp_metrics.h5ad", is_paired=True, barcode_tag="CB", chrom_sizes=chrom_size_dict, gene_anno=atac_gtf, peaks=None)

# Add NHashID to metrics
nhash_ID_value = "XXX"
Expand All @@ -575,17 +576,30 @@ task CreateFragmentFile {
with open(csv_file_path, mode='w', newline='') as file:
writer = csv.writer(file)
writer.writerows(flattened_data) # Write data

print(f"Dictionary successfully written to {csv_file_path}")

atac_data = ad.read_h5ad("temp_metrics.h5ad")
# Add nhash_id to h5ad file as unstructured metadata
atac_data.uns['NHashID'] = atac_nhash_id
# calculate tsse metrics
snap.metrics.tsse(atac_data, atac_gtf)
# Write new atac file
atac_data.write_h5ad("~{bam_base_name}.metrics.h5ad")

# peak calling? https://kzhang.org/SnapATAC2/tutorials/diff.html#Peak-calling-at-the-cluster-level
if peakcalling_bool:
print("Peak calling using MACS3")
snap.tl.macs3(atac_data) # were not including cell type?
print("test")
print(data.uns['macs3'])

print("Writing peak files")
for k, peaks in data.uns['macs3'].items():
peaks.to_csv(f'{k}.NarrowPeak', sep='\t', header=False, index=False)
ls

# Write atac file
print("Writing h5ad file")
atac_data.write_h5ad("~{bam_base_name}.peaks.h5ad")
CODE
>>>

Expand Down