-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuscar
106 lines (84 loc) · 3.57 KB
/
buscar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import os
from Bio import SeqIO
from Bio import Entrez
from Bio import SwissProt
import re
import inspect
import Gene
import re
#Get data from NCBI
Entrez.email = "[email protected]" # Always tell NCBI who you are
handle4 = Entrez.efetch(db="nucleotide", id="15638995", rettype="gb", strand=1, seq_start=639851,
seq_stop=765100)
handle5 = Entrez.efetch(db="nucleotide", id="15638995", rettype="fasta", strand=1, seq_start=639851,
seq_stop=765100)
#---------------------------------------------------------------------------
#print(str(recordF.seq)[122609:124403])
filename2 = "g6.gb"
fastaFile = "g6.fasta"
save_file2 = open(filename2, "w")
save_file2.write(handle4.read())
save_file2.close()
save_fileF = open(fastaFile, "w")
save_fileF.write(handle5.read())
save_fileF.close()
handle4.close()
handle5.close()
#------------------------------------------------------------
#record4 = SeqIO.read(handle4, "genbank")
#recordF = SeqIO.read(handle5, "fasta")
#-------------------------------------------------------------
record4 = SeqIO.read(filename2, "genbank")
recordF = SeqIO.read(fastaFile, "fasta")
#Save information in variables
fastaSeq= str(recordF.seq)
#Qualifiers expressions
locus_tag="locus_tag"
old_locus_tag="old_locus_tag"
db_xref="db_xref"
product="product"
#only for trna
anticodon="anticodon"
#only for CDS
accession="protein_id"
translation="translation"
ec="EC_number"
tc="TC_number"
#-----------------------------------------------------
#print (record4.seq) # recupera a nossa parte do genoma a estudar
#print(inspect.getdoc(record4))
cdsList=[]
trnaList=[]
features = record4.features
for feature in features:
f= str(feature.location)
if(str(feature.type)!="gene" and str(feature.type)!="source"): #retira as informacoes de tudo o que nao seja gene ou source
locations=re.findall("[0-9]+",f)
l1=int(locations[0])+639851
l2=int(locations[1])+639850
loc="["+str(l1)+":"+str(l2)+"]"
qualifiers= feature.qualifiers
if(str(feature.type)=="tRNA"):
trna= Gene.MyTRNA(str(feature.type),str(feature.strand),loc,str(qualifiers.get(locus_tag)),str(qualifiers.get(old_locus_tag)), str(qualifiers.get(db_xref)),str(qualifiers.get(product)),str(qualifiers.get(anticodon)),fastaSeq[int(locations[0]):int(locations[1])] )
trnaList.append(trna)
print(trna)
print("----------------------------------------------------------------------")
else:
cDS= Gene.MyCDS(str(feature.type),str(feature.strand),loc,str(qualifiers.get(locus_tag)),str(qualifiers.get(old_locus_tag)), str(qualifiers.get(db_xref)),str(qualifiers.get(product)),str(qualifiers.get(accession)),str(qualifiers.get(translation)),fastaSeq[int(locations[0]):int(locations[1])],str(qualifiers.get(ec)),str(qualifiers.get(tc)) )
cdsList.append(cDS)
cDS.blast()
cDS.uniprotSearch()
print("-------------------------------------------")
print(cDS)
print("---------------------------------------------")
print("accession :%s" % qualifiers.get(accession))
print("translation :%s" % qualifiers.get(translation))
print(fastaSeq[int(locations[0]):int(locations[1])])
#print("Qualifiers: %s" % feature.qualifiers)
#cdsList[0].uniprotSearch()
#cdsList[0].blast()
#print(inspect.getdoc(feature))
#print(for method in dir(feature) if callable(getattr(feature, method)))
#sig= inspect.signature(feature)
#print(sig);
#feature = features[0]