Search this site
Embedded Files
Metagenomics
  • Metagenomics
    • Taxonomy
      • Alpha and beta diversity
      • Strain level
      • Pangenome
      • Marker genes
        • MLST
      • 16S
        • Operational taxonomic unit (OTU)
        • 16s vs shotgun
    • Phylogeny
      • Horizontal gene transfer (HGT)
      • Lowest Common Ancestor (LCA)
      • Long branch attraction (LBA)
    • Evolution
    • Ecosystem
      • Environmental gene tags (EGTs)
      • Soil metagenomics
    • Metatranscriptomics
      • RNA-seq versus microarray
    • QC
      • Coverage depth
      • Sampling depth
        • Calculate sampling depth
      • RPKM calculation
      • Phred score (Q score)
      • Giga base pairs
      • GC content
    • Wiki
      • Microbiome
      • Orthologs and paralogs
      • Short read mapping
      • Fecal microbiota transplant
      • DNA sequencing library
      • Multiplex sequencing
      • x
      • x
      • x
      • x
        • x
      • x
      • x
      • x
  • Tools
    • 16S tools
      • DADA2
        • Conda environment
          • Segmentation fault
      • Normalization
        • CSS
      • QIIME
        • Alpha & Beta diversity
        • Install QIIME 1
          • AttributeError:axisbg
          • biom error
          • Greengenes
          • h5py BIOM error
          • PackagesNotFoundError
          • qiime_config
          • R for QIIME
          • usearch61
        • OTU biom table
          • QIIME: split OTU table
          • ValueError column index exceeds matrix dimensions
        • QIIME mapfile
        • QIIME OTU clustering
          • Error running usearch61
          • Fungi 18S
          • IOError Errno 28 No space left on device
          • SILVA
        • QIIME pre-processing
          • Cannot find fastq-join
          • join-error
          • split-error
        • Taxonomy
        • Test statistics
    • Assembly
      • Contigs
      • N50 statistics
      • MEGAHIT
    • BLAST
      • BLAST error: Too many positional arguments
      • BLAST word-size
      • BLASTn output format 6
      • BLASTx
      • E-value & Bit-score
      • FastANI
        • Install FastANI
          • Install autoconf
          • Install GLS
      • Generate_database
        • Public sequences
      • Install BLAST
      • megablast
    • Bowtie2
      • Create bowtie2 index
      • Install bowtie2
        • libtbb.so.2
        • Segmentation fault
    • Genome
      • Prokka
    • Pathogen screening
    • Phylogenetic tree
      • File format
      • Sequence-Alignment
        • Alignment viewer
      • Tree-construction
        • FastTree
        • RAxML
          • Add bipartition
          • Install RAxML
      • Tree-viewer
        • Forester
          • Java error
    • SAMtools
      • BCFtools
      • Consensus sequence
      • Converting BAM to fastq
      • Error
        • Could not parse the header line
        • different line length in sequence
      • Install
        • Error curses.h
      • Number of reads in bam file
      • SAM file format
      • SAMtools: get breadth of coverage
    • Sequence data
      • Convert fastq to fasta
      • Extract sequence subset
      • Get random subset
      • Multi-FASTA format
      • NCBI ftp genome download
        • gff to ffn
    • Shotgun sequencing
      • Alignment
        • Viewer
          • Tablet
      • Data
      • NCBI SRA files
        • Install SRA-tools
        • prefetch
        • Error
          • path not found while resolving tree within virtual file system module
        • wget download
        • old fastq-dump
      • Quality control
        • Trim Galore
      • Remove host sequences
      • Remove too short reads from fastq files
      • Fastq file format
    • Ubuntu Linux
      • awk
      • bzip2
      • Extract columns from file
      • File properties
      • gzip & tar.gz
      • Loop over list of files
        • find
        • if greater than
        • String split
      • Rename multiple files
      • rsync
      • sed
      • Shell stderr redirect
      • Show disk space usage
      • Split large file
      • Data tables
        • Transpose table
        • Sorting
    • HPC SGE cluster
      • Submit job
      • Check cluster nodes
Metagenomics

gzip & tar.gz

Ubuntu - Command Line Tools

Ubuntu / Linux

Decompression

.zip

# decompress   .zip  folder (as used in Windows)

unzip samples.zip

.gz

# decompress  .gz  file (compressed .gz file will be removed after decompression)

gzip -d sample.fastq.gz

  sample.fastq

# view the content of a .gz file

zcat sample.fastq.gz

# view top 20 line  - pass decompressed content via unix pipe to head command

zcat sample.fastq.gz | head -20 

.tar.gz

# tar   decompress .tar.gz files

tar -zxvf samples.tar.gz

# unix pipe  pass decompressed file into a pipe: extract all tar archive files to standard output (option -O)

tar -zxOf samples.tar.gz | head -20   # views the first 20 lines

Compression

Compress a single file

# compress single file as file.gz using gzip (original file will be removed after compression)

gzip sample.fastq

 sample.fastq.gz

Compress complete directory

# compress complete folder as tar.gz archive (recommended standard for working with Ubuntu/Linux)

tar -zcvf samples_compressed.tar.gz /path/to/sample/directory/

# compress a complete folder as single zip file for using in Windows (not gzip)

zip -r samples.zip sample_folder/

# to change gzip level used in tar archive (default compression level is 6, max level is 9)

# a) providing the compression command by option -I

tar -I 'gzip -9' -cvf samples_compressed.tar.gz sample_directory/

# b) combine tar and gzip using a unix pipe

tar cvf - sample_directory/  | gzip -9 > samples_compressed.tar.gz

Extract single file from tar archive

# list content (all files) of a .tar.gz archive

tar -tf samples.tar.gz

  sample_1.fastq

  sample_2.fastq

# extract selected file from .tar.gz archive

tar -zxvf samples.tar.gz sample_1.fastq

  sample_1.fastq

# extract selected folder from .tar.gz archive

tar -zxvf samples.tar.gz  data/projectA/fastq/

  data/projectA/fastq/sample_R1.fastq

  data/projectA/fastq/sample_R2.fastq


Install zip and unzip

sudo apt install zip unzip

see also

 → www.gzip.org

 → bzip2

How to combine multiple files into an tar archive file (Indiana University)

https://kb.iu.edu/d/acfi

www.metagenomics.wiki

Author: Matthias Scholz

Google Sites
Report abuse
Page details
Page updated
Google Sites
Report abuse