This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import pandas | |
import argparse | |
parser = argparse.ArgumentParser(description='Convert GDC JSON with files details to a TSV with the columns: case_id, file_id, file_name') | |
parser.add_argument('-j', '--json', metavar='JSON', type=str, | |
help='JSON file with file details from GDC') | |
parser.add_argument('-o', '--output', metavar='TSV', | |
default='file-dict.tsv', | |
help='Path to output file') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argparse | |
import pandas as pd | |
parser = argparse.ArgumentParser(description='Find the items that occur in all rows of a table (i.e. rows in which all values are greater than 0) and save to output file.') | |
parser.add_argument('-i', '--input', help='Input file.') | |
parser.add_argument('-o', '--output', help='Output file.') | |
parser.add_argument('--items-label', help='Header for the items column. If none is provided then there will be no header row.', default=None) | |
parser.add_argument('--index-label', help='Header for the index column. If none is provided then there will be no header row.', default=None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argparse | |
import pandas as pd | |
parser = argparse.ArgumentParser(description='Find the items that occur in all rows of a table (i.e. rows in which all values are greater than 0) and save to output file.') | |
parser.add_argument('-i', '--input', help='Input file.') | |
parser.add_argument('-o', '--output', help='Output file.') | |
args = parser.parse_args() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
def main(args): | |
import pandas as pd | |
data = pd.read_csv(args.enrichment_data, sep='\t', index_col=0) | |
name_dict = pd.read_csv(args.name_dict, sep='\t', index_col=0, header=None) | |
core_funcs = pd.read_csv(args.core_functions, sep='\t', index_col=0) | |
gcs_of_core_functions = [] | |
for func in core_funcs.index: | |
original_func_names = list(name_dict.loc[name_dict[1]==func].index) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Click 'Download > Multiple-file JSON' from NCBI search results page, | |
# unzip it, run this script in it, this way: | |
# python summarize_blast_results_of_anvio_HMMs.py OUTPUT_FILE.txt | |
import sys | |
import json | |
import glob |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Thist script requires a config file (in JSON or YAML format) with this structure: | |
# { | |
# "data": "path-to-tabular-data.txt", | |
# "name": "project-name-to-use-as-prefix-for-output-files", | |
# "metadata": "path-to-metadata-file.txt", | |
# "transpose": "true-or-false-if-you-want-to-transpose-the-data", | |
# "fix_item_names": "true-if-row-names-start-with-numeric", | |
# "output_dirs": { | |
# "LOGS_DIR": "00_LOGS", | |
# "INTERACTIVE_DIR": "00_ANVIO_FIGURE", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 | |
def main(args): | |
import pandas as pd | |
import re | |
input_file = args.input_file | |
output_file = args.output_file | |
data = pd.read_csv(input_file, sep='\t', index_col=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# To use this: | |
# python gen-collection-for-merged-fasta.py -f fasta.txt -o collection-file.txt | |
import sys | |
from anvio import fastalib | |
from anvio import utils | |
from anvio import filesnpaths | |
from anvio.errors import ConfigError, FilesNPathsError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Click 'Download > Multiple-file JSON' from NCBI search results page, | |
# unzip it, run this script in it, this way: | |
# python summarize_blast_results_of_anvio_HMMs.py OUTPUT_FILE.txt | |
import sys | |
import json | |
import glob |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
split fasta file into multiple smaller fasta files | |
Use like this: | |
python SPLIT-FASTA.py fasta-name.fa output-prefix SIZE | |
So if your input fasta was contigs.fa, and had 190 sequences then: |
NewerOlder