-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from sanger-tol/dp24_gc_content
Dp24 gc content
- Loading branch information
Showing
34 changed files
with
661 additions
and
92 deletions.
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
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,33 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
Script for finding the GC content of each sequence in a multiFASTA file | ||
Written by Eerik Aunin @eeaunin | ||
Adapted by Damon-Lee Pointon @DLBPointon | ||
""" | ||
|
||
import argparse | ||
import general_purpose_functions as gpf | ||
|
||
|
||
def main(fasta_path): | ||
fasta_data = gpf.read_fasta_in_chunks(fasta_path) | ||
for header, seq in fasta_data: | ||
header = header.split()[0] | ||
seq = seq.upper() | ||
gc_content = None | ||
gc_count = seq.count("G") + seq.count("C") | ||
seq_len = len(seq) | ||
if seq_len > 0: | ||
gc_content = gc_count / seq_len | ||
gc_content_string = "{:.6f}".format(gc_content) | ||
print("{}\t{}".format(header, gc_content_string)) | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(description=__doc__) | ||
parser.add_argument("fasta_path", type=str, help="Path to input FASTA file") | ||
parser.add_argument("-v", action="version", version="1.0") | ||
args = parser.parse_args() | ||
main(args.fasta_path) |
Empty file.
Empty file.
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
Empty file.
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
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,39 @@ | ||
process GC_CONTENT { | ||
tag "${meta.id}" | ||
label 'process_low' | ||
|
||
conda "conda-forge::python=3.9" | ||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/python:3.9' : | ||
'biocontainers/python:3.9' }" | ||
|
||
input: | ||
tuple val(meta), path(fasta) | ||
|
||
output: | ||
tuple val(meta), path( "*-gc.txt" ) , emit: txt | ||
path "versions.yml" , emit: versions | ||
|
||
script: | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
""" | ||
gc_content.py ${fasta} > ${prefix}-gc.txt | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
python: \$(python --version | sed 's/Python //g') | ||
gc_content: \$(gc_content.py -v) | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
""" | ||
touch full_coords.tsv | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
python: \$(python --version | sed 's/Python //g') | ||
gc_content: \$(gc_content.py -v) | ||
END_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
process GET_LARGEST_SCAFF { | ||
|
||
tag "$meta.id" | ||
label 'process_low' | ||
|
||
conda "conda-forge::coreutils=9.1" | ||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/ubuntu:20.04' : | ||
'docker.io/ubuntu:20.04' }" | ||
|
||
input: | ||
tuple val( meta ), path( file ) | ||
|
||
output: | ||
env largest_scaff , emit: scaff_size | ||
path "versions.yml" , emit: versions | ||
|
||
shell: | ||
def VERSION = "9.1" // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. | ||
$/ | ||
largest_scaff=`head -n 1 "${file}" | cut -d$'\t' -f2` | ||
|
||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
coreutils: $VERSION | ||
END_VERSIONS | ||
/$ | ||
|
||
stub: | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
def VERSION = "9.1" // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. | ||
""" | ||
largest_scaff=1000000 | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
coreutils: $VERSION | ||
END_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
Oops, something went wrong.