Mercurial > repos > iuc > duplex_family_size_distribution
changeset 2:6cc65a11d922 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/fsd commit db742c73b55c12a5ac5a11e6be3995670547bbb0"
author | iuc |
---|---|
date | Fri, 10 Sep 2021 06:59:00 +0000 |
parents | ec5a92514113 |
children | f85557b9707a |
files | fsd_beforevsafter.py fsd_beforevsafter.xml fsd_regions.py fsd_regions.xml |
diffstat | 4 files changed, 22 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/fsd_beforevsafter.py Wed Dec 04 16:32:40 2019 -0500 +++ b/fsd_beforevsafter.py Fri Sep 10 06:59:00 2021 +0000 @@ -13,6 +13,7 @@ # --output_tabular outputfile_name_tabular --output_pdf outputfile_name_pdf import argparse +import os.path import sys from collections import Counter @@ -164,7 +165,10 @@ # data of tags aligned to reference genome if ref_genome is not None: - pysam.index(ref_genome) + ref_genome_index = f"{ref_genome}.bai" + if not os.path.exists(ref_genome_index): + print(f"Info: Generating BAM index in {ref_genome_index}") + pysam.index(ref_genome) bam = pysam.AlignmentFile(ref_genome, "rb") seq_mut = [] for read in bam.fetch():
--- a/fsd_beforevsafter.xml Wed Dec 04 16:32:40 2019 -0500 +++ b/fsd_beforevsafter.xml Fri Sep 10 06:59:00 2021 +0000 @@ -8,7 +8,11 @@ <requirement type="package" version="1.71">biopython</requirement> <requirement type="package" version="0.15">pysam</requirement> </expand> - <command> + <command><![CDATA[ +#if $bamFile: + ln -s '$bamFile' 'reads.bam' && + ln -s '$bamFile.metadata.bam_index' 'reads.bam.bai' && +#end if python '$__tool_directory__/fsd_beforevsafter.py' --inputFile_SSCS '$file' --inputName1 @ESCAPE_IDENTIFIER@ @@ -17,11 +21,11 @@ --afterTrimming '$afterTrimming' #end if #if $bamFile: ---bamFile '$bamFile' + --bamFile 'reads.bam' #end if --output_pdf '$output_pdf' --output_tabular '$output_tabular' - </command> + ]]></command> <inputs> <param name="file" type="data" format="tabular" label="Input tags of SSCSs" optional="false" help="This dataset is generated by post-processing of the output from 'Make Families' or 'Correct Barcodes' tool by extracting the first two columns, sorting the tags (column 1) and adding the counts of unique occurencies of each tag. See Help section below for a detailed explanation."/> <param name="makeDCS" type="data" format="fasta" label="Input tags after making DCSs" help="Input in fasta format with the tags of the reads, which were aligned to DCSs. This file is produced by the 'Make consensus reads' tool."/>
--- a/fsd_regions.py Wed Dec 04 16:32:40 2019 -0500 +++ b/fsd_regions.py Fri Sep 10 06:59:00 2021 +0000 @@ -17,6 +17,7 @@ import argparse import collections +import os.path import re import sys @@ -61,7 +62,10 @@ with open(title_file2, "w") as output_file, PdfPages(title_file) as pdf: data_array = readFileReferenceFree(firstFile, "\t") - pysam.index(bamFile) + bamIndex = f"{bamFile}.bai" + if not os.path.exists(bamIndex): + print(f"Info: Generating BAM index in {bamIndex}") + pysam.index(bamFile) bam = pysam.AlignmentFile(bamFile, "rb") qname_dict = collections.OrderedDict()
--- a/fsd_regions.xml Wed Dec 04 16:32:40 2019 -0500 +++ b/fsd_regions.xml Fri Sep 10 06:59:00 2021 +0000 @@ -7,17 +7,19 @@ <expand macro="requirements" > <requirement type="package" version="0.15">pysam</requirement> </expand> - <command> + <command><![CDATA[ +ln -s '$file2' 'reads.bam' && +ln -s '$file2.metadata.bam_index' 'reads.bam.bai' && python '$__tool_directory__/fsd_regions.py' --inputFile '$file' --inputName1 @ESCAPE_IDENTIFIER@ ---bamFile '$file2' +--bamFile 'reads.bam' #if $file3: --rangesFile '$file3' #end if --output_pdf '$output_pdf' --output_tabular '$output_tabular' - </command> + ]]></command> <inputs> <param name="file" type="data" format="tabular" label="Input tags of whole dataset" optional="false" help="This dataset is generated by post-processing of the output from 'Make Families' or 'Correct Barcodes' tool by extracting the first two columns, sorting the tags (column 1) and adding the counts of unique occurencies of each tag. See Help section below for a detailed explanation."/> <param name="file2" type="data" format="bam" label="BAM file of aligned reads." help="Input in BAM format with the reads that were aligned to the reference genome."/>