biolab 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/1.py ADDED
@@ -0,0 +1,11 @@
1
+ from Bio.Seq import Seq
2
+
3
+ seq1=Seq("AGCTAGTAGCTGACGATCGATCGATCGCT")
4
+ seq2=Seq("AGTCGTCGTCAGGATCGATCGTCGA")
5
+ sliced=seq1[3:11]
6
+ concat=sliced+seq2
7
+ trans=sliced.transcribe()
8
+ translate=concat.translate()
9
+ print(sliced)
10
+ print(concat)
11
+ print(trans, translate)
package/100.py ADDED
@@ -0,0 +1,18 @@
1
+ from Bio.PDB import PDBParser,PDBList
2
+ import matplotlib.pyplot as plt
3
+ from mpl_toolkits.mplot3d import Axes3D
4
+ import numpy as np
5
+
6
+ pdb_id="1A3N"
7
+ pdb_list=PDBList()
8
+ filepath=pdb_list.retrieve_pdb_file(pdb_id,pdir=".",file_format="pdb")
9
+ pdpp=PDBParser(QUIET=True)
10
+ structure =pdpp.get_structure(pdb_id,filepath)
11
+
12
+ coords=[atom.coord for atom in structure.get_atoms()]
13
+ coords=np.array(coords)
14
+
15
+ fig=plt.figure()
16
+ ax=fig.add_subplot(111,projection="3d")
17
+ ax.scatter(coords[:,0],coords[:,1],coords[:,2],c="blue",s=10)
18
+ plt.show()
package/2.py ADDED
@@ -0,0 +1,11 @@
1
+ from Bio import SeqIO
2
+
3
+
4
+ def readf(fasta_file):
5
+ for records in SeqIO.parse(fasta_file,"fasta"):
6
+ print(f"{records.description}")
7
+
8
+
9
+
10
+ fasta_file="fasta_1 (1).fasta"
11
+ readf(fasta_file)
package/3.py ADDED
@@ -0,0 +1,31 @@
1
+ from Bio.Seq import Seq
2
+ from Bio import SeqIO
3
+ from Bio.SeqRecord import SeqRecord
4
+
5
+ # Define the sequence
6
+ seq1 = Seq("AGTCTGACTAACGATGCGTACGT")
7
+
8
+ # Create the SeqRecord
9
+ record = SeqRecord(
10
+ seq1,
11
+ id="1",
12
+ name="svscv",
13
+ description="Example DNA sequence",
14
+ annotations={
15
+ "molecule_type": "DNA",
16
+ "organism": "Unknown organism"
17
+ }
18
+ )
19
+
20
+
21
+
22
+ # Write to GenBank file
23
+ file_path = "genbank.gb"
24
+ with open(file_path, "w") as f:
25
+ SeqIO.write(record, f, "genbank")
26
+
27
+ # Read back and print
28
+ with open(file_path, "r") as f:
29
+ read_record = SeqIO.read(f, "genbank")
30
+
31
+ print(read_record)
package/4.py ADDED
@@ -0,0 +1,33 @@
1
+ from Bio import Seq
2
+ from Bio.Seq import Seq
3
+ from Bio import SeqIO
4
+ from Bio.SeqRecord import SeqRecord
5
+
6
+ fasta="fasta_1 (1).fasta"
7
+ with open(fasta,"r") as f:
8
+ records=[]
9
+ for record in SeqIO.parse(f,"fasta"):
10
+ seq=record.seq
11
+ des=record.description
12
+
13
+ re=SeqRecord(
14
+ seq,
15
+ id="1",
16
+ name="wfew",
17
+ description=des,
18
+ annotations={
19
+ "gene": "DNA",
20
+ "molecule_type":"DNA",
21
+ "function":"dssadc",
22
+ "organism":"unknown organism"
23
+ }
24
+ )
25
+ records.append(re)
26
+
27
+
28
+ with open("genbank.gb","w") as ge:
29
+ SeqIO.write(records,ge,"genbank")
30
+
31
+
32
+
33
+
package/5.py ADDED
@@ -0,0 +1,23 @@
1
+ from Bio.SeqRecord import SeqRecord
2
+ from Bio.SeqFeature import SeqFeature,FeatureLocation
3
+ from Bio.Seq import Seq
4
+
5
+ seq1=Seq("ATCGATGTGCATCGTACCGATCGCAGT")
6
+
7
+ record=SeqRecord(
8
+ seq1,
9
+ id="1",
10
+ name="unk",
11
+ description="fsefsd"
12
+
13
+ )
14
+
15
+
16
+ record.annotations["gene"]="gene"
17
+ record.annotations["molecule_type"]="DNA"
18
+
19
+ seqf=SeqFeature(FeatureLocation(0,21),type="gene",qualifiers={"gene":"exmaple gene"})
20
+
21
+ record.annotations["function"]="Simple"
22
+ print({record.id})
23
+ print(record)
package/6.py ADDED
@@ -0,0 +1,11 @@
1
+ from Bio import Seq,SeqIO,Entrez
2
+
3
+ Entrez.email="heman@gmail.com"
4
+
5
+ id="NM_001301717"
6
+
7
+ handle =Entrez.efetch(db="nucleotide",rettype="gb",retmode="text",id=id)
8
+
9
+ seqr=SeqIO.read(handle,"genbank")
10
+
11
+ print(seqr)
package/7.py ADDED
@@ -0,0 +1,9 @@
1
+ from Bio.Align import PairwiseAligner
2
+ from Bio.Seq import Seq
3
+ seq1=Seq("AGTCTAGCT")
4
+ seq2=Seq("AGCTCGTACG")
5
+ #aligner=PairwiseAligner()
6
+ al=PairwiseAligner().align(seq1, seq2)
7
+
8
+ print(al[0])
9
+ print(al[0].score)
package/81.py ADDED
@@ -0,0 +1,28 @@
1
+ from Bio.Align.Applications import MuscleCommandline
2
+ from Bio import AlignIO
3
+ seq1 = """>seq1
4
+ AGTCATGCAT
5
+ """
6
+ seq2 = """>seq2
7
+ ATGCATGCAT
8
+ """
9
+ seq3=""">seq3
10
+ ACGTCGATCG
11
+ """
12
+ with open("f8.fasta","w") as f:
13
+ f.write(seq1)
14
+ f.write(seq2)
15
+ f.write(seq3)
16
+
17
+ muscle="muscle3.8.31_i86win32.exe"
18
+
19
+ m_cline=MuscleCommandline(cmd=muscle,input="f8.fasta",out="aligned.fasta")
20
+
21
+ stdout,stderr=m_cline()
22
+
23
+ if(stderr):
24
+ print(stderr)
25
+
26
+
27
+ align=AlignIO.read("aligned.fasta","fasta")
28
+ print(align)
package/91.py ADDED
@@ -0,0 +1,14 @@
1
+ from Bio.Phylo.TreeConstruction import DistanceTreeConstructor ,DistanceCalculator
2
+
3
+ from Bio import Phylo ,AlignIO
4
+ alignment=AlignIO.read("aligned_sequences.aln","clustal")
5
+
6
+ cal=DistanceCalculator('identity')
7
+
8
+ matrix=cal.get_distance(alignment)
9
+
10
+ trees=DistanceTreeConstructor()
11
+ tree=trees.upgma(matrix)
12
+
13
+ Phylo.draw(tree)
14
+
package/aligned.fasta ADDED
@@ -0,0 +1,6 @@
1
+ >seq1
2
+ AGTCATGCAT--
3
+ >seq2
4
+ ATGCATGCAT--
5
+ >seq3
6
+ --ACGTCGATCG
@@ -0,0 +1,7 @@
1
+ CLUSTAL W(1.82) multiple sequence alignment
2
+
3
+
4
+ seq1 ATGCGTACGTAGCTAGCTAGCTAGCTAGCTACG
5
+ seq2 ATGCGTACGTAGCTAGCTAGCTAGCTAGCTGCG
6
+ seq3 ATGCGTACGTAGCTAGCTAGCTAGCTAGTTACG
7
+ seq4 ATGCGTACGTAGCTAGCTAGCTAGCTAGCTACG
@@ -0,0 +1,6 @@
1
+ >seq1
2
+ ATGCGTACGTA
3
+ >seq2
4
+ ATGCGTACGTC
5
+ >seq3
6
+ ATGCGTACGAG
package/f8.fasta ADDED
@@ -0,0 +1,6 @@
1
+ >seq1
2
+ AGTCATGCAT
3
+ >seq2
4
+ ATGCATGCAT
5
+ >seq3
6
+ ACGTCGATCG