Skip to content

Instantly share code, notes, and snippets.

View SemiQuant's full-sized avatar

Jason D Limberis SemiQuant

View GitHub Profile
@SemiQuant
SemiQuant / bacterial gff to mRNA
Created August 21, 2023 16:32
Convert NCBI gff for bacteria to a usable format for bcftools csq
import gffutils
input_gff_file = "Mycobacterium_tuberculosis_H37Rv_gff_v4.gff"
output_gff_file = input_gff_file.replace('.gff', '_fixed.gff')
# Create a new GFF database
db = gffutils.create_db(input_gff_file, dbfn=':memory:', force=True, merge_strategy='replace')
# Create a new GFF writer
output_handle = open(output_gff_file, 'w')
@SemiQuant
SemiQuant / ImpactHunter.py
Last active June 3, 2023 15:57
Summarize the publication of a researcher, and calculate their IFs for first and last authorships in a data range
#!/bin/python
from Bio import Entrez
import subprocess
import ast
import statistics
def search_publications(author_name, start_year, end_year):
# Search PubMed for publications by the author within the specified date range
query = f'({author_name}[Author]) AND (Journal Article[Publication Type]) NOT (Clinical Trial[Publication Type]) NOT preprint[pt] NOT review[pt] AND ({start_year}:{end_year}[PDAT])'
handle = Entrez.esearch(db='pubmed', term=query)
record = Entrez.read(handle)
@SemiQuant
SemiQuant / TabbedTabs_Flex
Created May 10, 2019 08:38
Tab box in a flex dashboard with tabbed columns
---
title: "Tabbed Tabs"
author: "SemiQuant"
date: "5/10/2019"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
---
This is what you do, Dave.