Skip to content

Instantly share code, notes, and snippets.

View aimirza's full-sized avatar

Ali Mirza aimirza

View GitHub Profile
@aimirza
aimirza / README.md
Last active May 22, 2020 13:54
Script to regroup genes to ontologies while maintaining compositionality

An R script to regroup genes to ontologies while maintaining compositionality

Same default output of the humann2 untility script regroup_table.py while addresses the many-to-one mapping problem. The only difference is that each gene abundance from your gene table is divided by the number of times it maps to an ontology. This ensures that your output table is truely compositional (componenets sum to 1).

"Each component should never give more than itself..." ~ Thom Quinn

Command

$ Rscript regroup_table_compositional.R --input <joined_gene_table.tsv> --map <path/to/utility_mapping_file.txt.gz> --out <ontology_table.tsv>

@aimirza
aimirza / primer_screen.sh
Last active July 30, 2018 17:09
Bash script to screen the primer of interest in your file, including it's reverse sequence, its compliment, and it's reverse compliment.
#!/bin/bash
#HOW TO USE: sh primer_screen.sh <primer> <path to file with sequences>
#Simple bash script to quickly screen the primer of interest in your file.
#The script will screen for your primer, it's reverse sequence, its compliment, and it's reverse compliment.
#If a perimer is found, the terminal will print text in red with the primer sequence and the
#number of times the primer is present in the file.
primer1=$1
<?xml version='1.0' encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:for-each select="ROOT/SAMPLE/SAMPLE_ATTRIBUTES/SAMPLE_ATTRIBUTE">
<xsl:value-of select="../../@accession"/>|<xsl:value-of select="TAG"/>|<xsl:value-of select="VALUE"/><xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>