Lectura de ficheros .csv
import os
os.chdir('/Users/diego/Documents/test/facta_example/')
print (os.getcwd())
import pandas as pd
file_csv = pd.read_csv('list_groups.csv', delimiter=";")
file_csv
file_csv.describe()
cell = file_csv.loc[1, ['family']].values[0]
cell
Escritura de ficheros .csv
data.to_csv('nombre_fichero.csv')
Lectura de ficheros .fna ( formato fasta)
import os;
os.chdir('/Users/diego/Documents/test/facta_example/')
print (os.getcwd())
for record in SeqIO.parse("fichero2.fna", "fasta"):
print(record.seq)
for record in SeqIO.parse("fichero2.fna", "fasta"):
print(record.description)
Lectura masiva de ficheros .fna.gz ( formato fasta comprimido)
import glob, pprint
genomes = glob.glob('../viral/*.fna.gz')
genomes = list(sorted(genomes))
pprint.pprint(genomes)
# ! pip install screed
import screed
for g in genomes:
for record in screed.open(g):
print(record.sequence[:5])
Lectura de ficheros .txt desde URL
import urllib.request as p
path=p.urlopen('http://humanstxt.org/humans.txt')
fileFinal=path.read()
fileFinal
Lectura de ficheros .pdb desde URL
import urllib.request as p
path=p.urlopen('http://files.rcsb.org/download/101m.pdb')
fileFinal=path.read()
fileFinal
0 comentarios