Quantcast
Channel: Post Feed
Viewing all articles
Browse latest Browse all 41826

Bash Script To Filter Blast Xml Output

$
0
0
I have read the instruction here:XSLT stylesheet to filter blast xml output And here:How to filter a blast xml output ? and I came up with this script:#!/bin/sh # # filterblastxml.sh : Script to filter blast XML output by evalue # Usage: filterblastxml.sh <blastxmlfile> <gt|lt> <evalue> <output_file_name> # For example: "filterblastxml.sh test.blastn.xml lt 1e-5 filtered_test.blastn.xml" # Above command filter the test.blastn.xml file to exclude all hits which has evalue # less than 1e-5 and output the content to filtered_test.blastn.xml file. tmpdir=/tmp xslt_file=$tmpdir/$(date +%s)_blastfilter.xslt.xsl cat << XSLTOUT > ${xslt_file}<?xml version='1.0' encoding="UTF-8" ?><xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'><xsl:output method="xml" encoding="UTF-8" indent="yes" doctype-public="-//NCBI//NCBI BlastOutput/EN" doctype-system="NCBI_BlastOutput.dtd" /><xsl:template match="*|text()"><xsl:copy><xsl:apply-templates select="*|text()"/></xsl:copy></xsl:template><xsl:template match="Iteration_hits/Hit/Hit_hsps"><xsl:apply-templates select="Hsp[number(Hsp_evalue)&${2};${3}]"/></xsl:template></xsl:stylesheet> XSLTOUT xsl ...

Viewing all articles
Browse latest Browse all 41826

Trending Articles