r

Error – cannot install Miniconda with RStudio

Error – cannot install Miniconda with RStudio Question: I have written a R script where I use some python lines through the reticulate package. I need to share it with some colleagues who don’t know about programming and I’ve created a batch file so I can run it without them even opening R. However, I …

Total answers: 1

Replace portion of fasta headers

Replace portion of fasta headers Question: I would like to replace a portion of the headers in a fasta file (surrounded by _) using a text file with a key. #fasta file: >mir-2_scf7180000350313_41896 CCATCAGAGTGGTTGTGATGTGGTGCTATTGATTCATATCACAGCCAGCTTTGATGAG >mir-92a-2_scf7180000349939_17298 AGGTGGGGATGGGGGCAATATTTGTGAATGATTAAATTCAAATTGCACTTGTCCCGGCCTGC >mir-279a_scf7180000350374_48557 AATGAGTGGCGGTCTAGTGCACGGTCGATAAAGTTGTGACTAGATCCACACTCATTAAG #key_file.txt scf7180000350313 NW_011929472.1 scf7180000349939 NW_011929473.1 scf7180000350374 NW_011929474.1 #expected result >mir-2_NW_011929472.1_41896 CCATCAGAGTGGTTGTGATGTGGTGCTATTGATTCATATCACAGCCAGCTTTGATGAG >mir-92a-2_NW_011929473.1_17298 AGGTGGGGATGGGGGCAATATTTGTGAATGATTAAATTCAAATTGCACTTGTCCCGGCCTGC >mir-279a_NW_011929474.1_48557 AATGAGTGGCGGTCTAGTGCACGGTCGATAAAGTTGTGACTAGATCCACACTCATTAAG Asked By: …

Total answers: 2

Pivoting DataFrame in Python Pandas

Pivoting DataFrame in Python Pandas Question: I’m trying to pivot my df from wide to long, and I am attempting to replicate R’s dplyr::pivot_longer() function. I have tried pd.wide_to_long() and pd.melt() but have had no success in correctly formatting the df. I also attempted using df.pivot() and come to the same conclusion. Here is what …

Total answers: 1

How to visualize a Pandas Dataframe in R chunk Quarto?

How to visualize a Pandas Dataframe in R chunk Quarto? Question: I was wondering if there is an option to use a Pandas dataframe created in a Python chunk, in your R chunk to visualize the dataframe. Here is some reproducible code: — title: "How to use Pandas Dataframe in R chunk" format: html engine: …

Total answers: 1

Comparing two dataframes of different lengths

Comparing two dataframes of different lengths Question: I have 2 dataframes of different lengths – len(df1) = 2400 len(df2) = 100 df1 => colA colB colC 0 1 2 3 4 5 6 7 8 . . . 2400 rows. df2 (number of rows is a factor (1/24) of num_rows in df1) => colD colE …

Total answers: 1

How to create a histogram from counts with bins spaced every 0.1

How to create a histogram from counts with bins spaced every 0.1 Question: I have the following dataframe: df = {‘count1’: [2.2336, 2.2454, 2.2538, 2.2716999999999996, 2.2798000000000003, 2.2843, 2.2906, 2.2969, 2.3223000000000003, 2.3282, 2.3356999999999997, 2.3544, 2.3651999999999997, 2.3727, 2.3775, 2.3823000000000003, 2.392, 2.4051, 2.4092, 2.4133, 2.4168000000000003, 2.4175, 2.4209, 2.4392, 2.4476, 2.456, 2.461, 2.4723, 2.4776, 2.4882, 2.4989, 2.5095, 2.5221999999999998, 2.5318, …

Total answers: 1

How to generate one hot encoding for DNA sequences using R or python

How to generate one hot encoding for DNA sequences using R or python Question: I want to generate one hot coding matrix for a list of DNA sequences. I have tried to solve my problem from the following link How to generate one hot encoding for DNA sequences? but some of the solutions are given …

Total answers: 5

How can I rewrite R code with tilde operator to Python Pandas?

How can I rewrite R code with tilde operator to Python Pandas? Question: I have this code in R: boxplot(ToothGrowth$len ~ ToothGrowth$supp, main = "Tooth growth in Guinea Pig", xlab = "Delivery method", ylab = "Tooth length") I know that the tilde operator in R means the relationship between the dependent and independent variables, in …

Total answers: 2