<?xml version='1.0'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" >
<channel>
	<title><![CDATA[BOL: Long reads mapper bash script !]]></title>
	<link>https://bioinformaticsonline.com/snippets/view/37283/long-reads-mapper-bash-script?</link>
	<atom:link href="https://bioinformaticsonline.com/snippets/view/37283/long-reads-mapper-bash-script?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/37283/long-reads-mapper-bash-script</guid>
	<pubDate>Thu, 12 Jul 2018 10:15:44 -0500</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/37283/long-reads-mapper-bash-script</link>
	<title><![CDATA[Long reads mapper bash script !]]></title>
	<description><![CDATA[<code>#!/bin/bash

#only for LONG READS mapping 
#USAGE: runMapper.sh minimap2 ref.fa reads.fa/fq 48 ont
echo -e &quot;This is a bash scrip to map your long reads and make it visualization ready !&quot; 

#Location of the tools
samtools=/home/urbe/anaconda3/bin/samtools
graphMapLoc=/home/urbe/Tools/graphmap/bin/Linux-x64/graphmap
minimap2Loc=/home/urbe/Tools/minimap2-2.3_x64-linux/minimap2
bwaMemLoc=/home/urbe/anaconda3/bin/bwa
ngmlrLoc=/home/urbe/Tools/ngmlr/bin/ngmlr-0.2.3/ngmlr
lamsaLoc=/home/urbe/Tools/LAMSA/lamsa

#Parameters accepted
toolName=$1
refFasta=$2
longReads=$3
thread=$4
readsType=$5

if [ $# -lt 5 ]; then
    echo &quot;No or less arguments provided&quot;
    echo &quot;#USAGE: runMapper.sh minimap2 ref.fa reads.fa/fq 48 ont&quot;
    exit 1
fi

fileName=$(basename &quot;$refFasta&quot;); #fileName=$(basename &quot;$refFasta&quot; .fq);
echo &quot;Name of the file used for mapping $fileName, present at $refFasta&quot;

if [ $toolName == &quot;bwa&quot; ]; then
   echo &quot;Mapping with $toolName&quot;
   $bwaMemLoc index $refFasta
   $bwaMemLoc mem $refFasta $longReads -t $thread &gt; $fileName.out.sam
elif [ $toolName == &quot;lamsa&quot; ]; then
   echo &quot;Mapping with $toolName&quot;
   $lamsaLoc index $refFasta
	if [ $readsType == &quot;ont&quot; ]; then
   		$lamsaLoc aln -t $thread -T ont2d $refFasta $longReads &gt; $fileName.out.sam
	elif [ $readsType == &quot;pacbio&quot; ]; then
   		$lamsaLoc aln -t $thread -T pacbio $refFasta $longReads &gt; $fileName.out.sam
	else
		echo &quot;LAMSA:Please specify reads type: ont, pacbio&quot;
	fi
elif [ $toolName == &quot;minimap2&quot; ]; then
   echo &quot;Mapping with $toolName&quot;
	if [ $readsType == &quot;ont&quot; ]; then
   		$minimap2Loc -ax map-ont $refFasta $longReads -t $thread &gt; $fileName.out.sam
	elif [ $readsType == &quot;pacbio&quot; ]; then
   		$minimap2Loc -ax map-pb $refFasta $longReads -t $thread &gt; $fileName.out.sam
	else
		echo &quot;MINIMAP2:Please specify reads type: ont, pacbio&quot;
	fi
elif [ $toolName == &quot;ngmlr&quot; ]; then
   echo &quot;Mapping with $toolName&quot;
	if [ $readsType == &quot;ont&quot; ]; then
   		$ngmlrLoc -t $thread -r $refFasta -q $longReads -o $fileName.out.sam -x $readsType
	elif [ $readsType == &quot;pacbio&quot; ]; then
   		$ngmlrLoc -t $thread -r $refFasta -q $longReads -o $fileName.out.sam -x $readsType
	else
		echo &quot;NGMLR:Please specify reads type: ont, pacbio&quot;
	fi
elif [ $toolName == &quot;graphmap&quot; ]; then
   echo &quot;Mapping with $toolName&quot;
   $graphMapLoc align -r $refFasta -d $longReads -t $thread -o $fileName.out.sam
else
   echo &quot;Unknown mapper name and parameter !&quot;
fi


echo &quot;Getting files ready for visualization !&quot;
$samtools view -Sb $fileName.out.sam | $samtools sort -m 4G -@$thread -o $fileName.sorted.bam - &amp;&amp; $samtools index -@$thread $fileName.sorted.bam

echo &quot;All Done :)&quot;</code>]]></description>
	<dc:creator>Jit</dc:creator>
</item>

</channel>
</rss>