Skip to content

Commit

Permalink
fasta_ltrretriever_lai now supports stub
Browse files Browse the repository at this point in the history
  • Loading branch information
GallVp committed Jun 4, 2024
1 parent b101564 commit 8a6885c
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 27 deletions.
4 changes: 2 additions & 2 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"custom/shortenfastaids": {
"branch": "main",
"git_sha": "e226301053a2b0f9a6af514b454b3ae7c91daa80",
"git_sha": "e9ec2e4c48ead3d760c8e13950c568c19ae86b8b",
"installed_by": ["fasta_ltrretriever_lai"]
},
"gffread": {
Expand Down Expand Up @@ -121,7 +121,7 @@
},
"fasta_ltrretriever_lai": {
"branch": "main",
"git_sha": "734297c99ae8b13ed73e3ff9a8f1215e1ca05ecd",
"git_sha": "e9ec2e4c48ead3d760c8e13950c568c19ae86b8b",
"installed_by": ["subworkflows"]
},
"fastq_bwa_mem_samblaster": {
Expand Down
5 changes: 4 additions & 1 deletion modules/pfr/custom/shortenfastaids/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ process CUSTOM_SHORTENFASTAIDS {
stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch "${meta.id}.short.ids.tsv"
echo \\
'IDs have acceptable length and character. No change required.' \\
> ${meta.id}.short.ids.tsv
cat <<-END_VERSIONS > versions.yml
"${task.process}":
python: \$(python --version | cut -d' ' -f2)
Expand Down
8 changes: 4 additions & 4 deletions modules/pfr/custom/shortenfastaids/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
{
"id": "test"
},
"test.short.ids.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
"test.short.ids.tsv:md5,fcf920d9a7b57a1e3c29a9e88673330f"
]
],
"2": [
Expand All @@ -73,7 +73,7 @@
{
"id": "test"
},
"test.short.ids.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
"test.short.ids.tsv:md5,fcf920d9a7b57a1e3c29a9e88673330f"
]
],
"versions": [
Expand All @@ -83,9 +83,9 @@
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.1"
"nextflow": "24.04.2"
},
"timestamp": "2024-06-02T20:54:36.815875"
"timestamp": "2024-06-04T13:58:30.161542"
},
"homo_sapiens-genome_fasta-no_change": {
"content": [
Expand Down
10 changes: 5 additions & 5 deletions subworkflows/pfr/fasta_ltrretriever_lai/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -174,23 +174,23 @@ workflow FASTA_LTRRETRIEVER_LAI {

def map_monoploid_seqs_to_new_ids(id, short_ids_tsv, monoploid_seqs) {

def short_ids_head = short_ids_tsv.text.split('\n')[0]
def short_ids_head = short_ids_tsv.text.tokenize('\n')[0]

if (short_ids_head == "IDs have acceptable length and character. No change required.") {
return [ "${id}.mapped.monoploid.seqs.txt" ] + monoploid_seqs.text.split('\n')
return [ "${id}.mapped.monoploid.seqs.txt" ] + monoploid_seqs.text.tokenize('\n')
}

def orig_to_new_ids = [:]
short_ids_tsv.text.eachLine { line ->
def (original_id, renamed_id) = line.split('\t')
def (original_id, renamed_id) = line.tokenize('\t')
orig_to_new_ids[original_id] = renamed_id
}

def mapped_ids = []
monoploid_seqs.text.eachLine { original_id ->
if (!orig_to_new_ids[original_id]) {
error "Faild to find $original_id in ${monoploid_seqs}" +
"The monoploid_seqs file is malformed!"
error "Faild to find $original_id in ${short_ids_tsv}" +
"\nThe short_ids_tsv file is malformed!"
}

mapped_ids.add(orig_to_new_ids[original_id])
Expand Down
4 changes: 2 additions & 2 deletions subworkflows/pfr/fasta_ltrretriever_lai/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ nextflow_workflow {
workflow {
"""
def monoploid_seqs = new File('test.mono.seq.txt')
monoploid_seqs.write("chr_xxxxxxxxxxxxxxx_1")
monoploid_seqs.write("chr1")
input[0] = Channel.empty()
input[0] = GUNZIP.out.gunzip
input[1] = Channel.of( [ [ id:'test' ], monoploid_seqs.toPath() ] )
input[2] = false
"""
Expand Down
76 changes: 63 additions & 13 deletions subworkflows/pfr/fasta_ltrretriever_lai/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -56,41 +56,91 @@
"content": [
{
"0": [

[
{
"id": "test"
},
"test.LTRlib.fa:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [

[
{
"id": "test"
},
"test.out.gff3:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"2": [

[
{
"id": "test"
},
"test.LAI.log:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"3": [

[
{
"id": "test"
},
"test.LAI.out:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"4": [

"versions.yml:md5,05a74dacbcd6c5906faeca3206f6563f",
"versions.yml:md5,52a98b45c3cf73f9314dbe9b34eca9d8",
"versions.yml:md5,5d86cda262f5c21e43738433a2781ebc",
"versions.yml:md5,608d746d45680f025562c4be455db461",
"versions.yml:md5,8468404805dddec679524e75b4fa51e8",
"versions.yml:md5,fb42c6cc5c28b6f9d3384171c7b6b143"
],
"annotation_gff": [

[
{
"id": "test"
},
"test.out.gff3:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"lai_log": [

[
{
"id": "test"
},
"test.LAI.log:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"lai_out": [

[
{
"id": "test"
},
"test.LAI.out:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"ltrlib": [

[
{
"id": "test"
},
"test.LTRlib.fa:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [

"versions.yml:md5,05a74dacbcd6c5906faeca3206f6563f",
"versions.yml:md5,52a98b45c3cf73f9314dbe9b34eca9d8",
"versions.yml:md5,5d86cda262f5c21e43738433a2781ebc",
"versions.yml:md5,608d746d45680f025562c4be455db461",
"versions.yml:md5,8468404805dddec679524e75b4fa51e8",
"versions.yml:md5,fb42c6cc5c28b6f9d3384171c7b6b143"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.1"
"nextflow": "24.04.2"
},
"timestamp": "2024-06-02T20:35:25.114358"
"timestamp": "2024-06-04T13:50:48.75158"
}
}
}

0 comments on commit 8a6885c

Please sign in to comment.