Questions tagged [bash]

Use this tag to refer to the questions related to the Linux and Unix shell abbreviated as bash (Bourne Again SHell). It has notable programmatic strengths over C shell (csh) and touch C shell (tcsh)

Filter by
Sorted by
Tagged with
8
votes
3answers
3k views

What is a quick way to find the reverse complement in bash

I have a DNA sequence for which I would like to quickly find the reverse complement. Is there a quick way of doing this on the bash command line using only GNU tools?
6
votes
4answers
5k views

Bash scripting FastQC for multiple fastq files in multiple directories

I am completely new to bioinformatics so I'm looking to learn how to do this. I have multiple directories with fastq files: E.g; 10 Directories with each time series, each with Treatment and control ...
5
votes
3answers
498 views

Removing duplicate FASTA sequences based on headers with Bash

I used the following command to remove duplicate FASTA sequences based on the header sequence: ...
5
votes
2answers
1k views

BAM to gene expression matrix (UMI counts per gene per cell),10X

I am trying to reproduce some results of a scRNASeq experiment. However I am new to the server-side aspect of such analyses and am very confused at the moment. The data provided by the authors of the ...
5
votes
2answers
3k views

Sort vcf by contig and position within contig

Due to tabix constraints, I need to sort a vcf so that contigs and then positions within contigs occur in numerical order in the vcf. I don't know if the following will sort positions within contigs, ...
4
votes
1answer
3k views

Calculating average coverage for .bam files (sequence data)

(Full discolosure that this is my first time working with sequence data, and with the bash scripting.) I need to calculate the average coverage for any .bam file. After some searching I wrote the ...
4
votes
2answers
292 views

How to align output of grep --color=always? (To QC fasta/fastq files)

Grepping out short sequences from a fasta or fastq file is a really useful way to look at sequencing data. Using the option --color=always makes this even more ...
4
votes
1answer
345 views

Error given while trying to index a BAM file with Samtools Index - NO COOR?

I am currently working on my own Metagenomic pipeline, utilizing Bowtie 2 to map. Bowtie 2 outputs a SAM file, which I convert to a .BAM and sort it using Samtools. When I try to utilize Samtools to ...
3
votes
2answers
193 views

How to subset genes and its nested features from a GFF file using a gene list

I would like to subset a GFF file (gene and nested features) from a gene list. The GFF file looks like this ...
3
votes
3answers
98 views

How to get the product of a CDS

I need the name of the protein in /product="protein_name" using bash commands. Beware, there is a lot of whitespace between lines. ...
3
votes
1answer
1k views

Running htseq-count over BAM files

I am trying to derive an expression matrix from BAM files using htseq-count. These are bulk RNASeq BAM's by the way. I have read the ...
2
votes
2answers
5k views

How to merge .fastq.qz files into a single .fastq.gz with their same id without losing any content in parallel

I have a large number of .fastq.gz files of different lane and reads. I have to merge them each reads group files into single .fastq.gz files. **eg: 1st type NA24694_GCCAAT_L001_R1_001.fastq.gz ...
2
votes
2answers
105 views

How to get rows with similar values in two different columns using command line?

I have following example data from a large file. ...
2
votes
3answers
156 views

Replace lowercase characters with -

I have an output from vcfutils.pl vcf2fq with specified minimal depth, and it means that nucleotides with not enough depth are lowercase. I would like to change them to gaps. I could do it in higher ...
2
votes
2answers
570 views

how to remove range from fasta header

Could you please suggest me how I can remove range from fasta header:like these number from below sequences which has some colons indicating the range of the genome :147010-147657 :149201-149845 <...
2
votes
5answers
548 views

How to measure the total size of a fastq file in base pairs?

Or Kbps/Gbps. It feels like it should be conceptually very simple, but I can't seem to figure out the right combination of keywords to find it via my search engine. Help would be appreciated! I have ...
2
votes
2answers
709 views

Error with BWA Mem input having multiple fastq files using cat and process substitution

Running BWA Mem on a number of paired end fastq files using process substitution on the inputs results in this error: ...
2
votes
2answers
56 views

Moving file based on their names

I have a list of vcf files; I also have a list of names in a txt file like LP6005409-DNA_F01 LP2000325-DNA_A01 LP6005409-DNA_E02 LP6005500-DNA_C03 What I have in ...
2
votes
2answers
39 views

Calling for one specific SNP from multiple sequencing runs

Just learning the basics of bioinformatics and bash shell scripting. Is there a correct way to search for a specific allele with one or even multiple sequencing runs? I am searching for prevalence of ...
2
votes
1answer
64 views

Pattern mining from a genomic sequence

I need to find the following pattern from a genomic sequence ...
2
votes
1answer
305 views

How to edit the headers of multiple fasta files from multiple folders?

My directories are organized as follows: one main directory, in which I have multiple directories that end with a number ranging from 314 to 727, followed by .3 . For example, 'mgm4761314.3'. Within ...
2
votes
1answer
60 views

Merging several fq.gz files or R1 and R2 classes into a single one

I have the following files: ...
2
votes
2answers
296 views

Filter reads belonging to unique sequences with threshold

I have CLL samples as fastq files and I want to remove those reads which have a unique sequence with less than 10 read counts each. I tried this by following way using awk to make it faster: ...
2
votes
1answer
38 views

Automatize classical debugging in a bash script? (normal debugging by hand)

And thanks in advance. I am debugging a text file which is the one the two inputs on the program RGmatch https://bitbucket.org/pfurio/rgmatch/src/master/. The code works. Is that some records give ...
2
votes
2answers
98 views

How to remove sequences from a fasta file using a sequence ID list which contains a space within the id?

I have a fasta file that contains sequence reads and sequence id file that needed to be removed from the fasta file. I have done this earlier, but since id contains a space my piece of code is not ...
2
votes
0answers
256 views

Cannot blast against specific NCBI databases

I am having issues with some prokaryote reference genome databases (exact names : ref_prok_rep_genomes.*), that I downloaded from the NCBI website : https://ftp.ncbi.nlm.nih.gov/blast/db/. Files in ...
1
vote
4answers
2k views

Edit FASTA header using sed

I need to rename the following headers from a FASTA file. Something like: ...
1
vote
2answers
129 views

How can I run a command for multiple files?

I have a bunch of .vcf files in a folder and I want to run command below on all of them but doing that one by one manually is really painful. I am seeking for a way ...
1
vote
2answers
85 views

How to extract values from second file on the basis common first column?

File1: ENST00000000233 ARF5 ENST00000000412 M6PR ENST00000001008 FKBP4 ENST00000001146 CYP26B1 ENST00000002501 DBNDD1 ENST00000002596 HS3ST1 File 2: ...
1
vote
3answers
54 views

How to filter out partially similar strings from two lists and make one list?

I have following two lists. List1 ...
1
vote
2answers
222 views

Trying to create a .bam file without the need for a .sam file

I'm trying to use the code specified in this link to create a .bam file without the need for a .sam file. Here is the code I'm using: ...
1
vote
2answers
82 views

Using preprocessing/alignment functions on the server

I am new to bash and the processes behind cluster computing in general and need some help with understanding some basics. After looking all over the internet and this forum (+ askUbuntu) I found ...
1
vote
2answers
29 views

Is there a way to calculate the Ka/Ks value in R/unix?

I am investigating the rate of synonymous non synonymous substitutions and would like to find the Ka/Ks value also known as dn and ds between multiple alleles? I want to investigate multiple alleles ...
1
vote
2answers
44 views

Trying to divide number in fourth TSV column by a certain number according to its corresponding identifier in the first column

I was wondering if anyone could help with my little issue in manipulating tsv files in order to calculate estimated coverage across many tsv files. I have tsv files that look something like this: <...
1
vote
2answers
137 views

MiXCR: only create a single export file for all clonotypes

I am using following command from MiXCR to both align, assemble and export my input files: ...
1
vote
2answers
73 views

Retain only part of a file name and fasta header in fasta directory

I have a MainDirectory/hundreds_of_subdirectories/thousands_of_fastas structure. For each fasta in the bottom level, I am trying to change the file name as well as ...
1
vote
1answer
58 views

how to sort and join two files based on First Column Id

I have got two files large files like this in Tab-delimited format, trying to merge in R, do we need to sort the file before merging? ...
1
vote
2answers
192 views

How to run Jupyter script on Slurm HPC

Now jupyter installed on the server and I am using below code to plot the rarefaction plot but I am still getting some error. could you please suggest how I can get rid of it? ...
1
vote
1answer
222 views

Split fasta file based on groups in header information and output as separate files

I have a fasta file containing the sequence of a gene across different species. In total there are around 900 samples and 12 species. (Each sequences is over multiple lines and longer than 100bp.) My ...
1
vote
1answer
38 views

Running tophat dockerfile in background

I need to use tophat2 to align some sequences, and I wish to use the docker container. These are large sequences so it will take a long time, plus I'm working on a university server so the chances of ...
1
vote
1answer
77 views

Multi-line efetch digging

I'm using efetch to dig out a middle "envelope" protein within a viral genome specifically within fasta format. The code below works but may not be robust for an entire database. Thus I want ...
1
vote
1answer
46 views

Table error when combining counts columns

I have these files that I want to make table of (https://github.com/learnseq/RNAseqfiles01.git), the table that I want (since all the files have the same ID column),, I want merge the ID column with ...
1
vote
2answers
121 views

Mapping statistics from bam file using bbtools and sambamba

Below are the statistics for RNA-seq mapped and unmapped paired-end reads to rice genome using reformat.sh from bbtools on bam files. It gives 77% mapped and 5% unmapped, what about the remaining 18% ...
1
vote
1answer
613 views

remove sequences from fasta file matching a string in the header

I have a file with 16S sequences. some headers contain species information. For my purposes I would like to exclude a number of species from the file, therefore I would like to do a pattern matching ...
1
vote
1answer
51 views

Fastq-dump script download X spots or all

Im trying to write a script where an optional input of -X flag can be used, or if that info is not available download all reads. my script as follow: ...
1
vote
2answers
402 views

processing fastq files using cellranger on linux

I am trying to perform a cellranger count on fastq files generated from a 10x genomics single cell RNA Seq run. Just to provide some background, I ssh’d into the AWS using our AWS IP with MobaXTerm ...
1
vote
0answers
15 views

Nucleotide Frequency - HOMER?

I'm trying to find the frequency of UA dinucleotide in a bed file. I want to convert the bed file to FASTA, count all the UA dinucleotides up, then divide by the total length of the FASTA file. Also, ...
1
vote
0answers
43 views

How to calculate GenePy score for vcf files in all subdirectories?

In a parent directory, I have several sub-directories, each of them contain one .vcf.gz file on which analysis should be performed. I want to run following commands on all .vcf.gz files in all ...
1
vote
1answer
515 views

Extract certain fields using from GenBank file using Bash script

I need to extract certain lines from a GenBank file on Linux. Input file: ...
0
votes
2answers
117 views

Changing this code in a way to work for my files

I have a bash script which extracts some information from a .vcf file but one .vcf file at each time. How I can change this script in a way to work on a bunch of .vcf files and the output is a .txt ...