Count the frequency of base G in a given DNA sequence
...while($currentPos < $DNAlength){ my $base = substr($DNA,$currentPos,1); if($base eq "G"){ $countG++; } $currentPos++; } #end of while loop #print out the number of G...2917 days ago
Perl script introduces control structures, arrays and hashes.
...f getting size: $another_way_of_getting_size_of_array\n\n"; # Control Loop: for for (my $i=0; $i 'ATC...qs' => 2 ); print $sequence{'DNA'}, "\n"; # Control Loop: foreach foreach my $key (...2862 days ago
Extract fasta sequence from a multifasta file with coordinates
...my $subseq = $seq->subseq(4_000_000 => 4_100_000); my $trunc = $seq->trunc(4_000_000 => 4_100_000); my $length = $seq->length; # Loop through sequence objects m...2532 days ago
2466 days ago
Loop over with all files in a directory in bash
#!/bin/bash FILES=/media/ComparativeGenomics/ncbi-genomes-2017-11-13/* ref=/media/ComparativeGenomics/ncbi-genomes-2017-11-13/GCA_000196735.1_ASM19673v1_genomic.fna...2331 days ago
Perl script to run SATSUMA in loop !
#!/usr/bin/perl -w use strict; use File::Temp qw(tempfile); # Usage perl 1by1.pl for SATSUMA analysis # User need to set the reference multifasta file name her...2140 days ago
Perl script to break the contigs by 'N'
...ntig my @regions=(); my @bases=split //,$seq; push(@bases,"E"); #This extra position marks the end of the contig my $n=0; #Sorry for this loop, but its less memory expensiv...2063 days ago
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 script1615 days ago
Trim the reads in loop using Trimmomatic !
for infile in *_1.fastq.gz do base=$(basename ${infile} _1.fastq.gz) trimmomatic PE ${infile} ${base}_2.fastq.gz \ ${base}_1.trim.fastq.gz ${...955 days ago
Perl script for Smith-Waterman Algorithm
# Smith-Waterman Algorithm # usage statement die "usage: $0 \n" unless @ARGV == 2; # get sequences from command line my ($seq1, $seq2) = @ARGV; # scoring...950 days ago