Questions tagged [bioinformatics]

Use this tag for questions relating to common bioinformatics tasks performed on a *nix system. Things like manipulating/converting between standard biological text formats, extracting data of interest from such formats etc.

Filter by
Sorted by
Tagged with
1
vote
3answers
32 views

Bash - Filter rows with a certain proportion of columns occupied

So, I've got a large number of files, each one with 8 columns and a lot of rows. Here's a head from one of them for an example. ID Ct 1 2 3 4 5 ...
6
votes
3answers
180 views

Unix fold command behaving strangely

So I have this fasta (biology) file that looks like this: >m64093_191209_130050/133911/ccs_64 TTCAGGCTGTGTTCCATTTGATTTAAAATCAAATAATTTCATTCGCGTCAGAACACCTGGTTTCACGACC ...
0
votes
6answers
83 views

How can I copy lines from multiple files into one file and name lines as the originated filename

My question is: I have 200 files in fata format. Such as: /User/Bin/bin.0.fa /User/Bin/bin.1.fa ... /User/Bin/bin.200.fa Each .fa file contains a contig name ID and nucleotide characters ...
0
votes
3answers
66 views

awk removing number after decimal

I have an input file with these fields: ENST00000456328.2 1657 1350.015 0 0 I am trying awk to remove the number after the decimal and print the rest as it is awk -F[.] '{print $1"\t"$2"\...
1
vote
3answers
76 views

How can I replace strings in a given column of a table using awk and regex?

I am studying bioinformatics, but I don't have long experience with awk and now I'm stuck. I have a table with 13 columns. In column 9 I have a lot of variations of strings like ELL1-XXXXXXXXX (e.g. ...
0
votes
2answers
72 views

Bash “Join” with two columns

I have two files: 1_file.txt: ChrX 129759713 A G ChrX 129760010 C T ChrX 129762238 C G ChrX 129762448 A G ChrX 129762803 A C ChrX 129763441 C A ChrX 129764931 T C ChrX 129767696 C T ChrX 129818213 C ...
0
votes
0answers
18 views

R packages won't install on conda R environment

I am trying to install an R package to an R environment created through conda on an HPC Server where I am doing some bioinformatics. I tried to run the usual R command (which works and install the ...
0
votes
1answer
26 views

Merging two .csv tables one with header other - not

I need to merge two .csv tables, one that contains the following info with NO HEADER: gene0 ABCD gene1 xyz gene2 1234 ..etc Another table has a header and information like that: gene_id ...
7
votes
9answers
634 views

Extract subsequence corresponding to n:th pattern from a file

I have below data blocks (multiple) chr1.trna4 (17188416-17188486) Length: 71 bp Type: Gly Anticodon: CCC at 33-35 (17188448-17188450) Score: 78.3 HMM Sc=56.60 Sec struct Sc=21.70 * ...
1
vote
2answers
141 views

Comparing two tsv files

I am trying to compare two tsv files. The file to be queried (file1) looks like: Chr Start End chr1 234738546 234738934 chr1 234792654 234793537 chr1 234908151 234908864 chr1 ...
-1
votes
2answers
58 views

Linux & Bash Chromosomes sorting files

I need to combine all the files with genomic data in that particular way. It means it should be sorted first by numbers then alphabetically. The names of files are: Homo_sapiens.GRCh38.dna.chromosome....
3
votes
5answers
96 views

Combine file data, sort on chromosome, position next to each other - column vise

I have multiple files in format: chr position value. I want to combine them in format "chr", "position", "samp1", "samp2", "samp3", "samp4",........ For example: Samp1: chr position value 1 ...
1
vote
3answers
46 views

I need to print the second line on each query in other file

I want to extract the Hit and No Hits ids from the my blast results. for example my blast output contain: > Query= TRINITY_DN109574_c0_g1_i1 Length=277 ***** No hits found ***** Lambda K ...
2
votes
1answer
35 views

bash script to find the results from multiple input files which are using 'samtools' to a new output csv file

I have query related to Bioinformatics. I have multiple bam files, from each bam file i should find out number of mapped reads from each bam file with id's, for doing it i have the command $ ...
0
votes
3answers
54 views

How to create an array of substrings

Say I have a variable, sequence, which is a string. > sequence="AAAGCATATGCTAGCCCGTATAGCGATACTAGCTATACGATATATATGATCAATGCCCGTATAG" I want to create an array, say seq, in which each element is a 3 ...
1
vote
3answers
95 views

Trying to write a script to find ORF from 6 different frames

So basically, you have a sequence, say AAAGCATATGCTAGCCCGTATAGCGATACTAGCTATACGATATATATGATCAATGCCCGTATAG You need to find all the 'ORFs' in the sequence, an ORF is any region that starts with ATG ...
0
votes
1answer
58 views

store `cat` output as a placeholder

I am using a program called minimap for aligning reads to a reference genome (computational biology problem). This program requires as input two files as positional arguments: first a reference in ....
1
vote
2answers
55 views

Loop to run a program using multiple files from different directories

So I am trying to run a program iRep and usually it runs as- iRep -f Bins/10000A-01-01_bin.* -s sam/10000A-01-01.sam.sorted.sam --sort -o 10000A-01-01_iRep_output in sam folder - 10000A-01-01.sam....
0
votes
2answers
28 views

Extracting columns from Fasta file in Linux

I have a fasta file which looks like this >ENST00000632684.1 cdna chromosome:GRCh38:7:142786213:142786224:1 gene:ENSG00000282431.1 gene_biotype:TR_D_gene transcript_biotype:TR_D_gene gene_symbol:...
0
votes
1answer
56 views

awk for column replacement

I need to replace the column 1 of file 1, with column 1 of file 2, when column 1 of file 1 matches with col 5 of file 2. file 1 ENSG00000237491 1 714150 745440 2 1 143562 ...
1
vote
5answers
90 views

Convert columns that share a match to row

I have a file with the following structure: Locus7625186 GO0004866 Locus7625186 GO0010951 Locus7625186 GO0005615 Locus7625186 GO0016021 Locus7360093 GO0004712 Locus7360093 GO0007093 Locus1507198 ...
8
votes
5answers
1k views

Removing rows containing NA in every column

I have a tab delimited file which looks like this: gene v1 v2 v3 v4 g1 NA NA NA NA g2 NA NA 2 3 g3 NA NA NA NA g4 1 2 3 2 The number of fields in every line is fixed and ...
-1
votes
1answer
64 views

find lines containing an exact string

I have a csv file which I am trying to extract only lines with "Ann_Pet.Fal". This is supposed to be very simple by typing grep -w "Ann_Pet.Fal" my.file. Unfortunately it does not work and I get any ...
0
votes
1answer
34 views

How to cut specific lines from tab separated columns?

I have a file (.gff3) that has nine columns separated by tabs. ##gff-version 3 ##other information 0 . mRNA 1300 9000 . + . ID=mrna0001;Name=sonichedgehog 1 . exon 1300 ...
0
votes
5answers
71 views

Keeping the characters between two specific characters in fasta headers and removing the rest

I am trying to keep the characters in my fasta headers between the first and the second colon. I've failed trying with sed and awk since my coding skills are very limited. In: >...
1
vote
3answers
72 views

How to compare column 2 and 3 of File 1 and column 4 and 5 of file 2

I have a tab delimited file 1: NC_025345 4569 4950 KX838946.2 NC_025345 16546 17066 KJ641660.1 NC_025345 11996 12085 KX932454.2 And file 2: NC_025345.1 ...
0
votes
1answer
65 views

Making many symbolic links

I have a file samples_long.20Bids.txt with content like this: P2_305_USD16089489L_HJJNWDSXX_L4 P2_307_USD16089490L_HJNMNDSXX_L3 P2_42_USD16089409L_HJM27DSXX_L1 P2_43_USD16089410L_HJM27DSXX_L1 ...
3
votes
1answer
81 views

How I run these commands at the same time of different files

You please imagine I have 16 separate folders named A1 to A16 inside each of them I have a file named aligned.sorted.bam By these commands I want to convert aligned.sorted.bam to aligned.sam module ...
1
vote
1answer
63 views

“xargs” error regarding mates files vs singles files

I'm currently working with HISAT2 and am trying to use xargs to make my life easier when inputting multiple samples. So I have a text file "samples.txt" which has each sample name separated by spaces-...
3
votes
3answers
92 views

How to grep to extract the previous n characters from a file

I'm trying to extract some data from a file using grep. The file is a DNA fasta file containing lines such as: ATCGTAGCTAGCATCGTATCGATGCTGCTATGCTAGATGCTAGT I need to find every TA and the 20 ...
1
vote
2answers
46 views

extracting organism count with thier corrosponding ID?

I have a file with many column like: ID1 XP_026389348.1_stearoyl-[acyl-carrier-protein]_9-desaturase,_chloroplastic_[Papaver_somniferum] ID2 XP_026389348.1_stearoyl-[acyl-carrier-protein]_9-...
3
votes
3answers
48 views

regex from two files

I have two files that built of blocks of 4 lines, starting with a @. They are matching and in order. The files are too big (>10 GB) so I am putting here the first 3 blocks of each (12 lines). 1st: ...
2
votes
1answer
53 views

compare columns from two different files and PRINT RECORDS FROM FIRST FILE those that DO NOT match from second file

I would like to compare columns from file one to two. Where column 2 of file1 should un-match from column 1 or 2 from file2 and print output from file 1. file1. cat test.head20.R2.fastq.tab @...
0
votes
2answers
90 views

Substituting with awk variables

Basically, I need to make a copy and a substitution of $1 (after cating a file) into sample variable in order to replace it in an address /disk1/ngsep/"$sample"/"$1"_bowtie2_readpos.stats. This is my ...
0
votes
2answers
29 views

Delete everything that isn't between brackets

I want to delete everything that isn't inside brackets, including the brackets, only in lines that start with ">". Is there a sed alternative? Also, would like to sort lines in alphabetical order by ...
0
votes
3answers
70 views

Counting columns in file with table format

I have a file with table format, that looks something like this: abc00000000 1 643301 643374 Ile AAT 0 0 80.6 abc00000000 2 1278112 1278193 Ser GCT 0 0 86.2 abc00000000 ...
0
votes
2answers
42 views

Extract match and everything before next match, do it for every match

I have a file with this structure: >Cluster 0 0 51aa, >MG00HS05:520:C8M1TACXX:3:1101:1428:2080/1... * 1 51aa, >MG00HS05:520:C8M1TACXX:3:1101:1658:2480/1... at 3:51:1:49/96.08% 2 ...
0
votes
2answers
166 views

redirecting `ls` output to another command with xargs

In the directory I am working on I have two files with the extension .sam: PD180425_aligned_minimap.sam PD180793_aligned_minimap.sam For each of these two files, I need to apply a command that looks ...
1
vote
2answers
88 views

How to transpose multiple txt files?

I have 1775 .txt files, and each .txt file has 3023 lines that they looks like this: RIBBY_g_5ZCV995_BI_SNP_D04_38774.CEL FQC-10090295 0.007813 FQC-10119363 0.023438 FQC-10132112 ...
1
vote
0answers
46 views

Histogram with FASTA file

I am new to Linux. I have a FASTA file that looks something like this: >scaffold1 AAGACATAATATTTTGGAGGAATTAAAAAATTTAAGATGTATTTTATTATACATGTATTTTATTTATAACATAAATAAACATCCCAAGGAAAAGCAGTAGCT >...
1
vote
0answers
67 views

Using a file list to apply a script over a set of similarly named files (unix)

I have a set of files that are named like this: NAM11_BW415_R1.fastq.gz NAM13_BW968_R2.fastq.gz NAM17_AC_Barrie_R1.fastq.gz NAM3_PI648600_R2.fastq.gz NAM7_Glenlea_R1.fastq.gz ...
1
vote
1answer
30 views

Take similarly named fastq files on a folder and amke them input for an script(on pairs)

I have a set of files named like this inside a folder: AM11_BW415_R1.fastq.gz NAM13_BW968_R2.fastq.gz NAM17_AC_Barrie_R1.fastq.gz NAM3_PI648600_R2.fastq.gz NAM7_Glenlea_R1.fastq.gz ...
0
votes
2answers
318 views

Awk output pipe as an argument in a loop

I have some files to parse and use the output in an argument of a second program I'm using: for file in ./*.vcf.gz; do echo "gunzip -c ${file} | awk 'BEGIN{FS=OFS=\"\t\"} NR == FNR{key[\$1]=\$...
1
vote
4answers
74 views

Converting for loops on script that is called by another script into GNU parallel commands

Currently I have the following script for using the HaploTypeCaller program on my Unix system on a repeatable environment I created: #!/bin/bash #parallel call SNPs with chromosomes by GATK for i in ...
0
votes
6answers
102 views

Simplest way to extract a portion of a string?

I've got a file (bigfile.txt), one of the columns looks like this NW_017095471.1 Gnomon mRNA 108321 109565 . + . ID=rna34;Parent=gene27;Dbxref=GeneID:108565285,Genbank:XM_017925071.1;...
0
votes
0answers
12 views

Downloading data from NCBI database using UNIX command

I have a .txt file containing 140 accession numbers. Each number corresponds to one Fastq file. I want to download all the Fastq files together using a FOR loop. My text file looks like: SRR000311 ...
0
votes
4answers
39 views

Extract data based on certain pattern in one column

I have a dataset like this: AAACCTGCAAGCGAGT-1,ENSG00000000419,DPM1,2 AAACCTGCAAGCGAGT-1,ENSG00000001497,LAS1L,1 AAACCTGCAAGCGAGT-1,ENSG00000002330,BAD,1 AAACCTGCAAGCGAGT-1,ENSG00000002549,MT-CO3,2 ...
0
votes
0answers
53 views

How to append two fasta files?

I have two fasta files as shown below, File:1 >Contig_1:90600-91187 AAGGCCATCAAGGACGTGGATGAGGTCGTCAAGGGCAAGGAACAGGAATTGATGACGGTC >Contig_98:35323-35886 ...
1
vote
2answers
33 views

How to replace all values (all NAs) in a column with numeric part of the file name?

I have multiple (22) files that are named like this: chr1.out, chr2.out...,chr22.out each of those files has 46 columns and multiple lines The first 6 columns and 6 rows in one of those files looks ...
-1
votes
1answer
130 views

how to download ebi fastq link via command line using wget/curl

I have loads of data (fastq) to download from ENA database. Example: ERS076383 ERS012262 ERS160574 ERS349280 etc Link to download via browser: https://www.ebi.ac.uk/ena/data/warehouse/filereport?...