-
Notifications
You must be signed in to change notification settings - Fork 4
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
Several fixes after running a full dataset #24
Open
LeonHafner
wants to merge
14
commits into
dev
Choose a base branch
from
fixing_bed_sort
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
23cca51
add sorting for chrom_sizes
LeonHafner f61345d
fix calculate_tpm
LeonHafner 86b199f
define memory parameter for ChromHMM binarizeBams
LeonHafner ef367ec
ChromHMM LearnModel add memory parameter
LeonHafner c94e85a
dynamite preprocess fix duplicates
LeonHafner ba2f075
fix dynamite balanced sampling
LeonHafner 1f6422a
change dynamite error strategy
LeonHafner 0b983e5
Fix tf_tg duplicate genes after version clipping
LeonHafner 3c5908b
add staging for fimo files
LeonHafner a57d808
change fimo outdir transfer
LeonHafner 18d0cfe
increase memory of report
LeonHafner 45ba08d
streamline fimo output
LeonHafner cb8e10a
dynamite error strategy
LeonHafner 13313a7
add index intersection
LeonHafner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import platform | ||
|
||
def format_yaml_like(data: dict, indent: int = 0) -> str: | ||
|
@@ -14,38 +15,34 @@ def format_yaml_like(data: dict, indent: int = 0) -> str: | |
""" | ||
yaml_str = "" | ||
for key, value in data.items(): | ||
spaces = " " * indent | ||
spaces = " " * indent | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this was not on purpose There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think four spaces are the default for nf-core modules. |
||
if isinstance(value, dict): | ||
yaml_str += f"{spaces}{key}:\\n{format_yaml_like(value, indent + 1)}" | ||
else: | ||
yaml_str += f"{spaces}{key}: {value}\\n" | ||
return yaml_str | ||
|
||
|
||
output_dirs = "${motif_files}".split(',') | ||
output_dirs = [os.path.join('fimo', d) for d in os.listdir('fimo') if os.path.isdir(os.path.join('fimo', d))] | ||
|
||
tsvs = [] | ||
gffs = [] | ||
for output in output_dirs: | ||
with open(f'{output}/fimo.tsv', 'r') as f: | ||
tsv = f.read().split('\\n') | ||
with open(f'{output}/fimo.gff', 'r') as f: | ||
gff = f.read().split('\\n') | ||
output_tsv = "${meta.id}.tsv" | ||
output_gff = "${meta.id}.gff" | ||
|
||
tsvs.extend(tsv) | ||
gffs.extend(gff) | ||
with open(output_tsv, 'w') as tsv_out, open(output_gff, 'w') as gff_out: | ||
tsv_out.write('motif_id\\tmotif_alt_id\\tsequence_name\\tstart\\tstop\\tstrand\\tscore\\tp-value\\tq-value\\tmatched_sequence\\n') | ||
|
||
tsvs = [line for line in tsvs if not line.startswith('#') and not line.startswith('motif_id') and not line == ''] | ||
gffs = [line for line in gffs if not line.startswith('#') and not line == ''] | ||
|
||
tsvs = ['motif_id\\tmotif_alt_id\\tsequence_name\\tstart\\tstop\\tstrand\\tscore\\tp-value\\tq-value\\tmatched_sequence'] + tsvs | ||
|
||
with open('${meta.id}.tsv', 'w') as f: | ||
f.write('\\n'.join(tsvs)) | ||
|
||
with open('${meta.id}.gff', 'w') as f: | ||
f.write('\\n'.join(gffs)) | ||
for output in output_dirs: | ||
with open(f"{output}/fimo.tsv", "r") as f: | ||
for line in f: | ||
line = line.strip() | ||
if line and not line.startswith('#') and not line.startswith('motif_id'): | ||
tsv_out.write(line + "\\n") | ||
|
||
with open(f"{output}/fimo.gff", "r") as f: | ||
for line in f: | ||
line = line.strip() | ||
if line and not line.startswith('#'): | ||
gff_out.write(line + "\\n") | ||
|
||
# Create version file | ||
versions = { | ||
|
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is a copy from here and I would like to keep it identical if possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could open a PR to their repository, however, the tool does not appear to be actively maintained. The last open PR is from 2020 and still unanswered.
The changes improve the tool's robustness when handling small dataset sizes, making it essential for a reliable pipeline and also for the run on our lactation data.