Skip to content

Instantly share code, notes, and snippets.

View davidliwei's full-sized avatar

Wei Li davidliwei

View GitHub Profile
@davidliwei
davidliwei / getinsertsize.py
Last active October 25, 2022 06:15
Estimating NGS paired-end read insert size (or fragment length) from SAM/BAM files
#!/usr/bin/env python
'''
Automatically estimate insert size of the paired-end reads for a given SAM/BAM file.
Usage: getinsertsize.py <SAM file> or samtools view <BAM file> | getinsertsize.py -
Author: Wei Li
Copyright (c) <2015> <Wei Li>
@davidliwei
davidliwei / getinsertsize.py
Created August 24, 2011 18:34
This script extracts insert size mean and std, mass of mapped read information from Cufflinks log outputs.
#!/bin/env python3
import os
import re
import sys
if len(sys.argv)<2:
print('This script extracts insert size information from Cufflinks logs.',file=sys.stderr);
print('Usage: getinsertsize [cufflinks log file]',file=sys.stderr);
print('Note: you may specify different log files using filename wildcards.',file=sys.stderr);
@davidliwei
davidliwei / gtf2bed.py
Created August 18, 2011 23:44
Converting Cufflinks predictions (.GTF) into .BED annotations
#!/usr/bin/env python3
'''
gtf2bed.py converts GTF file to BED file.
Usage: gtf2bed.py {OPTIONS} [.GTF file]
History
Nov.5th 2012:
1. Allow conversion from general GTF files (instead of only Cufflinks supports).
2. If multiple identical transcript_id exist, transcript_id will be appended a string like "_DUP#" to separate.
'''