Mercurial > repos > iuc > dada2_primercheck
comparison dada2_primercheck.xml @ 0:40cd037434d9 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dada2 commit 3dd3145db6ed58efc3bf5f71e96515173967fc72
| author | iuc |
|---|---|
| date | Sat, 07 Dec 2024 08:41:16 +0000 |
| parents | |
| children | c7d45735c578 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:40cd037434d9 |
|---|---|
| 1 <tool id="dada2_primerCheck" name="dada2: primer check" version="@DADA2_VERSION@+galaxy@WRAPPER_VERSION@" profile="19.09"> | |
| 2 <description></description> | |
| 3 <macros> | |
| 4 <import>macros.xml</import> | |
| 5 </macros> | |
| 6 <expand macro="bio_tools"/> | |
| 7 <expand macro="requirements"/> | |
| 8 <expand macro="stdio"/> | |
| 9 <expand macro="version_command"/> | |
| 10 <command detect_errors="exit_code"><![CDATA[ | |
| 11 Rscript '$dada2_script' | |
| 12 ]]></command> | |
| 13 <configfiles> | |
| 14 <configfile name="dada2_script"><![CDATA[ | |
| 15 #import re | |
| 16 library(Biostrings, quietly=T) | |
| 17 library(ShortRead, quietly=T) | |
| 18 | |
| 19 FWD <- "$forward_primer" | |
| 20 REV <- "$reverse_primer" | |
| 21 | |
| 22 allOrients <- function(primer) { | |
| 23 # Create all orientations of the input sequence | |
| 24 dna <- DNAString(primer) # The Biostrings works w/ DNAString objects rather than character vectors | |
| 25 orients <- c(Forward = dna, Complement = Biostrings::complement(dna), Reverse = Biostrings::reverse(dna), RevComp = Biostrings::reverseComplement(dna)) | |
| 26 return(sapply(orients, toString)) # Convert back to character vector | |
| 27 } | |
| 28 FWD.orients <- allOrients(FWD) | |
| 29 REV.orients <- allOrients(REV) | |
| 30 | |
| 31 primerHits <- function(primer, fn) { | |
| 32 ## Counts number of reads in which the primer is found | |
| 33 nhits <- vcountPattern(primer, sread(readFastq(fn)), fixed = FALSE) | |
| 34 return(sum(nhits > 0)) | |
| 35 } | |
| 36 | |
| 37 df <- NULL; | |
| 38 #for $i, $read in enumerate($paired_cond.reads): | |
| 39 #set elid = re.sub('[^\w\-\.]', '_', str($read.element_identifier)) | |
| 40 #if $paired_cond.paired_select == "single" | |
| 41 #set fwd_reads = $read | |
| 42 #elif $paired_cond.paired_select == "separate" | |
| 43 #set fwd_reads = $read | |
| 44 #set rev_reads = $paired_cond.sdaer[i] | |
| 45 #else | |
| 46 #set fwd_reads = $read.forward | |
| 47 #set rev_reads = $read.reverse | |
| 48 #end if | |
| 49 df <- rbind(df, c('$elid', 'FWD', 'FWD', sapply(FWD.orients, primerHits, fn = '$fwd_reads'))) | |
| 50 df <- rbind(df, c('$elid', 'REV', 'FWD', sapply(REV.orients, primerHits, fn = '$fwd_reads'))) | |
| 51 #if $paired_cond.paired_select != "single" | |
| 52 #if $paired_cond.paired_select == "separate" | |
| 53 #set elid = re.sub('[^\w\-\.]', '_', str($paired_cond.sdaer[i].element_identifier)) | |
| 54 #end if | |
| 55 df <- rbind(df, c('$elid', 'FWD', 'REV', sapply(FWD.orients, primerHits, fn = '$rev_reads'))) | |
| 56 df <- rbind(df, c('$elid', 'REV', 'REV', sapply(REV.orients, primerHits, fn = '$rev_reads'))) | |
| 57 #end if | |
| 58 #end for | |
| 59 colnames(df) <- c('Sample', 'Primer', 'ReadDir', 'Sequence', 'Complement', 'Reverse', 'RevComp') | |
| 60 write.table(df, "$out", quote=F, sep="\t", row.names = F, col.names = T) | |
| 61 ]]></configfile> | |
| 62 </configfiles> | |
| 63 <inputs> | |
| 64 <expand macro="fastq_input" multiple="True" collection_type="list:paired" argument_fwd="fl" argument_rev="fl"/> | |
| 65 <param name="forward_primer" type="text" label="Forward primer sequence"> | |
| 66 <validator type="empty_field" message="You need to specify a forward primer sequence"/> | |
| 67 </param> | |
| 68 <param name="reverse_primer" type="text" label="Reverse primer sequence"> | |
| 69 <validator type="empty_field" message="You need to specify a reverse primer sequence"/> | |
| 70 </param> | |
| 71 </inputs> | |
| 72 <outputs> | |
| 73 <data name="out" format="tabular"/> | |
| 74 </outputs> | |
| 75 <tests> | |
| 76 <!-- paired data in paired collection --> | |
| 77 <test expect_num_outputs="1"> | |
| 78 <conditional name="paired_cond"> | |
| 79 <param name="paired_select" value="paired"/> | |
| 80 <param name="reads"> | |
| 81 <collection type="list:paired"> | |
| 82 <element name="F3D0_S188_L001"> | |
| 83 <collection type="paired"> | |
| 84 <element name="forward" value="F3D0_S188_L001_R1_001.fastq.gz" ftype="fastqsanger.gz"/> | |
| 85 <element name="reverse" value="F3D0_S188_L001_R2_001.fastq.gz" ftype="fastqsanger.gz"/> | |
| 86 </collection> | |
| 87 </element> | |
| 88 <element name="F3D141_S207_L001"> | |
| 89 <collection type="paired"> | |
| 90 <element name="forward" value="F3D141_S207_L001_R1_001.fastq.gz" ftype="fastqsanger.gz"/> | |
| 91 <element name="reverse" value="F3D141_S207_L001_R2_001.fastq.gz" ftype="fastqsanger.gz"/> | |
| 92 </collection> | |
| 93 </element> | |
| 94 </collection> | |
| 95 </param> | |
| 96 </conditional> | |
| 97 | |
| 98 <param name="forward_primer" value="ACCTGCGGARGGATCA"/> | |
| 99 <param name="reverse_primer" value="GAGATCCRTTGYTRAAAGTT"/> | |
| 100 <output name="out"> | |
| 101 <assert_contents> | |
| 102 <has_n_lines n="9"/> | |
| 103 <has_n_columns n="7"/> | |
| 104 </assert_contents> | |
| 105 </output> | |
| 106 </test> | |
| 107 <!-- paired data in separate collection --> | |
| 108 <test expect_num_outputs="1"> | |
| 109 <conditional name="paired_cond"> | |
| 110 <param name="paired_select" value="separate"/> | |
| 111 <param name="reads" value="F3D0_S188_L001_R1_001.fastq.gz,F3D141_S207_L001_R1_001.fastq.gz" ftype="fastqsanger.gz"/> | |
| 112 <param name="sdaer" value="F3D0_S188_L001_R2_001.fastq.gz,F3D141_S207_L001_R2_001.fastq.gz" ftype="fastqsanger.gz"/> | |
| 113 </conditional> | |
| 114 | |
| 115 <param name="forward_primer" value="ACCTGCGGARGGATCA"/> | |
| 116 <param name="reverse_primer" value="GAGATCCRTTGYTRAAAGTT"/> | |
| 117 <output name="out"> | |
| 118 <assert_contents> | |
| 119 <has_n_lines n="9"/> | |
| 120 <has_n_columns n="7"/> | |
| 121 </assert_contents> | |
| 122 </output> | |
| 123 </test> | |
| 124 <!-- single end data --> | |
| 125 <test expect_num_outputs="1"> | |
| 126 <conditional name="paired_cond"> | |
| 127 <param name="paired_select" value="single"/> | |
| 128 <param name="reads" value="F3D0_S188_L001_R1_001.fastq.gz" ftype="fastqsanger.gz"/> | |
| 129 </conditional> | |
| 130 <param name="forward_primer" value="ACCTGCGGARGGATCA"/> | |
| 131 <param name="reverse_primer" value="GAGATCCRTTGYTRAAAGTT"/> | |
| 132 <output name="out"> | |
| 133 <assert_contents> | |
| 134 <has_n_lines n="3"/> | |
| 135 <has_n_columns n="7"/> | |
| 136 </assert_contents> | |
| 137 </output> | |
| 138 </test> | |
| 139 </tests> | |
| 140 | |
| 141 <help><![CDATA[ | |
| 142 Description | |
| 143 ........... | |
| 144 | |
| 145 Simple check for primer sequences in sequencing data. The tool counts the number | |
| 146 of occurrences of the primer sequence, its complement, the reverse and the | |
| 147 reverse complement. | |
| 148 | |
| 149 See also: https://benjjneb.github.io/dada2/ITS_workflow.html#identify-primers | |
| 150 | |
| 151 Usage | |
| 152 ..... | |
| 153 | |
| 154 **Input** FASTQ datasets and forward and reverse primers | |
| 155 | |
| 156 **Output** a table listing the counts of the different occurrences in the read files. | |
| 157 | |
| 158 | |
| 159 @HELP_OVERVIEW@ | |
| 160 ]]></help> | |
| 161 <expand macro="citations"/> | |
| 162 </tool> |
