Skip to content
Snippets Groups Projects
  • yunusek77's avatar
    b1f26f55
    Update 4 files · b1f26f55
    yunusek77 authored
    - /04_Cytoscape/extract_mrna_names_from_mirna.R
    - /04_Cytoscape/extract_mrna_names_from_mirna.Rmd
    - /04_Cytoscape/mRNAs.xlsx
    - /04_Cytoscape/extract.pdf
    b1f26f55
    History
    Update 4 files
    yunusek77 authored
    - /04_Cytoscape/extract_mrna_names_from_mirna.R
    - /04_Cytoscape/extract_mrna_names_from_mirna.Rmd
    - /04_Cytoscape/mRNAs.xlsx
    - /04_Cytoscape/extract.pdf
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
extract_mrna_names_from_mirna.Rmd 1.93 KiB
output:
  pdf_document: default
  html_document: default
# Load required libraries
library(readxl)    # For reading data from Excel files
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")
mirnames <- new_list$miRNA
# 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',
                                 mirna   = mirnames,
                                 table   = 'validated',
                                 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)
targets <- multimir_results@data

#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)
df <- read_excel("C:/Users/Emre/Desktop/multimir_results.xlsx")

#Read data from the "mRNAs.xlsx" file into the "mrna" variable.
mrna <- read_excel("C:/Users/Emre/Desktop/mRNAs.xlsx")
# Extract the mrna names from the table
mrna_genes <-  mrna$mRNA
# 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, ]

# Print the filtered data.
print(filtered_df)