<?xml version='1.0'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" >
<channel>
	<title><![CDATA[BOL: Owner]]></title>
	<link>https://bioinformaticsonline.com/snippets/owner/biostar?</link>
	<atom:link href="https://bioinformaticsonline.com/snippets/owner/biostar?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/44440/bash-script-to-convert-multi-line-fasta-to-single-line-fasta</guid>
	<pubDate>Wed, 31 Jan 2024 00:39:21 -0600</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/44440/bash-script-to-convert-multi-line-fasta-to-single-line-fasta</link>
	<title><![CDATA[Bash script to convert Multi-line Fasta to Single-line Fasta !]]></title>
	<description><![CDATA[<code>#!/bin/bash

input_filename=&quot;multi_line.fasta&quot;
output_filename=&quot;single_line.fasta&quot;

awk &#039;/^&gt;/ {printf(&quot;\n%s\n&quot;, $0);next; } { printf(&quot;%s&quot;, $0);} END {printf(&quot;\n&quot;);}&#039; &quot;$input_filename&quot; &gt; &quot;$output_filename&quot;

echo &quot;Successfully converted $input_filename to $output_filename in single-line FASTA format.&quot;</code>]]></description>
	<dc:creator>BioStar</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/44439/perl-script-to-convert-multi-line-fasta-to-single-line-fasta</guid>
	<pubDate>Wed, 31 Jan 2024 00:38:21 -0600</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/44439/perl-script-to-convert-multi-line-fasta-to-single-line-fasta</link>
	<title><![CDATA[Perl script to convert Multi-line Fasta to Single-line Fasta !]]></title>
	<description><![CDATA[<code>#!/usr/bin/perl

use strict;
use warnings;

sub multi_to_single_line_fasta {
    my ($input_filename, $output_filename) = @_;

    open my $input_file, &#039;&lt;&#039;, $input_filename or die &quot;Error: Could not open file &#039;$input_filename&#039;: $!&quot;;
    open my $output_file, &#039;&gt;&#039;, $output_filename or die &quot;Error: Could not open file &#039;$output_filename&#039;: $!&quot;;

    my $current_sequence = &quot;&quot;;

    while (my $line = &lt;$input_file&gt;) {
        chomp $line;
        if ($line =~ /^&gt;/) {
            # If a header line, write the previous sequence and then the new header
            print $output_file $current_sequence . &quot;\n&quot; if $current_sequence;
            print $output_file $line . &quot;\n&quot;;
            $current_sequence = &quot;&quot;;
        } else {
            # If a sequence line, concatenate to the current sequence
            $current_sequence .= $line;
        }
    }

    # Write the last sequence
    print $output_file $current_sequence . &quot;\n&quot; if $current_sequence;

    close $input_file;
    close $output_file;

    print &quot;Successfully converted $input_filename to $output_filename in single-line FASTA format.\n&quot;;
}

# Example usage:
# multi_to_single_line_fasta(&#039;multi_line.fasta&#039;, &#039;single_line.fasta&#039;);</code>]]></description>
	<dc:creator>BioStar</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/44438/python-script-to-convert-multi-line-fasta-to-single-line-fasta</guid>
	<pubDate>Wed, 31 Jan 2024 00:37:15 -0600</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/44438/python-script-to-convert-multi-line-fasta-to-single-line-fasta</link>
	<title><![CDATA[Python script to convert Multi-line Fasta to Single-line Fasta]]></title>
	<description><![CDATA[<code>def multi_to_single_line_fasta(input_filename, output_filename):
    try:
        with open(input_filename, &#039;r&#039;) as input_file:
            with open(output_filename, &#039;w&#039;) as output_file:
                current_sequence = &quot;&quot;
                for line in input_file:
                    if line.startswith(&#039;&gt;&#039;):
                        # If a header line, write the previous sequence and then the new header
                        if current_sequence:
                            output_file.write(current_sequence + &#039;\n&#039;)
                        output_file.write(line.strip() + &#039;\n&#039;)
                        current_sequence = &quot;&quot;
                    else:
                        # If a sequence line, concatenate to the current sequence
                        current_sequence += line.strip()
                
                # Write the last sequence
                if current_sequence:
                    output_file.write(current_sequence + &#039;\n&#039;)

        print(f&quot;Successfully converted {input_filename} to {output_filename} in single-line FASTA format.&quot;)

    except FileNotFoundError:
        print(f&quot;Error: File &#039;{input_filename}&#039; not found.&quot;)

# Example usage:
# multi_to_single_line_fasta(&#039;multi_line.fasta&#039;, &#039;single_line.fasta&#039;)</code>]]></description>
	<dc:creator>BioStar</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/44437/perl-script-to-calculate-gc-content</guid>
	<pubDate>Tue, 30 Jan 2024 05:20:10 -0600</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/44437/perl-script-to-calculate-gc-content</link>
	<title><![CDATA[Perl script to calculate GC content !]]></title>
	<description><![CDATA[<code>#!/usr/bin/perl

sub calculate_gc_content {
    my ($sequence) = @_;
    $sequence = uc($sequence);  # Convert the sequence to uppercase
    my $gc_count = () = $sequence =~ /[GC]/g;
    my $total_bases = length($sequence);
    my $gc_content = ($gc_count / $total_bases) * 100;
    return $gc_content;
}

# Example usage:
my $dna_sequence = &quot;ATGCGCTAAAGCGAGCGAAGCGCTAGATCGATCGATCGATCGATCGATCGATCGATCGATCG&quot;;
my $gc_content = calculate_gc_content($dna_sequence);
printf &quot;GC content: %.2f%%\n&quot;, $gc_content;</code>]]></description>
	<dc:creator>BioStar</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/44286/download-lumpy-skin-disease-data</guid>
	<pubDate>Wed, 22 Mar 2023 05:12:12 -0500</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/44286/download-lumpy-skin-disease-data</link>
	<title><![CDATA[Download lumpy skin disease data !]]></title>
	<description><![CDATA[<code>Location

https://www.ncbi.nlm.nih.gov/sra?linkname=bioproject_sra_all&amp;from_uid=880745


The raw genome sequence data from the 2022 outbreak in India is available in the SRA Project PRJNA880745</code>]]></description>
	<dc:creator>BioStar</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/44260/r-script-to-covert-and-export-html-page-to-png</guid>
	<pubDate>Tue, 14 Mar 2023 07:03:42 -0500</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/44260/r-script-to-covert-and-export-html-page-to-png</link>
	<title><![CDATA[R script to covert and export html page to png]]></title>
	<description><![CDATA[<code># Library
library(streamgraph)
# Create data:
data &lt;- data.frame(
  year=rep(seq(1990,2016) , each=10),
  name=rep(letters[1:10] , 27),
  value=sample( seq(0,1,0.0001) , 270)
)
# Start with a classic stream graph. It is supposed to open in a browser
streamgraph(data, key=&quot;name&quot;, value=&quot;value&quot;, date=&quot;year&quot;)
# Copy the URL of the html window you get
# load webshot library
library(webshot)

#install phantom:
webshot::install_phantomjs()
# Make a webshot in pdf : high quality but can not choose printed zone
webshot(&quot;paste_your_html_here.html&quot; , &quot;output.pdf&quot;, delay = 0.2)

# Make a webshot in png : Low quality - but you can choose shape
webshot(&quot;paste_your_html_here&quot; , &quot;output.png&quot;, delay = 0.2 , cliprect = c(440, 0, 1000, 10))</code>]]></description>
	<dc:creator>BioStar</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/44222/raku-script-to-find-palindrome-in-genomes</guid>
	<pubDate>Tue, 07 Mar 2023 14:15:17 -0600</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/44222/raku-script-to-find-palindrome-in-genomes</link>
	<title><![CDATA[Raku script to find palindrome in genomes !]]></title>
	<description><![CDATA[<code>sub is-palindrome(Str $str) returns Bool {
    $str.=uc; # convert to uppercase
    $str.=subst:g/\s+//; # remove any spaces
    return $str eq $str.flip;
}

sub find-palindromes(Str $dna, Int $min-length, Int $max-length) {
    for $min-length..$max-length -&gt; $length {
        for 0..^$dna.chars - $length -&gt; $pos {
            my $substring = $dna.substr($pos, $length);
            if is-palindrome($substring) {
                say &quot;Palindrome found at position $pos: $substring&quot;;
            }
        }
    }
}

# Example usage
my $dna = &quot;GGATCCATGGCCTAGG&quot;; # example DNA sequence
find-palindromes($dna, 3, 8); # find palindromes with length between 3 and 8</code>]]></description>
	<dc:creator>BioStar</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/44221/perl-script-to-find-edit-distance-between-two-sequences</guid>
	<pubDate>Tue, 07 Mar 2023 14:11:00 -0600</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/44221/perl-script-to-find-edit-distance-between-two-sequences</link>
	<title><![CDATA[Perl script to find edit distance between two sequences !]]></title>
	<description><![CDATA[<code>#!/usr/bin/perl

use strict;
use warnings;

sub edit_distance {
    my ($s1, $s2) = @_;

    my $len1 = length($s1);
    my $len2 = length($s2);

    my @dp;
    for (my $i = 0; $i &lt;= $len1; $i++) {
        for (my $j = 0; $j &lt;= $len2; $j++) {
            $dp[$i][$j] = 0;
        }
    }

    for (my $i = 0; $i &lt;= $len1; $i++) {
        $dp[$i][0] = $i;
    }

    for (my $j = 0; $j &lt;= $len2; $j++) {
        $dp[0][$j] = $j;
    }

    for (my $i = 1; $i &lt;= $len1; $i++) {
        for (my $j = 1; $j &lt;= $len2; $j++) {
            my $cost = substr($s1, $i-1, 1) eq substr($s2, $j-1, 1) ? 0 : 1;
            $dp[$i][$j] = min($dp[$i-1][$j]+1, $dp[$i][$j-1]+1, $dp[$i-1][$j-1]+$cost);
        }
    }

    return $dp[$len1][$len2];
}

sub min {
    my $min = shift @_;
    foreach (@_) {
        $min = $_ if $_ &lt; $min;
    }
    return $min;
}

# Example usage
my $seq1 = &quot;ACGTAGCTAGCTGACTGAC&quot;;
my $seq2 = &quot;CGTAGCTAGCTGACAGCTA&quot;;
my $distance = edit_distance($seq1, $seq2);
print &quot;The edit distance between $seq1 and $seq2 is $distance.\n&quot;;</code>]]></description>
	<dc:creator>BioStar</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/44212/perl-script-to-find-inverted-repeats</guid>
	<pubDate>Tue, 07 Mar 2023 06:25:23 -0600</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/44212/perl-script-to-find-inverted-repeats</link>
	<title><![CDATA[Perl script to find inverted repeats !]]></title>
	<description><![CDATA[<code>#!/usr/bin/perl

use strict;
use warnings;

use Bio::SeqIO;
use Bio::Tools::Run::RepeatMasker;

my $genome_file = &quot;genome.fasta&quot;;

# read genome sequence
my $seqio = Bio::SeqIO-&gt;new(-file =&gt; $genome_file, -format =&gt; &quot;fasta&quot;);
my $seqobj = $seqio-&gt;next_seq();
my $seq = $seqobj-&gt;seq();

# run RepeatMasker
my $rm = Bio::Tools::Run::RepeatMasker-&gt;new();
my $rm_report = $rm-&gt;run($genome_file);

# parse RepeatMasker output
while (my $rm_result = $rm_report-&gt;next_result()) {
    my $rm_match = $rm_result-&gt;repeat_consensus();
    my $rm_class = $rm_result-&gt;repeat_class();
    my $rm_start = $rm_result-&gt;start();
    my $rm_end = $rm_result-&gt;end();
    my $rm_strand = $rm_result-&gt;strand();
    
    if ($rm_class eq &quot;Inverted&quot;) {
        my $rm_seq = substr($seq, $rm_start-1, $rm_end-$rm_start+1);
        if ($rm_strand eq &quot;-&quot;) {
            $rm_seq = reverse_complement($rm_seq);
        }
        print &quot;Inverted repeat found at positions $rm_start-$rm_end: $rm_seq\n&quot;;
    }
}

sub reverse_complement {
    my ($seq) = @_;
    $seq = reverse($seq);
    $seq =~ tr/ACGTacgt/TGCAtgca/;
    return $seq;
}</code>]]></description>
	<dc:creator>BioStar</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/44170/identify-genome-wide-synteny-with-lastz-alignment</guid>
	<pubDate>Mon, 05 Dec 2022 04:52:48 -0600</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/44170/identify-genome-wide-synteny-with-lastz-alignment</link>
	<title><![CDATA[Identify genome-wide synteny with LASTZ alignment]]></title>
	<description><![CDATA[<code>#This is the walkstrough how to identifiy genome-wide synteny markers based on LASTZ alignment.

Step1：Mask the repeat sequences for both genomes and chromosomes.

RepeatMasker -pa 40 -nolow -norna -gff -xmall -lib custom.TE.lib_for_rice.fa AAChr1.txt RepeatMasker -pa 40 -nolow -norna -gff -xmall -lib custom.TE.lib_for_FF.fa FFChr1.txt

Step2: Alignment using LASTZ and Chain/Net

lastz AAChr1.txt FFChr1.txt K=2200 L=6000 Y=3400 E=30 H=0 O=400 T=1 --format=axt --out=chr01.axt axtChain -linearGap=medium chr01.axt AAChr1.txt FFChr1.txt chr01.axt.chain chainPreNet chr01.axt.chain AAChr1.txt.sizes FFChr1.txt.sizes chr01.chain.filter chainNet chr01.chain.filter -minSpace=1 AAChr1.txt.sizes FFChr1.txt.sizes chr1.chain.filter.tnet chr1.chain.filter.qnet netSyntenic chr1.chain.filter.tnet chr1.chain.filter.tnet.synnet netToAxt chr1.chain.filter.tnet.synnet chr1.chain.filter.tnet.synnet chr01.chain.filter AAChr1.txt FFChr1.txt chr1.chain.filter.tnet.synnet.axt axtSort chr1.chain.filter.tnet.synnet.axt chr1.chain.filter.tnet.synnet.Sort.axt axtToMaf chr1.chain.filter.tnet.synnet.axt AAChr1.txt.sizes FFChr1.txt.sizes -tPrefix=target. -qPrefix=query. chr1.chain.filter.tnet.synnet.axt.maf

Step 3: Get syntenic markers

perl Maf2rawsynteny.pl chr1.chain.filter.tnet.synnet.axt.maf target.AAChr1 query.FFChr1 
perl Get_synteny.pl -i chr1.chain.filter.tnet.synnet.axt.maf -n 0 -m 3 -t target.AAChr1 -q query.FFChr1 -o syn.final.out

@ https://github.com/yiliao1022/Centromere_synteny_project</code>]]></description>
	<dc:creator>BioStar</dc:creator>
</item>

</channel>
</rss>