gene_x 0 like s 396 view s
Tags: processing, bash
There are many command-line tools and utilities that can be useful in bioinformatics for quick data processing, analysis, and manipulation. Some of these oneliner tools include:
awk: A versatile text processing tool that can be used to filter, reformat, and transform data.
awk '{print $1}' input.txt
sed: A stream editor for filtering and transforming text.
sed 's/A/T/g' input.txt > output.txt
grep: A tool to search for patterns in text files.
grep "ATG" input.fasta
sort: Sorts lines in a text file.
sort input.txt > sorted_input.txt
uniq: Removes duplicate lines from a sorted file or displays the number of occurrences of each line.
uniq -c input.txt > unique_counts.txt
wc: Counts lines, words, and characters in a file.
wc -l input.txt
cut: Removes sections from each line of a file.
cut -f1,3 input.txt > output.txt
paste: Joins corresponding lines of multiple files.
paste file1.txt file2.txt > combined.txt
tr: Translates or deletes characters.
tr 'atcg' 'TAGC' < input.txt > output.txt
curl: Transfers data from or to a server.
curl -O "https://example.com/file.fasta"
bioawk: An extension of awk with built-in functions for biological data.
bioawk -c fastx '{print $name, length($seq)}' input.fasta
seqkit: A cross-platform toolkit for FASTA/Q file manipulation.
seqkit stat input.fasta
Samtools is a widely-used suite of tools for manipulating and analyzing high-throughput sequencing (HTS) data in the SAM, BAM, and CRAM formats. Here are some examples of how you can use Samtools for various tasks:
Convert SAM to BAM format: To convert a SAM (Sequence Alignment/Map) file to a compressed binary BAM (Binary Alignment/Map) file, you can use the samtools view command with the -bS option: samtools view -bS input.sam > output.bam
Sort a BAM file: To sort a BAM file by genomic coordinates, you can use the samtools sort command: samtools sort input.bam -o sorted_output.bam
Index a sorted BAM file: To create an index for a sorted BAM file, which allows you to quickly access alignments overlapping particular genomic regions, you can use the samtools index command:
samtools index sorted_output.bam
Generate an alignment statistics report: To create a summary report of alignment statistics, such as the number of mapped and unmapped reads, you can use the samtools flagstat command:
samtools flagstat input.bam > report.txt
Extract reads aligned to a specific region: To extract reads aligned to a specific genomic region, you can use the samtools view command with the -h option and the region of interest:
samtools view -h input.bam chr1:10000-20000 > region_output.bam
Filter alignments: To filter alignments based on specific criteria, such as minimum mapping quality, you can use the samtools view command with the -q option:
samtools view -q 20 input.bam > filtered_output.bam
Generate a pileup: To create a pileup file from a BAM file, which displays the sequencing depth at each position of the reference genome, you can use the samtools mpileup command:
samtools mpileup -f reference.fasta input.bam > output.pileup
Bcftools is a set of utilities for variant calling and manipulating VCF (Variant Call Format) and BCF (Binary Call Format) files. Here are some examples of how you can use Bcftools for various tasks:
Call variants: To call variants from a BAM or CRAM file using the consensus caller, you can use the bcftools mpileup command followed by bcftools call:
bcftools mpileup -Ou -f reference.fasta input.bam | bcftools call -mv -Ov -o output.vcf
Filter variants: To filter variants based on specific criteria, such as quality or depth, you can use the bcftools filter command:
bcftools filter -i 'QUAL > 20 && DP > 10' input.vcf -o filtered_output.vcf
View VCF/BCF file: To view the contents of a VCF or BCF file, you can use the bcftools view command:
bcftools view input.vcf
Sort a VCF file: To sort a VCF file by genomic coordinates, you can use the bcftools sort command:
bcftools sort input.vcf -o sorted_output.vcf
Index a VCF file: To create an index for a VCF or BCF file, which allows you to quickly access variants overlapping specific genomic regions, you can use the bcftools index command:
bcftools index sorted_output.vcf
Concatenate multiple VCF files: To concatenate multiple VCF files, ensuring that they have the same sample columns in the same order, you can use the bcftools concat command:
bcftools concat input1.vcf input2.vcf -o combined_output.vcf
Generate consensus sequences: To create consensus sequences by applying VCF variants to a reference genome, you can use the bcftools consensus command:
bcftools consensus -f reference.fasta input.vcf.gz > consensus.fasta
Normalize indels: To normalize indels in a VCF file (left-align and trim indels), you can use the bcftools norm command:
bcftools norm -f reference.fasta input.vcf -o normalized_output.vcf
Bedtools is a powerful suite of tools for working with genomic intervals in various file formats, such as BED, GFF/GTF, and VCF. Here are some examples of how you can use Bedtools for various tasks:
Intersect intervals: To find overlapping intervals between two files, you can use the bedtools intersect command:
bedtools intersect -a input1.bed -b input2.bed > output.bed
Merge intervals: To merge overlapping or adjacent intervals in a single file, you can use the bedtools merge command:
bedtools merge -i input.bed > output.bed
Subtract intervals: To subtract intervals in one file from another, you can use the bedtools subtract command:
bedtools subtract -a input1.bed -b input2.bed > output.bed
Get genomic sequences: To extract sequences from a reference genome corresponding to intervals in a BED file, you can use the bedtools getfasta command:
bedtools getfasta -fi reference.fasta -bed input.bed -fo output.fasta
Sort intervals: To sort genomic intervals by chromosome and start position, you can use the bedtools sort command:
bedtools sort -i input.bed > sorted_output.bed
Calculate coverage: To compute the depth at each position or the depth for each interval in a BED file, you can use the bedtools coverage command:
bedtools coverage -a input1.bed -b input2.bed > output.bed
Find closest features: To find the closest feature in another file for each feature in a BED file, you can use the bedtools closest command:
bedtools closest -a input1.bed -b input2.bed > output.bed
Compute statistics: To calculate various summary statistics for each feature in a BED file, such as the mean, median, or standard deviation of scores, you can use the bedtools groupby command:
bedtools groupby -i input.bed -g 1 -c 5 -o mean,median,stdev > output.bed
You can often combine these tools using pipes (|) to create powerful oneliners for complex data processing tasks.
~~END~~
点赞本文的读者
还没有人对此文章表态
没有评论
RNA-seq data analysis of Yersinia on GRCh38
Yops (Yersinia outer proteins) analysis 2
GAMOLA2 pre- and postprocessing
Variant Calling for Herpes Simplex Virus 1 from Patient Sample Using Capture Probe Sequencing
© 2023 XGenes.com Impressum