How to use Python for analyzing a FASTA Bioinformatics file

def readGenomeFromFasta(file_genome): genome='' withopen(file_genome, 'r') as new_file_1: for line in new_file_1.readlines(): if not line[0] == '>': genome += line.rstrip() return genome return len(genome)
print ("Type filename") file_genome= input("> ") input_file=open(file_genome, 'r') print ("Type output filename for genome") output_file= input("> ") out_file = open(output_file, 'w') final_file = readGenomeFromFasta(file_genome)#1 out_file.write(final_file)
def new_list_for_index(genome): """Return a new list that has all the same index as of the main new_ref""" new_list=[] for idx in genome: new_index=[1] new_list.append(new_index return new_listprint ("type name of marker file you want to output index data into") marker_index= input ("> ") markerIndex=open(marker_index, 'w')markerIdx=new_list_for_index(readGenomeFromFasta(file_genome)) markerIndex.write(str(markerIdx))

--

--

--

Data Scientist and Full-Stack Engineer. Working towards building my genomics data-delivery and ag-tech company.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Cudos Update!

How to always have a responsive website. A basic step by step

Scala 3: Universal Apply Methods

Project #2: Simple I/O — Making a Traffic Light Model.

MetaPax — in vision the future

Badgile — The Horror Stories of Agile Gone Wrong

20 Basic Linux Commands for Beginners!

HTTPS LAYER 7 Load Balancing on Google Cloud with Cloud CDN

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ananya Mukherjee

Ananya Mukherjee

Data Scientist and Full-Stack Engineer. Working towards building my genomics data-delivery and ag-tech company.

More from Medium

Python — JSONDecodeError

Sorting Algorithms in Python — Quicksort

How to setup PySpark on Windows?

Virtual environment for Python in Visual Studio Code?