Repository 'clifinder'
hg clone https://toolshed.g2.bx.psu.edu/repos/clifinder/clifinder

Changeset 20:f25d12179c6c (2020-03-12)
Previous changeset 19:5c16e8ddff78 (2020-03-04) Next changeset 21:7bef1cd4d2ad (2022-10-10)
Commit message:
"planemo upload for repository https://github.com/GReD-Clermont/CLIFinder/ commit d5ec4f62fa3d1d52508e07e1221a0c22f0d615bf"
modified:
CLIFinder.xml
README.rst
script/CLIFinder.pl
test-data/res_files/results.txt
b
diff -r 5c16e8ddff78 -r f25d12179c6c CLIFinder.xml
--- a/CLIFinder.xml Wed Mar 04 05:40:37 2020 -0500
+++ b/CLIFinder.xml Thu Mar 12 18:01:10 2020 -0400
[
b'@@ -1,4 +1,4 @@\n-<tool name="CLIFinder" id="CLIFinder" version="0.5.0" profile="16.01">\n+<tool name="CLIFinder" id="CLIFinder" version="0.5.1" profile="16.01">\n     <description>Find chimerics transcripts containing LINEs sequences</description>\n     <macros>\n         <xml name="source_bwa" token_arg="Argument" token_build="Build argument" token_ref="">\n@@ -45,6 +45,7 @@\n         </xml>\n     </macros>\n     <requirements>\n+        <requirement type="package" version="1.3">seqtk</requirement>\n         <requirement type="package" version="1.9">samtools</requirement>\n         <requirement type="package" version="2.26.0gx">bedtools</requirement>\n         <requirement type="package" version="4.0.9_p2">repeatmasker</requirement>\n@@ -64,18 +65,26 @@\n     <command detect_errors="aggressive"><![CDATA[\n perl \'$__tool_directory__/script/CLIFinder.pl\'\n \n-    #if str($inputs.custom) == \'true\'\n+    #if str($inputs.type) == \'paired_collection\'\n         #for $x in $inputs.fastq\n-            --first \'$x.first\'\n+            --first \'$x.forward\'\n             --name \'$x.name\'\n-            --second \'$x.second\'\n+            --second \'$x.reverse\'\n         #end for\n     #else\n-        #for $x in $inputs.fastq\n-            --first \'$x.first\'\n-            --name \'$x.first.name\'\n-            --second \'$x.second\'\n-        #end for\n+        #if str($inputs.datasets.custom_name) == \'true\'\n+            #for $x in $inputs.datasets.fastq\n+                --first \'$x.first\'\n+                --name \'$x.name\'\n+                --second \'$x.second\'\n+            #end for\n+        #else\n+            #for $x in $inputs.datasets.fastq\n+                --first \'$x.first\'\n+                --name \'$x.first.name\'\n+                --second \'$x.second\'\n+            #end for\n+        #end if\n     #end if\n \n     #if $genome.source.source == "history"\n@@ -114,6 +123,10 @@\n         #end if\n     #end if\n \n+    #if str($species) != \'\'\n+        --species \'$species\'\n+    #end if\n+\n     --rmsk \'$rmsk\'\n     --refseq \'$refseq\'\n     --html \'$chimerae\'\n@@ -129,22 +142,33 @@\n     </command>\n     <inputs>\n         <conditional name="inputs">\n-            <param name="custom" type="select" label="Use custom name for the input sequence files?">\n-                <option value="true">Yes</option>\n-                <option value="false" selected="true">No: the names will be extracted automatically</option>\n+            <param name="type" type="select" label="Input Type">\n+                <option value="datasets" selected="true">Distinct datasets</option>\n+                <option value="paired_collection">Paired collection</option>\n             </param>\n-            <when value="true">\n-                <repeat name="fastq" title="Input sequences" min="1">\n-                    <param argument="--first" type="data" format="fastqsanger" label="First set of paired-end reads"/>\n-                    <param argument="--name" type="text" value="" label="Label for the input sequences"/>\n-                    <param argument="--second" type="data" format="fastqsanger" label="Second set of paired-end reads"/>\n-                </repeat>\n+            <when value="datasets">\n+                <conditional name="datasets">\n+                    <param name="custom_name" type="select" label="Use custom name for the input sequence files?">\n+                        <option value="true">Yes</option>\n+                        <option value="false" selected="true">No: the names will be extracted automatically</option>\n+                    </param>\n+                    <when value="true">\n+                        <repeat name="fastq" title="Input sequences" min="1">\n+                            <param argument="--first" type="data" format="fastqsanger" label="First set of paired-end reads"/>\n+                            <param argument="--name" type="text" value="" label="Label for the input sequences"/>\n+                            <param argument="--second" type="data" format="fastqsanger" label="Second set of paired-e'..b'stq of paired-end set 1] --name [name 1] --second [second fastq of paired-end set 1] [--first [first fastq of paired-end set 2] --name [name 2] --second [second fastq of paired-end set 2] ...] --ref [reference genome] [--build_ref] --TE [transposable elements] [--build_TE] --html [results.html] --html-path [results directory][options]\n+  `CLIFinder.pl --first <first fastq of paired-end set 1> --name <name 1> --second <second fastq of paired-end set 1> [--first <first fastq of paired-end set 2> --name <name 2> --second <second fastq of paired-end set 2> ...] --ref <reference genome> [--build_ref] --TE <transposable elements> [--build_TE] --html <results.html> --html-path <results directory> [options]`\n \n **Arguments:**\n-  --first [fastq]     First fastq file to process from paired-end set\n-\n-  --name [name]       Name of the content to process\n-\n-  --second [fastq]    Second fastq file to process from paired-end set\n-\n-  --ref [reference]   Fasta file containing the reference genome\n-\n-  --TE [TE]           Fasta file containing the transposable elements\n-\n-  --rmsk [txt file]   Tab-delimited text file (with headers) containing reference repeat sequences (e.g. rmsk track from UCSC)\n-\n-  --refseq [txt file] Tab-delimited file (with headers) containing reference genes (e.g. RefGene.txt from UCSC)\n-\n-  --html [file]       Main HTML file where results will be displayed\n-\n-  --html-path [path]  Folder where results will be stored\n+  --first      First fastq file to process from paired-end set\n+  --name       Name of the content to process\n+  --second     Second fastq file to process from paired-end set\n+  --ref        Fasta file containing the reference genome\n+  --TE         Fasta file containing the transposable elements\n+  --rmsk       Tab-delimited text file (with headers) containing reference repeat sequences (e.g. rmsk track from UCSC)\n+  --refseq     Tab-delimited file (with headers) containing reference genes (e.g. RefGene.txt from UCSC)\n+  --html       Main HTML file where results will be displayed\n+  --html-path  Folder where results will be stored\n \n For any fasta file, if a bwa index is not provided, you should build it through the corresponding *--build_[element]* argument\n \n **Options:**\n-    --rnadb [RNA db]    Blast database with RNA sequences (optional)\n-  \n-    --estdb [EST db]    Blast database with RNA sequences (optional)\n-\n-    --size_read [INT]   Size of reads\n-\n-    --BDir [0|1|2]      Orientation of reads (0: undirectional libraries, 1: TEs sequences in first read in pair, 2: TEs sequences in second read in pair)\n-\n-    --size_insert [INT] Maximum size of insert tolerated between R1 and R2 for alignment on the reference genome\n-\n-    --min_L1 [INT]       Minimum number of bp matching for L1 mapping\n-\n-    --mis_L1 [INT]      Maximum number of mismatches tolerated for L1 mapping\n-\n-    --min_unique [INT]  Number of consecutive bp not annotated by RepeatMasker\n-\n-    --threads [INT]     Number of threads (default: 1)\n+  --rnadb        Blast database with RNA sequences (optional)\n+  --estdb        Blast database with RNA sequences (optional)\n+  --size_read    Size of reads (default: 100)\n+  --BDir         Orientation of reads (0: undirectional libraries, 1: TEs sequences in first read in pair, 2: TEs sequences in second read in pair)\n+  --size_insert  Maximum size of insert tolerated between R1 and R2 for alignment on the reference genome (default: 250)\n+  --min_L1       Minimum number of bp matching for L1 mapping (default: 50)\n+  --mis_L1       Maximum number of mismatches tolerated for L1 mapping (default: 1)\n+  --min_unique   Number of consecutive bp not annotated by RepeatMasker (default: 33)\n+  --species      Species to use in RepeatMasker (default: human)\n+  --threads      Number of threads (default: 1)\n \n For Blast database files, if a fasta is provided, the database can be built with \'--build_[db]\'. Otherwise, provide a path or URL. "tar(.gz)" files are acceptable, as well as wild card (rna*) URLs.\n \n'
b
diff -r 5c16e8ddff78 -r f25d12179c6c README.rst
--- a/README.rst Wed Mar 04 05:40:37 2020 -0500
+++ b/README.rst Thu Mar 12 18:01:10 2020 -0400
[
@@ -1,7 +1,7 @@
 .. image:: https://travis-ci.org/GReD-Clermont/CLIFinder.svg?branch=master
     :target: https://travis-ci.org/GReD-Clermont/CLIFinder
 
-CLIFinder v0.5.0
+CLIFinder v0.5.1
 ================
 
 
@@ -9,8 +9,8 @@
 -----------
 
 L1 Chimeric Transcripts (LCTs)  are transcribed from LINE 1 antisense promoter and include the L1 5’UTR sequence in antisense orientation followed by the adjacent genomic region.  
-CLIFinder v0.4.1 is a Galaxy tool, specifically designed to identify  potential LCTs from one or several oriented RNA-seq paired-end reads in the human genome.  
-CLIFinder v0.4.1 is customizable to detect transcripts initiated by different types of repeat elements.
+CLIFinder v0.5.1 is a Galaxy tool, specifically designed to identify  potential LCTs from one or several oriented RNA-seq paired-end reads in the human genome.
+CLIFinder v0.5.1 is customizable to detect transcripts initiated by different types of repeat elements.
 
 
 
@@ -61,8 +61,9 @@
         --BDir <0|1|2>          Orientation of reads (0: undirectional libraries, 1: TEs sequences in first read in pair, 2: TEs sequences in second read in pair) (default: 0)
         --size_insert <INT>     Maximum size of insert tolerated between R1 and R2 for alignment on the reference genome (default: 250)
         --min_L1 <INT>          Minimum number of bp matching for L1 mapping (default: 50)
-        --mis_L1 <INT>          Maximum number of mismatches tolerated for L1 mapping (default: 2)
+        --mis_L1 <INT>          Maximum number of mismatches tolerated for L1 mapping (default: 1)
         --min_unique <INT>      Minimum number of consecutive bp not annotated by RepeatMasker (default: 33)
+        --species <STRING>      Species to use in RepeatMasker (default: human)
         --threads <INT>         Number of threads (default: 1)
 
     For Blast database files, if a fasta is provided, the database can be built with '--build_[db]'. Otherwise, provide a path or URL. "tar(.gz)" files are acceptable, as well as wild card (rna*) URLs.
b
diff -r 5c16e8ddff78 -r f25d12179c6c script/CLIFinder.pl
--- a/script/CLIFinder.pl Wed Mar 04 05:40:37 2020 -0500
+++ b/script/CLIFinder.pl Thu Mar 12 18:01:10 2020 -0400
[
b'@@ -15,7 +15,7 @@\n use FindBin qw($Bin);\n use Archive::Tar;\n \n-our $VERSION = \'0.5.0\';\n+our $VERSION = \'0.5.1\';\n \n \n #####################################################################\n@@ -38,12 +38,13 @@\n   "build_estdb"   => \\my $build_estdb,\n   "rmsk=s"        => \\my $rmsk_source,\n   "refseq=s"      => \\my $refseq,\n+  "species=s"     => \\(my $species = "human"),\n   "min_unique:i"  => \\(my $prct = 33),\n   "size_insert:i" => \\(my $maxInsertSize = 250),\n   "size_read:i"   => \\(my $size_reads = 100),\n   "BDir:i"        => \\(my $Bdir = 0),\n   "min_L1:i"      => \\(my $min_L1 = 50),\n-  "mis_L1:i"      => \\(my $mis_L1 = 2),\n+  "mis_L1:i"      => \\(my $mis_L1 = 1),\n   "threads:i"     => \\(my $threads = 1),\n   "help"          => sub { HelpMessage(0); },\n   "version"       => sub { VersionMessage(0); },\n@@ -57,11 +58,18 @@\n my $dprct = ((100-$iprct) * $size_reads) / 100;\n \n ################################################\n+#Clean up names and species                    #\n+################################################\n+\n+foreach(@name) { $_ =~ s/[^A-Za-z0-9_\\-\\.]/_/g; }\n+$species =~ s/[;&|]//g;\n+\n+################################################\n #Construct index of ref and TE if doesn\'t exist#\n ################################################\n \n-`(bwa index $ref)` if ($build_ref);\n-`(bwa index $TE)` if ($build_TE);\n+`(bwa index \'$ref\')` if ($build_ref);\n+`(bwa index \'$TE\')` if ($build_TE);\n \n ############################################\n #Create repository to store resulting files#\n@@ -95,41 +103,51 @@\n   # Paired end mapping against L1 promoter sequences#\n   ###################################################\n   \n+  ## Align reads on L1 but only keep half-mapped pairs\n   print STDOUT "Alignment of $name[$tabR] to L1\\n";\n-  my $sam = $html_repertory.\'/\'.$name[$tabR]."_L1.sam"; push(@garbage, $sam);\n+  my $sam = $html_repertory.\'/\'.$name[$tabR].\'_L1.sam\'; push(@garbage, $sam);\n   halfmap_paired($TE, $fastq1[$tabR], $fastq2[$tabR], $sam, $threads, $mis_auth);\n   print STDOUT "Alignment done\\n";\n   \n+  ## Filter alignments based on mis_L1 and min_L1\n+  print STDOUT "Filtering alignments based on mis_L1 and min_L1\\n";\n+  my $filtered_sam = $html_repertory.\'/\'.$name[$tabR].\'_L1_filtered.sam\'; push(@garbage, $filtered_sam);\n+  filter_halfmapped($sam, $filtered_sam, $mis_L1, $min_L1);\n+\n   ##################################################\n   # Creation of two fastq for paired halfed mapped:#\n   # - _1 correspond to sequences mapped to L1      #\n   # - _2 correspond to sequences unmapped to L1    #\n   ##################################################\n-  \n-  print STDOUT "Getting pairs with one mate matched to L1 and the other mate undetected by repeatmasker as a repeat sequence\\n";\n-  my $out_ASP_1 = $html_repertory.\'/\'.$name[$tabR]."_1.fastq"; push(@garbage, $out_ASP_1);\n-  my $out_ASP_2 = $html_repertory.\'/\'.$name[$tabR]."_2.fastq"; push(@garbage, $out_ASP_2);\n-  \n-  ##split mate that matched to L1 and others##\n-  my ($ASP_readsHashR, $half_num_out) = get_half($sam, $mis_L1, $min_L1, $Bdir);\n+\n+  # Half-mapped reads\n+  my $hm_reads_1 = $html_repertory.\'/\'.$name[$tabR].\'_halfmapped_1.fastq\'; push(@garbage, $hm_reads_1);\n+  my $hm_reads_2 = $html_repertory.\'/\'.$name[$tabR].\'_halfmapped_2.fastq\'; push(@garbage, $hm_reads_2);\n+\n+  ## Split mate that matched to L1 and others##\n+  my $half_num_out = get_halfmapped_reads($filtered_sam, $Bdir, $hm_reads_1, $hm_reads_2);\n   print STDOUT "Number of half mapped pairs: $half_num_out\\n";\n   \n-  ##pairs obtained after repeatmasker on the other mate##\n-  my $left = sort_out($threads, $out_ASP_1, $out_ASP_2, $dprct, $eprct, $ASP_readsHashR, $html_repertory);\n+  ## Get pairs after repeatmasker on the other mate\n+  print STDOUT "Getting pairs with one mate matched to L1 and the other mate undetected by repeatmasker as a repeat sequence\\n";\n+  # Filtered reads after repeatmasker\n+  my $out_ASP_1 = $html_repertory.\'/\'.$name[$tabR].\'_1.fastq\'; push(@garbage, $out_ASP_1);\n+  my $out_ASP_2 = $html_reperto'..b'    print $tab "\\t\\t\\t<td>$Hrna</td>\\n\\t\\t\\t<td>$Hest</td>\\n\\t\\t\\t<td><div class=\\"arrow\\"></div></td>\\n\\t\\t</tr>\\n";\n+    my $colspan = scalar(@fastq1) * 2 + 8;\n     print $tab "\\t\\t<tr>\\n\\t\\t\\t<td valign=top colspan=$colspan></td>\\n\\t\\t\\t<td valign=top>\\n";\n     if (exists(${$rna}{$i}))\n     {\n       for (my $w = 1; $w <= $#{${$rna}{$i}}; $w++)\n       {\n-        $Hrna = \'\';\n-        $Hrna = ${$rna}{$i}[$w];\n-        chomp $Hrna;\n-        print $tab "\\t\\t\\t\\t<a target=\\"_blank\\" rel=\\"noopener noreferrer\\" href=\\"https://www.ncbi.nlm.nih.gov/nuccore/$Hrna\\">$Hrna</a><br>\\n";\n+        $Hrna = "<a target=\\"_blank\\" rel=\\"noopener noreferrer\\" href=\\"https://www.ncbi.nlm.nih.gov/nuccore/${$rna}{$i}[$w]\\">${$rna}{$i}[$w]</a>";\n+        print $tab "\\t\\t\\t\\t$Hrna<br>\\n";\n       }\n       delete ${$rna}{$i};\n     }\n@@ -966,10 +934,8 @@\n     {\n       for (my $w = 1; $w <= $#{${$est}{$i}}; $w++)\n       {\n-        $Hest = \'\';\n-        $Hest = ${$est}{$i}[$w];\n-        chomp $Hest;\n-        print $tab "\\t\\t\\t\\t<a target=\\"_blank\\" rel=\\"noopener noreferrer\\" href=\\"https://www.ncbi.nlm.nih.gov/nuccore/$Hest\\">$Hest</a><br>\\n";\n+        $Hest = "<a target=\\"_blank\\" rel=\\"noopener noreferrer\\" href=\\"https://www.ncbi.nlm.nih.gov/nuccore/${$est}{$i}[$w]\\">${$est}{$i}[$w]</a>";\n+        print $tab "\\t\\t\\t\\t$Hest<br>\\n";\n       }\n       delete ${$est}{$i};\n     }\n@@ -978,7 +944,8 @@\n   print $tab "\\t</table>\\n</body>\\n</html>\\n";\n   close $tab;\n }\n-  \n+\n+\n ############################################################\n ##Function save_csv: save results in different formats   ###\n ############################################################\n@@ -990,6 +957,7 @@\n ##       $refseq: refseq text file                         #\n ##       $out: repository to store results                 #\n ############################################################\n+\n sub save_csv{\n   my ($fastq1_ref, $name_ref, $results_ref, $line_only, $refseq, $out) = @_;\n   my @fastq1 = @{$fastq1_ref};\n@@ -1002,16 +970,16 @@\n   # save result in csv file ##\n   \n   my $filed = $out1;\n-  open(my $tab, ">".$filed) || die "Cannot open $filed";\n-  print $tab "L1 chromosome \\t L1 start \\t L1 end \\t L1 strand";;\n+  open(my $tab, \'>\', $filed) || die "Cannot open $filed";\n+  print $tab "L1 chromosome\\tL1 start\\tL1 end\\tL1 strand";;\n   for my $i (0..$#fastq1)\n   {\n-    print $tab "\\t $name[$i] read #";\n+    print $tab "\\t$name[$i] read #";\n   }\n-  print $tab "\\t Chimera chromosome\\t Chimera start \\t Chimera end \\t Chimera strand";\n+  print $tab "\\tChimera chromosome\\tChimera start\\tChimera end\\tChimera strand";\n   for my $i (0..$#fastq1)\n   {\n-    print $tab "\\t $name[$i] read #";\n+    print $tab "\\t$name[$i] read #";\n   }\n   print $tab "\\n";\n   for my $i ( 0 .. $#results )\n@@ -1042,6 +1010,7 @@\n   print STDOUT "$R_out\\n";\n }\n \n+\n __END__\n \n =head1 NAME\n@@ -1072,8 +1041,9 @@\n                 --BDir <0|1|2>          Orientation of reads (0: undirectional libraries, 1: TEs sequences in first read in pair, 2: TEs sequences in second read in pair) (default: 0)\n                 --size_insert <INT>     Maximum size of insert tolerated between R1 and R2 for alignment on the reference genome (default: 250)\n                 --min_L1 <INT>          Minimum number of bp matching for L1 mapping (default: 50)\n-                --mis_L1 <INT>          Maximum number of mismatches tolerated for L1 mapping (default: 2)\n+                --mis_L1 <INT>          Maximum number of mismatches tolerated for L1 mapping (default: 1)\n                 --min_unique <INT>      Minimum number of consecutive bp not annotated by RepeatMasker (default: 33)\n+                --species <STRING>      Species to use in RepeatMasker (default: human)\n                 --threads <INT>         Number of threads (default: 1)\n \n         For Blast database files, if a fasta is provided, the database can be built with \'--build_[db]\'. Otherwise, provide a path or URL. \\"tar(.gz)\\" files are acceptable, as well as wild card (rna*) URLs.\n'
b
diff -r 5c16e8ddff78 -r f25d12179c6c test-data/res_files/results.txt
--- a/test-data/res_files/results.txt Wed Mar 04 05:40:37 2020 -0500
+++ b/test-data/res_files/results.txt Thu Mar 12 18:01:10 2020 -0400
b
@@ -1,3 +1,3 @@
-L1 chromosome   L1 start   L1 end   L1 strand  test read #  Chimera chromosome  Chimera start   Chimera end   Chimera strand  test read #
+L1 chromosome L1 start L1 end L1 strand test read # Chimera chromosome Chimera start Chimera end Chimera strand test read #
 chr17:13850000-13860000 5524 5625 - 1 chr17:13850000-13860000 5361 5462 + 1
 chr18:62900000-62910000 6369 6470 - 1 chr18:62900000-62910000 6229 6330 + 1