Skip to content
Snippets Groups Projects
Commit 88474808 authored by aakan96's avatar aakan96
Browse files

Update 2 files

- /02_MultiMIR/MultiMiR.R
- /04_Cytoscape/extract_mrna_names_from_mirna.R
parent f9b1c074
No related branches found
No related tags found
No related merge requests found
library(readxl) # Load required libraries
library(multiMiR) library(readxl) # For reading data from Excel files
library(writexl) library(multiMiR) # For querying validated miRNA-mRNA interactions
library(writexl) # For writing data to Excel files
# Read data from an Excel file named "miRNAmRNA.xlsx" and store it in the "new_list" variable.
new_list <- read_excel("miRNAmRNA.xlsx", header = TRUE) new_list <- read_excel("miRNAmRNA.xlsx", header = TRUE)
# Get validated miRNA-mRNA interactions using the "multiMiR" package.
# In this case, the interactions are queried for human (hsa) miRNAs (mirnames) from the "validated" table.
# The results will be summarized and stored in the "multimir_results" variable.
multimir_results <- get_multimir(org = 'hsa', multimir_results <- get_multimir(org = 'hsa',
mirna = mirnames, mirna = mirnames,
table = 'validated', table = 'validated',
summary = TRUE) summary = TRUE)
# Display the first few rows of the "multimir_results" data to get an overview of the miRNA-mRNA interactions.
head(multimir_results@data) head(multimir_results@data)
# Extract the results of miRNA-mRNA interactions from the "multimir_results" variable and store them in the "targets" variable.
targets <- multimir_results@data targets <- multimir_results@data
# Specify the Excel file name where the results will be saved.
excel_file <- "multimir_results.xlsx" excel_file <- "multimir_results.xlsx"
write_xlsx(targets, path = excel_file )
\ No newline at end of file # Write the "targets" data to an Excel file with the specified file name.
write_xlsx(targets, path = excel_file)
library(readxl) # Load required libraries
library(multiMiR) library(readxl) # For reading data from Excel files
library(writexl) library(multiMiR) # For querying validated miRNA-mRNA interactions
library(writexl) # For writing data to Excel files
# Read data from an Excel file named "miRNAmRNA.xlsx" and store it in the "new_list" variable.
new_list <- read_excel("C:/Users/Emre/Desktop/miRNAmRNA.xlsx", header = TRUE) new_list <- read_excel("C:/Users/Emre/Desktop/miRNAmRNA.xlsx", header = TRUE)
# Get validated miRNA-mRNA interactions using the "multiMiR" package.
# In this case, the interactions are queried for human (hsa) miRNAs (mirnames) from the "validated" table.
# The results will be summarized and stored in the "multimir_results" variable.
multimir_results <- get_multimir(org = 'hsa', multimir_results <- get_multimir(org = 'hsa',
mirna = mirnames, mirna = mirnames,
table = 'validated', table = 'validated',
summary = TRUE) summary = TRUE)
# Display the first few rows of the "multimir_results" data to get an overview of the miRNA-mRNA interactions.
head(multimir_results@data) head(multimir_results@data)
# Extract the results of miRNA-mRNA interactions from the "multimir_results" variable and store them in the "targets" variable.
targets <- multimir_results@data targets <- multimir_results@data
# Specify the Excel file path where the results will be saved.
excel_file <- "C:/Users/Emre/Desktop/Bioinformatik/Bioinformatik 2.Semester Master/Data Science in the Life Sciences/Project/multimir_results.xlsx" excel_file <- "C:/Users/Emre/Desktop/Bioinformatik/Bioinformatik 2.Semester Master/Data Science in the Life Sciences/Project/multimir_results.xlsx"
write_xlsx(targets, path = excel_file )
# Write the "targets" data to an Excel file with the specified file path.
write_xlsx(targets, path = excel_file)
# Read data from the "multimir_results_cyto.xlsx" file into the "df" variable.
df <- read_excel("C:/Users/Emre/Desktop/multimir_results_cyto.xlsx") df <- read_excel("C:/Users/Emre/Desktop/multimir_results_cyto.xlsx")
# Read data from the "mRNAs.xlsx" file into the "mrna" variable.
mrna <- read_excel("C:/Users/Emre/Desktop/mRNAs.xlsx") mrna <- read_excel("C:/Users/Emre/Desktop/mRNAs.xlsx")
# Extract the external gene names from the "mrna" data and store them in the "mrna_genes" variable.
mrna_genes <- mrna$external_gene_name mrna_genes <- mrna$external_gene_name
# Filter the "df" data based on whether the "target_symbol" column contains gene names present in the "mrna_genes" variable.
filtered_df <- df[df$target_symbol %in% mrna_genes | duplicated(df$target_symbol) %in% mrna_genes, ] filtered_df <- df[df$target_symbol %in% mrna_genes | duplicated(df$target_symbol) %in% mrna_genes, ]
# Print the filtered data.
print(filtered_df) print(filtered_df)
output_file <- ("C:/Users/Emre/Desktop/cytoscape.xlsx") # Specify the output Excel file path where the filtered data will be saved.
output_file <- "C:/Users/Emre/Desktop/cytoscape.xlsx"
# Write the filtered data to an Excel file with the specified file path.
write_xlsx(filtered_df, output_file) write_xlsx(filtered_df, output_file)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment