Convert R script to python(implementation of the UPGMA OR neighbor joining algorithm and test successfully on at least a small size distance matrix)
0
0
Entering edit mode
4.0 years ago
anasjamshed ▴ 140

We have MAF file for alignment which need to be converted.

The MAF file was converted into .fasta format for handling with ease in the R. This step was performed in the GALAXY server by using “MAF into FASTA”. The exported file was concatenated into a single sequence which represents a single specie. The alignment file which generated included the whole genome sequence of 54 species and small alignment file was also obtained that included only the sequences of top 5 species

R Script :

#Loading the required libraries
library(ape) 
library(phangorn) 
library(seqinr)

#Importing the required file 
align_5 <- read.alignment("C:/Users/VAMSI/align 5.fasta", format = "fast") 
align_119 <- read.alignment("C:/Users/VAMSI/align 119.fasta", format = "fasta")
Computing the distance matrix for both UPGMA and NJ algorithms implementation.
 matrix_5x5 <- dist.alignment(align_5, matrix = "identity") 
summary(matrix_5x5)

matrix_119x119 <- dist.alignment(align_119, matrix = "identity") 
summary(matrix_119x119)

#Implementation of UPGMA algorithm for a small matrix (5x5) and entire matrix (119x119) 
UPGMA_5x5 <- upgma(matrix_5x5) 
UPGMA_119x119 <- upgma(matrix_119x119) 
summary(UPGMA_5x5)

summary(UPGMA_119x119)

#Implementation of NJ algorithm for a small matrix (5x5) and entire matrix (119x119) 
NJ_5x5 <- NJ(matrix_5x5) 
NJ_119x119 <- NJ(matrix_119x119) 
summary(NJ_5x5)

summary(NJ_119x119)

I have done this whole analysis but don't know how can I do the same analysis through python

Can anyone help me plz?

R python • 1.6k views
ADD COMMENT
0
Entering edit mode

A couple of notes:

  1. Do not use unprofessional abbreviations like "plz". This sort of SMS/IM jargon is bad etiquette in professional forums.
  2. Please use the formatting bar (especially the code option) to present your post better. You can use backticks for inline code (`text` becomes text), or select a chunk of text and use the highlighted button to format it as a code block. I've done it for you this time.
    code_formatting
ADD REPLY
0
Entering edit mode

thanks for informing me

ADD REPLY
0
Entering edit mode

Why would you want to change code that works into another language?

ADD REPLY

Login before adding your answer.

Traffic: 1061 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6