Skip to content

Instantly share code, notes, and snippets.

@ivan-krukov
Created August 9, 2012 17:19
Show Gist options
  • Save ivan-krukov/3306085 to your computer and use it in GitHub Desktop.
Save ivan-krukov/3306085 to your computer and use it in GitHub Desktop.
Header remover
import argparse
from Bio import SeqIO
parser=argparse.ArgumentParser()
parser.add_argument("inputFile", help="input fasta file")
parser.add_argument("outputFile",help="output file name")
parser.add_argument("sampleName",help="sample name to be removed")
args = parser.parse_args()
fileOut = open(args.outputFile, "w")
if args.sampleName:
for seq_record in SeqIO.parse(args.inputFile, "fasta"):
if not (args.sampleName in seq_record.id):
SeqIO.write(seq_record,args.input_file,"fasta")
fileOut.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment