Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Sebastian_Quezada_R
    Junior Member
    • Aug 2016
    • 8

    How can I delete these lines?

    Hi guys =) I'm sorry if this is a repeat but I haven't been able to find an answer using the search field or google.

    I am trying to edit a fastq file that has a corrupt line. The read in question is VH00362:5:AAAV5KTHV:1:1210:64850:6869 where the read is just a massive repeat – not the expected 110bp. I am trying to remove two lines from this file and asking around I've been told to use `sed` as in

    ```gzip -c file.fastq.gz | sed "45500973,45500974d" > new.fastq.gz```

    but when I run `wc -l ` to check the number of lines the results are incoherent, as if it has deleted much more than the two lines I asked. Another issue that I'm seeing with this file is that every time I run `gzip` I get a `invalid compressed data--format violated` error, which tells me the file is corrupted but I'm doing my best to salvage whatever I can from the file as it is an irreplaceable sample.

    Is there another way to simply delete these two lines? Any tool or command you could recommend? Any help is deeply appreciated.​
  • fchatonnet
    Member
    • Sep 2014
    • 30

    #2
    Dear Sebastian,

    I see several issues in your post:

    - first of all if you want to remove a entire read from a fastq file, you have to remove 4 lines and not only 2, because the base qualities are also encoded in the file (see here for a description of the fastq format: FASTQ format - Wikipedia​).

    -
    Code:
     gzip -c file
    will compress your file (and keep the original file uncompressed) rather than decompress it, you may want to use
    Code:
     gzip -d file
    or
    Code:
     gunzip file
    to decompress a file. That may be the reason why you get the "compressed data--format violated" error.

    - The 'sed' command should be written with single quotation mark like this:
    Code:
     sed '45500973,45500974d'
    So your editing command might be
    Code:
     sed '45500973,45500976' file.fastq
    - finally, you pipe your 'sed' result directly into a compressed file, with no use of gzip, which will not provide you with a compressed file.
    I would rather perform the decompression and compression steps separately from the editing as the piping can sometimes lead to issues.

    Hope that'll help and good luck!

    Comment

    Latest Articles

    Collapse

    • SEQadmin2
      From Collection to Sequencing: Why Sample Preparation and Preservation Define Sequencing Data
      by SEQadmin2


      Data variability is still an issue in sequencing technologies despite the advances in reproducibility and accuracy of these platforms. But the problem does not originate in the sequencing itself, but in the previous steps, before the sample reaches the sequencer.


      The first step is collection, followed by preservation and sample preparation for analysis. Most scientists overlook those steps, but not being careful might just be skewing the experiment’s results.
      ...
      06-02-2026, 10:05 AM
    • SEQadmin2
      Single-Cell Sequencing at an Inflection Point: Early Impacts of New Platforms and Emerging Trends
      by SEQadmin2


      With the launch of new single-cell sequencing platforms in 2026, the field stands at an exciting inflection point. This article surveys the most impactful advances in the field and discusses how they’re reshaping research in cancer, immunology, and beyond.


      Introduction

      Single-cell sequencing technologies have undergone remarkable advances over the past decade, transitioning from low-throughput experimental approaches to highly scalable platforms capable of...
      05-22-2026, 06:42 AM
    • SEQadmin2
      Environmental Genomics in the Age of NGS: From Microbes to Conservation Strategies
      by SEQadmin2

      Studying ecosystems means dealing with complex, multi-species communities that are hard to observe at scale. This complexity, however, hides many important questions to be answered, from how biogeochemical cycles work and how climate change can affect species distribution to how conservation strategies can work best.


      Genomics, particularly since the expansion of NGS, has transformed ecosystem ecology. By sequencing environmental DNA, we can now assess biodiversity without direct...
      05-06-2026, 09:04 AM

    ad_right_rmr

    Collapse

    News

    Collapse

    Topics Statistics Last Post
    Started by SEQadmin2, Today, 08:59 AM
    0 responses
    9 views
    0 reactions
    Last Post SEQadmin2  
    Started by SEQadmin2, 06-02-2026, 12:03 PM
    0 responses
    21 views
    0 reactions
    Last Post SEQadmin2  
    Started by SEQadmin2, 06-02-2026, 11:40 AM
    0 responses
    17 views
    0 reactions
    Last Post SEQadmin2  
    Started by SEQadmin2, 05-28-2026, 11:40 AM
    0 responses
    30 views
    0 reactions
    Last Post SEQadmin2  
    Working...