Mercurial > repos > bornea > filter_fasta
comparison filter_fasta.py @ 5:af454e5a9ef5 draft
Uploaded
author | bornea |
---|---|
date | Sat, 06 Aug 2016 17:00:41 -0400 |
parents | b25b0f210e10 |
children | 5990c4dbfbaa |
comparison
equal
deleted
inserted
replaced
4:489b560129c8 | 5:af454e5a9ef5 |
---|---|
1 # -*- coding: utf-8 -*- | 1 |
2 """ | 2 """ |
3 Python-code: Merge Scaffold Samples Report files | 3 Python-code: Merge Scaffold Samples Report files |
4 @author = Brent Kuenzi | 4 @author = Brent Kuenzi |
5 @email = Brent.Kuenzi@moffitt.org | 5 @email = Brent.Kuenzi@moffitt.org |
6 """ | 6 """ |
20 output = [] | 20 output = [] |
21 for line in x: | 21 for line in x: |
22 line = line.strip() | 22 line = line.strip() |
23 temp = line.split('\t') | 23 temp = line.split('\t') |
24 output.append(temp) | 24 output.append(temp) |
25 print temp | |
25 return output | 26 return output |
26 def getAccessions(infile): # get list of protein accessions from your data | 27 def getAccessions(infile): # get list of protein accessions from your data |
27 data = readtab(infile) | 28 data = readtab(infile) |
28 cnt = 0 | 29 cnt = 0 |
29 header_start = 0 | 30 header_start = 0 |
80 seq.append(merged) | 81 seq.append(merged) |
81 cnt=0 | 82 cnt=0 |
82 with open("output.fasta","wt") as x: | 83 with open("output.fasta","wt") as x: |
83 for i in header: | 84 for i in header: |
84 x.write(i+'\n'+seq[cnt]+'\n') | 85 x.write(i+'\n'+seq[cnt]+'\n') |
86 print i+'\n'+seq[cnt]+'\n' | |
85 cnt+=1 | 87 cnt+=1 |
86 fasta = sys.argv[1] # fasta file to filter | 88 fasta = sys.argv[1] # fasta file to filter |
87 data = sys.argv[2] # scaffold report #2 -- filename | 89 data = sys.argv[2] # scaffold report #2 -- filename |
88 | 90 |
89 FilterFastaSeq(fasta,getAccessions(data)) | 91 FilterFastaSeq(fasta,getAccessions(data)) |