Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Bar Plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,734 changes: 1,534 additions & 200 deletions Lecture11.fasta

Large diffs are not rendered by default.

Binary file added Scatter Plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions Tut7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import os
from plotnine import *
from matplotlib import pyplot as plt
import numpy as np
import pandas

os.chdir("Intro_Biocom_ND_319_Tutorial7/")

fasta = open("Lecture11.fasta", "r")

sequenceID=[]
sequenceLength=[]
percentGC=[]
meltingTemp = []

for Line in fasta:
Line = Line.strip()
if '>' in Line:
sequenceID.append(Line[1:])
else:
seqLen=float(len(Line))

if seqLen <= 14:
Tm=2*(nG+nC)+2*seqLen
else:
Tm=-9999

nG=Line.count("G")
nC=Line.count("C")


sequenceLength.append(seqLen)
percentGC.append((nG+nC)/seqLen*100)
meltingTemp.append(Tm)


plt.hist(percentGC, bins = 11)
plt.title('Percent GC content distribution')
plt.xlabel('GC Content (%)')
plt.ylabel('count')

plt.show()

plt.hist(sequenceLength, bins = 24)
plt.title('Sequence Length distribution')
plt.xlabel('Sequence Length')
plt.ylabel('count')

plt.show()

InFile.close()

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job

## Question 3 Starts Here ##

data = pandas.read_csv("data.txt", sep = ",")


plot = ggplot(data, aes(y = "observations", x = "region"))
plot + geom_bar(stat="summary", fun_y = np.mean, fill = "green")

12 changes: 12 additions & 0 deletions Tutorial_3_Part3_Scatter_Plot
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import os
from plotnine import *
from matplotlib import pyplot as plt
import numpy as np
import pandas


data = pandas.read_csv("data.txt", sep = ",")


plot = ggplot(data, aes(y = "observations", x = "region"))
plot + geom_jitter(colour='black')

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job

21 changes: 21 additions & 0 deletions exercise7part1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import pandas
import numpy

InFile=open("Lecture11.fasta","r")

A = numpy.zeros((100,4)) #tells python how big we want the table to be.
B = pandas.DataFrame(A,columns=['seqNum','seqLength','Gcontent','Ccontent']) #labels each column

for line in InFile:
Line=Line.strip()
if '>' in Line:

else:
seqLen=float(len(Line))
seqLen=B.iloc[i,1]

nG=Line.count("G")
nG=B.iloc[i,2]

nC=Line.count("C")
nC=B.iloc[i,3]
15 changes: 15 additions & 0 deletions patentsPerYear.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import pandas
import matplotlib.pyplot as plt

df = pandas.read_excel('patentsPerYear.xlsx')

data= df[['Calendar Year','Utility Patent Application (Inventions)']]
x=data['Calendar Year']
y=data['Utility Patent Application (Inventions)']
plt.scatter(x,y)

z = np.polyfit(x, y, 1)
p = np.poly1d(z)
plt.plot(x,p(x),"r--")

plt.show()

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job

Binary file added patentsPerYear.xlsx
Binary file not shown.