Find and replace in multifasta or fasta header with perl onliner
You have a fasta file and you want to replace: "|" You are told to replace that by "_" perl -i -p -e "s/\|/_/g" genome.fasta -i = inplace editing -p = loop over lines and print each line (after processing) -e = command line script1643 days ago
1632 days ago
Samtools commands for bioinformatician !
...an depth samtools depth -a sorted_dupremoved.bam | awk '{c++;s+=$3}END{print s/c}' ### one liner to cou...tools depth -a sorted_dupremoved.bam | awk '{c++; if($3>0) total+=1}END{print (total/c)*100}' ### flagst...1631 days ago
Perl script to remove duplicated lines !
#!/usr/bin/perl use strict; use warnings; { $_ = ; my $next_line; while( $next_line = ) { #print "current line: $_ -- next line: $next_line$/"; print $_ if $_ ne $next_line; }...1588 days ago
1585 days ago
Perl script to delete the adjacent repeats !
...rite a code to delete the adjacent repeated character .... $string='ATTTTTTGGC'; # This should be converted to ATGC $string =~ s/(\w)\1/$1/g; print $string; #For more helps ....1578 days ago
1542 days ago
Installing docker for Bioinformatics on Ubuntu !
...rify Use TLS and verify the remote -v, --version Print version information and quit...nformation wait Block until one or more containers stop, then print their exit codes Run 'dock...1541 days ago
Python script to check sequence length in multifasta file
#!/usr/bin/python from Bio import SeqIO import sys cmdargs = str(sys.argv) for seq_record in SeqIO.parse(str(sys.argv[1]), "fasta"): output_line = '%s\t%i' % \ (seq_record.id, len(seq_record)) print(output_line)1243 days ago
Perl One-Liner to print only non-uppercase letters
#Go through file and only print words that do not have any uppercase letters. perl -ne 'print unless m/[A-Z]/' dna.fa > dnaOnlyLowercase.fa #To lowercase everything perl -pne 'tr/[A-Z]/[a-z]/' dnaUpperCase.fa >dnawithoutuppercase.fa;1411 days ago