How to do a dotplot with minimap2:
minimap2 -DP ref.fa query.fa|miniasm/minidot - > dot.eps
How to do a dotplot with minimap2:
minimap2 -DP ref.fa query.fa|miniasm/minidot - > dot.eps
How to convert a minimap2 alignment to gff/gtf:
https://github.com/lh3/minimap2/issues/455
https://github.com/lh3/minimap2/files/9591008/bam2gff_fixGffread.zip
bam2gff_fixGffread.zip
minimap2 -t 10 -ax splice:hq -uf ref.fa cdna.fa |/Bio/bin/samtools-1.14 view -b > minimap2.tr.bam
perl bam2gff.pl -b minimap2.tr.bam -o minimap2.tr.gff -s /Bio/bin/samtools-1.14 gffread minimap2.tr.gff -T -o minimap2.tr.gtf
perl fixGffread.pl -i minimap2.tr.gtf -o minimap2.tr.fix.gtf
Alternative method:
#Align sequences and convert to BAM
minimap2 -ax splice --cs target.fa query.fa | samtools sort -O BAM - > alignments.bam
#Convert to BED12 using BEDtools
bedtools bamtobed -bed12 -i alignments.bam > alignments.bed
#Convert to genePred using UCSC tools
bedToGenePred alignments.bed alignments.genepred
#Convert to GTF2 using UCSC tools. genePredToGtf has additional options that might be useful in specific use cases.
genePredToGtf "file" alignments.genepred alignments.gtf
How to get the path for the folder containing a bash script within the bash script:
# Get the directory where the script resides
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
echo $SCRIPTDIR
How to gather and group all tuple elements in a NextFlow channel by the first and second indexes of each tuple, perform a process on a file containing the first and second indices, and then reform the original channel by scattering:
hc_ch = Channel.of(
['abc', 1, file('file1.txt')],
['abc', 1, file('file2.txt')],
['abc', 1, file('file3.txt')],
['def', 2, file('file4.txt')]
)
combinedChannel = hc_ch.groupTuple(by: [0, 1])
[ ['abc', 1, [file('file1.txt'), file('file2.txt'), file('file3.txt')]],
['def', 2, [file('file4.txt')]]
]
process delete_txt {
input:
tuple val(id), val(sub_id), val(files) from combinedChannel
output:
tuple val(id), val(sub_id), val(files) into processedChannel
script:
"""
rm ${id}_${sub_id}.txt
"""
}
[ ['abc', 1, [file('file1.txt'), file('file2.txt'), file('file3.txt')]],
['def', 2, [file('file4.txt')]]
]
flattenedChannel = processedChannel.flatMap { id, sub_id, files -> files.collect { [id, sub_id, it] } }