1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Making an empty array WITHOUT overwriting it

Discussão em 'Python' iniciado por Stack, Setembro 28, 2024 às 03:42.

  1. Stack

    Stack Membro Participativo

    I want to add to an array as I would a list from a for loop but to do so I need to create an empty array first and add to it. Every suggestion I've seen on this site makes it so the old array is overwritten by a new array which seems incredibly silly. The file I am pulling form is 150 x 180,000 data points so lists won't cut it. It seems insane that creating an empty array is some impossible task if making a list is so simple.

    This is my code for now but I want to cut the list out of the equation

    from Bio import SeqIO
    from Bio.SeqUtils import gc_fraction
    import matplotlib.pyplot as plt
    import gzip
    import numpy as np
    with gzip.open("data.fastq.gz",'rt') as input_file:
    sio = SeqIO.parse(input_file, "fastq")
    numdata = []
    for r in sio:
    numdata.append(r.letter_annotations['phred_quality'])
    npa = np.array(numdata)
    plt.boxplot(npa,showfliers = False)
    plt.title("Quality Score Boxplot")
    plt.xlabel("Number of Basepairs")
    plt.ylabel("Number of Reads")
    plt.show()

    Continue reading...

Compartilhe esta Página