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
353 changes: 353 additions & 0 deletions Bedding/DE.txt

Large diffs are not rendered by default.

353 changes: 353 additions & 0 deletions Bedding/all samples.txt

Large diffs are not rendered by default.

349 changes: 349 additions & 0 deletions Bedding/bedding.csv

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions Bedding/convert_gene_name_2_ensembl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import pandas as pd
from bioservices import *

# Read in the gene mapping file
gene_mapping = pd.read_csv("gene_mapping.csv")

# Create an instance of the BioMart service
ensembl = BioMart()

# Connect to the Ensembl database
ensembl.new_query()
ensembl.add_dataset_to_xml("hsapiens_gene_ensembl")

# Map the gene names to their Ensembl IDs
ensembl_ids = []
for name in gene_mapping['Gene Symbol']:
ensembl.add_attribute_to_xml("external_gene_name")
ensembl.add_filter_to_xml("external_gene_name", name)
result = ensembl.results()
if result:
ensembl_ids.append(result[0][0])
else:
ensembl_ids.append(None)

# Add the Ensembl IDs as a new column in the gene mapping file
gene_mapping['ensembl_id'] = ensembl_ids

# Output the mapped gene mapping file
gene_mapping.to_csv("mapped_gene_mapping.csv", index=False)
Loading