Skip to content

Instantly share code, notes, and snippets.

@gfjlcw

gfjlcw/test.py Secret

Created October 12, 2021 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gfjlcw/1367c44eac56f966eabe663a7c38ab47 to your computer and use it in GitHub Desktop.
Save gfjlcw/1367c44eac56f966eabe663a7c38ab47 to your computer and use it in GitHub Desktop.
.py file with Code Editor Out of Sync error
# Firstly, we need to import all the required packages:
import streamlit as st
import csv
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import gseapy as gp
import plotly.express as px
from scipy.stats import pearsonr
from sklearn import linear_model, metrics
from sklearn.datasets import *
from scipy import stats
import plotly.graph_objects as go
import plotly.figure_factory as ff
import re
from scipy.spatial.distance import pdist, squareform
from dash import dcc
import dash_bio as dashbio
# You may use the following code to make the layout wider. It should be the first code you use.
st.set_page_config(layout="wide")
# Next, we type in the codes needed to read your selected dataset. Prepare a .csv file beforehand with the specific timepoint that you are interested in. We will use Pandas to read and load that .csv file into Streamlit. You can also include a title for easier visualisation.
st.title("Analysis using the adenovirus seronegative dataset for 1d vs 0")
Ad5_seroneg = pd.read_csv('/Users/gabri/Desktop/vaccine/dashboarding/Ad5_Zak_1dvs0.csv', index_col=0)
Ad5_seroneg
# The first part of our analysis will be to find the upregulated and downregulated DEGs
st.subheader("Upregulated and Downregulated DEGs")
Ad5_seroneg['pval_1dvs0'] = pd.to_numeric(Ad5_seroneg['pval_1dvs0'], errors = 'coerce')
Ad5_seroneg['qval_1dvs0'] = pd.to_numeric(Ad5_seroneg['qval_1dvs0'], errors = 'coerce')
# We use the following command to filter the DEGs based on adjusted p-value < 0.05 and your chosen fold change value.
Ad5_seroneg_DEGs_up_FC_1pt3_FDRpval_pt05 = Ad5_seroneg[(Ad5_seroneg["fc_1dvs0"] > 1.3) & (Ad5_seroneg["qval_1dvs0"] < 0.05)]
Ad5_seroneg_DEGs_up_FC_1pt3_FDRpval_pt05_counts = Ad5_seroneg_DEGs_up_FC_1pt3_FDRpval_pt05.index
Ad5_seroneg_DEGs_down_FC_1pt3_FDRpval_pt05 = Ad5_seroneg[(Ad5_seroneg["fc_1dvs0"] < -1.3) & (Ad5_seroneg["qval_1dvs0"] < 0.05)]
Ad5_seroneg_DEGs_down_FC_1pt3_FDRpval_pt05_counts = Ad5_seroneg_DEGs_down_FC_1pt3_FDRpval_pt05.index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment