tag:blogger.com,1999:blog-87869107684100122112024-03-13T21:51:59.786-07:00GeneWarrior BlogGeneWarriorhttp://www.blogger.com/profile/06519322497972371416noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-8786910768410012211.post-34687230460475695022018-05-10T03:34:00.004-07:002018-05-10T03:34:37.537-07:00Downloading sequences from NCBI:<br />
<br />
<span style="background-color: white; color: #353535; font-family: BentonSans, sans-serif; font-size: 14px;">This downloads the GenBank file and puts it into a file called CP011547.gbk (Just change the accession number in the first line to download any other sequence):</span><br />
<pre style="background-color: #fcfcf7; border: 1px solid rgb(204, 204, 202); color: #353535; font-size: 14px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 5px; margin-top: 5px; padding: 0px 5px; vertical-align: baseline; word-break: break-word;"><code style="background-color: transparent; border: none; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; line-height: 1.42857em; margin: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap; word-break: break-word;">i=CP011547
curl -s "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nucleotide&id=${i}&rettype=gb&retmode=txt">$i.gbk</code></pre>
<br />
<div style="background-color: white; border: 0px; color: #353535; font-family: BentonSans, sans-serif; font-size: 14px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: 1.42857em; margin-bottom: 5px; margin-top: 5px; overflow-wrap: break-word; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
The sequence as nucleotide fasta:</div>
<pre style="background-color: #fcfcf7; border: 1px solid rgb(204, 204, 202); color: #353535; font-size: 14px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 5px; margin-top: 5px; padding: 0px 5px; vertical-align: baseline; word-break: break-word;"><pre style="border: 1px solid rgb(204, 204, 202); font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 5px; margin-top: 5px; padding: 0px 5px; vertical-align: baseline; word-break: break-word;"><code style="background-color: transparent; border: none; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; line-height: 1.42857em; margin: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap; word-break: break-word;">curl -s "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nucleotide&id=${i}&rettype=fasta&retmode=txt">$i.fna</code></pre>
</pre>
<br />
<span style="background-color: white; color: #353535; font-family: BentonSans, sans-serif; font-size: 14px;">The CDS as protein fasta:</span><br />
<pre style="background-color: #fcfcf7; border: 1px solid rgb(204, 204, 202); color: #353535; font-size: 14px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 5px; margin-top: 5px; padding: 0px 5px; vertical-align: baseline; word-break: break-word;"><pre style="border: 1px solid rgb(204, 204, 202); font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 5px; margin-top: 5px; padding: 0px 5px; vertical-align: baseline; word-break: break-word;"><code style="background-color: transparent; border: none; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; line-height: 1.42857em; margin: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap; word-break: break-word;">curl -s "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nucleotide&id=${i}&rettype=fasta_cds_aa&retmode=txt">$i.cds.faa</code></pre>
</pre>
<br />
<span style="background-color: white; color: #353535; font-family: BentonSans, sans-serif; font-size: 14px;">The CDS as nucleotide fasta:</span><br />
<pre style="background-color: #fcfcf7; border: 1px solid rgb(204, 204, 202); color: #353535; font-size: 14px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 5px; margin-top: 5px; padding: 0px 5px; vertical-align: baseline; word-break: break-word;"><pre style="border: 1px solid rgb(204, 204, 202); font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 5px; margin-top: 5px; padding: 0px 5px; vertical-align: baseline; word-break: break-word;"><code style="background-color: transparent; border: none; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; line-height: 1.42857em; margin: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap; word-break: break-word;">curl -s "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nucleotide&id=${i}&rettype=fasta_cds_na&retmode=txt">$i.cds.fna</code></pre>
</pre>
<br />GeneWarriorhttp://www.blogger.com/profile/06519322497972371416noreply@blogger.com0tag:blogger.com,1999:blog-8786910768410012211.post-25791706980840441032018-02-16T00:08:00.001-08:002018-02-16T00:08:23.793-08:00<h2>
Brief Bioinformatics Bash</h2>
<h3>
Multi FASTA to one Sequence per FASTA</h3>
Write each Sequence of a multisequence FASTA to a separate FASTA file.<br />
<br />
<br />
multifasta2Singlefastas.sh<br />
<code>#/bin/bash<br />while read line<br />do<br /> if [[ ${line:0:1} == '>' ]]<br /> then<br /> outfile=${line#>}.fa<br /> echo $line > $outfile<br /> else<br /> echo $line >> $outfile<br /> fi<br />done < $1<br /></code>
<br />
<br />
Don't forget to <code>chmod +x </code><code>multifasta2Singlefastas.sh</code><br />
<br />
Usage:<br />
<code>./</code><code>multifasta2Singlefastas.sh input.fasta </code>GeneWarriorhttp://www.blogger.com/profile/06519322497972371416noreply@blogger.com0tag:blogger.com,1999:blog-8786910768410012211.post-89739644966952025452018-02-16T00:06:00.000-08:002018-02-16T00:06:17.971-08:00<h2>
Brief Bioinformatics Bash</h2>
<h3>
FASTA to single line FASTA </h3>
Write the wrapped sequences of a FASTA file to a single line; example:<br />
<br />
Before: <br />
>Seq1<br />
ACGTACGTACGT<br />
ACGTACGTACGT<br />
ACGTACGTACGT<br />
>Seq2<br />
GCAGTGCAGTGCAGTGCAGT<br />
GCAGTGCAGTGCAGTGCAGT<br />
<br />
After: <br />
>Seq1<br />
ACGTACGTACGTACGTACGTACGTACGTACGTACGT<br />
>Seq2<br />
GCAGTGCAGTGCAGTGCAGTGCAGTGCAGTGCAGTGCAGT<br />
<br />
<br />
multifasta2Singleline.sh<br />
<code>#/bin/bash<br />awk '/^>/ {printf("\n%s\n",$0);next; } { printf("%s",$0);} END {printf("\n");}' < $1 | grep -v '^$'</code>
<br />
<br />
Don't forget to <code>chmod +x multifasta2Singleline.sh</code><br />
<br />
Usage:<br />
<code>./multifasta2Singleline.sh input.fasta > output.fasta</code>GeneWarriorhttp://www.blogger.com/profile/06519322497972371416noreply@blogger.com0tag:blogger.com,1999:blog-8786910768410012211.post-87031638441237963322017-02-04T07:08:00.003-08:002017-02-28T12:27:21.006-08:00Sun Locator - Privacy Policy<h2>
Sun Locator - Privacy Policy
</h2>
<div>
The Sun Locator app requests so called "sensitive device information". Specifically, this is the device position (GPS) and camera access.</div>
<div>
<br /></div>
<h3>
<b>Device Position (GPS)</b></h3>
<div>
GPS data is requested when you click on "Location from GPS" to use your current location.</div>
<div>
<br /></div>
<h3>
<b>Camera access</b></h3>
<div>
Camera access is needed to use the Camera View (aka Augmented Reality view)</div>
<div>
<br /></div>
<h3>
<b>Other data</b> (e.g user data)</h3>
<div>
No other data is used by the app.</div>
<h3>
<br />Data collection/Data storage</h3>
<div>
<b>Absolute none! </b>No data from your device is sent to any servers, no analytics is performed. The data stays on your device, all the calculations are done directly on your device.<br />
However be aware, that the "Location form Map" Option and the "Map View"-Feature uses Google Maps. More information about the Google's privacy policy can be found here: <a href="https://www.google.com/policies/privacy/">https://www.google.com/policies/privacy/</a></div>
<div>
<br /></div>
<div>
If you have any questions, send me an email <a href="mailto:contact@genewarrior.com">contacŧ@genewarrior.com</a></div>
<div>
<br /></div>
<div>
<a href="http://3.bp.blogspot.com/-nZMjJZl2jEQ/WLXdJENnleI/AAAAAAAAAIA/IkvvUl6W5MEqL2TTyxT8szc-v9qI_-9OQCK4B/s1600/icon-big.png" imageanchor="1"><img border="0" height="320" src="https://3.bp.blogspot.com/-nZMjJZl2jEQ/WLXdJENnleI/AAAAAAAAAIA/IkvvUl6W5MEqL2TTyxT8szc-v9qI_-9OQCK4B/s320/icon-big.png" width="320" /></a></div>
GeneWarriorhttp://www.blogger.com/profile/06519322497972371416noreply@blogger.com0tag:blogger.com,1999:blog-8786910768410012211.post-85082210951576894722016-10-28T13:00:00.002-07:002016-12-09T13:10:48.000-08:00<br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif; font-size: large;"><b><img border="0" height="312" src="https://3.bp.blogspot.com/-MTEGkwCH59s/WBomJoy8dCI/AAAAAAAAAEg/P9WhAWzslRcYEGXHOccjhAoJkNvtJg1KwCK4B/s640/banner_playstore.png" width="640" /></b></span><br />
<b style="font-family: "helvetica neue", arial, helvetica, sans-serif; font-size: x-large;">Sun Locator</b><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif; font-size: large;"> -</span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif; font-size: large;">Predict the Sun and Moon Position anywhere and anytime</span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif; font-size: large;"><a href="https://play.google.com/store/apps/details?id=com.genewarrior.sunlocator.pro"><img alt="Image result for google play" height="77" src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png" width="200" /></a></span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">Sun Locator is an Android App to predict the sun and moon position during the course of a day and a year.</span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">Anticipate lighting conditions in photography/filming, real estate, architecture, outdoor activities (e.g. setting up camp), solar panel positioning, gardening, and more.</span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<iframe width="640" height="532" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/SwbI4r5FN68/0.jpg" src="https://www.youtube.com/embed/SwbI4r5FN68?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<span style="background-color: white; color: #333333; font-family: "helvetica neue", arial, helvetica, sans-serif;">The </span><b style="background-color: white; color: #333333; font-family: "helvetica neue", arial, helvetica, sans-serif;">Camera view</b><span style="background-color: white; color: #333333; font-family: "helvetica neue", arial, helvetica, sans-serif;"> (Augmented Reality) displays the solar position and lunar position directly overlaid on your device's camera. Use the slider to set the time of day or day of year and directly track the solar movement.</span></div>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><img border="0" height="215" src="https://2.bp.blogspot.com/-smH8g74UE7A/WBOpc6JV4VI/AAAAAAAAACg/ZSG0TlaQzzIHML1bwIcOxJKj3k8vUhiBACK4B/s400/cameraview.png" width="400" /></span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br style="background-color: white; color: #333333;" /></span><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="background-color: white; color: #333333;">The <b>Map view</b> displays the solar and lunar location, direction and shadow on a map to help you plan your activities.</span></span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="background-color: white; color: #333333;"><br /></span></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="background-color: white; color: #333333;"><img border="0" height="400" src="https://2.bp.blogspot.com/-nrPepcPwof8/WBOpf-dhqkI/AAAAAAAAACo/DJLip1oM1HscyamXOYbB-1ryp6ghFmCSQCK4B/s400/mapview_3.png" width="215" /><a href="http://4.bp.blogspot.com/-uRw2IFe4Wdc/WBeRPHQCuTI/AAAAAAAAAEE/za7lB-Ag8vktKW7PJVYGh6sER7advhePACK4B/s1600/mapview_1.png" imageanchor="1"><img border="0" height="344" src="https://4.bp.blogspot.com/-uRw2IFe4Wdc/WBeRPHQCuTI/AAAAAAAAAEE/za7lB-Ag8vktKW7PJVYGh6sER7advhePACK4B/s640/mapview_1.png" width="640" /></a></span></span><br />
<span id="goog_550210174"></span><span id="goog_550210175"></span><a href="https://www.blogger.com/"></a><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">The <b>Main view</b> includes all important information such as sunrise and sunset, twilight, "magic" photography times (blue hour/golden hour), moonrise and moonset, lunar phase etc.</span><br />
<img border="0" height="400" src="https://3.bp.blogspot.com/-uyctBN8HpwY/WBOrnXeIQSI/AAAAAAAAAC0/-Swg5ZTuQQ8qb3W5EUKw9JIqTuExrQTegCK4B/s400/mainview1.png" width="215" /><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><img border="0" height="400" src="https://3.bp.blogspot.com/-X07Hu-4A4Ys/WBOrocmwv-I/AAAAAAAAAC8/033wZOAVC24r5obXMEU4vUdqZDBI-95xgCK4B/s400/mainview2.png" width="215" /></span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">Use it for:</span><br />
<br />
<ul>
<li><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">Photography: when and where will the sun rise and set? When are the Blue hour and the golden hour? When and where will the moon shine tonight?</span></li>
<li><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">Gardening: do your plants get enough direct sunlight during the course of the day and year?</span></li>
<li><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">Real estate: does a neighboring building obstruct the sun and cause shade?</span></li>
<li><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">Architecture: How much sunshine will your home get? Does the sun shine through your window?</span></li>
<li><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">Camping: will the sun shine on your tent?</span></li>
<li><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">Hiking: when does dawn start and dusk end?</span></li>
<li><span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;">Solar panels: Will there be nearby obstructions?</span></li>
</ul>
<div>
<br /></div>
<br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><a href="https://play.google.com/store/apps/details?id=com.genewarrior.sunlocator.pro">Sun Locator is available at Google Play</a>.</span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><a href="https://play.google.com/store/apps/details?id=com.genewarrior.sunlocator.pro"><img alt="Image result for google play" height="77" src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png" width="200" /></a></span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="font-family: "arial" , "helvetica" , sans-serif;">The </span><a href="https://play.google.com/store/apps/details?id=com.genewarrior.sunlocator.lite"><span style="font-family: "arial" , "helvetica" , sans-serif;">Lite version</span></a><span style="font-family: "arial" , "helvetica" , sans-serif;"> is free and </span></span><span style="background-color: #fafafa; color: #222222; font-family: "arial" , "helvetica" , sans-serif;">limited to information for the current day.</span><br />
<span style="background-color: #fafafa; color: #222222;"><span style="font-family: "arial" , "helvetica" , sans-serif;">The </span><a href="https://play.google.com/store/apps/details?id=com.genewarrior.sunlocator.pro"><span style="font-family: "arial" , "helvetica" , sans-serif;">Pro version</span></a><span style="font-family: "arial" , "helvetica" , sans-serif;"> </span></span><span style="background-color: #fafafa; color: #222222; font-family: "arial" , "helvetica" , sans-serif;">displays information for any day of the year.</span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif; font-size: large;"><br /></span>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif; font-size: large;">Main View</span><br />
<img border="0" height="400" src="https://1.bp.blogspot.com/-4YufnzLD4gY/WBOtRRFqsHI/AAAAAAAAADg/gkuKMRTBNpQ-1WS3pRd2F4lqtzr_LwOdwCK4B/s400/mainview.png" width="233" /><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><b style="font-family: "Times New Roman";">Sunrise, Sunset, Moon rise, Moon set</b><span style="font-family: "times new roman";">:</span><br style="font-family: "Times New Roman";" /><span style="font-family: "times new roman";">The time of day when the sun or moon crosses the Earth's horizon.</span></span><br />
<br />
<b>Sun transit</b>:<br />
Sometimes referred to as solar noon, is the time of the day when the sun passes over the observer's meridian line, this is roughly when the sun is at its highest.<br />
<b>Twilight times</b>:<br />
Twilight is the remaining illumination when the sun is below the horizon. The sunlight scatters in the atmosphere and illuminates the Earth. There are three definitions of twilight:<br />
<ul>
<li>Civil twilight: Approximately the limit at which solar illumination is sufficient, under clear weather conditions, for terrestrial objects to be clearly distinguished by eye. There is enough light from the sun during this period that artificial sources of light are not needed to carry on most outdoor activities.</li>
<li>Nautical twilight: The horizon is clearly visible, but artificial lighting is necessary to see terrestrial objects.</li>
<li>Astronomical twilight: Outside of the astronomical twilight, the sky (away from light pollution, moonlight, auroras, and other sources of light in the sky) is dark enough for nearly all astronomical observations.</li>
</ul>
<br />
<b>Shadow ratio</b>:<br />
The length of the shadow cast by an object of the height of 1 foot or meter.<br />
E.g. at a shadow ratio of 1:0.45 an object of 5 meter height will cast a shadow of 5 × 0.45 = 2.25 meter<br />
<b>Photography: Blue and golden hour</b>:<br />
The <b>Blue hour</b> is the period of twilight when the sun is below the horizon and the indirect sunlight takes on a predominantly blue hue and cold color temperature.<br />
The <b>Golden hour</b> is the short period of time just after sunset when the light is redder, having a warm color temperature. Lighting is diffuse and with little contrast, so no strong shadows exist.<br />
<b>Current sun and moon position: Azimuth</b>:<br />
The horizontal angle clockwise from North. I.e. North is zero degrees (0°), East 90°, South 180° and West 270°. The Magnetic declination is automatically taken into account using the specified location.<br />
<b>Current sun and moon position: Elevation</b>:<br />
Sometimes referred to as altitude, is the angle between the devices horizon and the sun. The horizon is at 0° and the zenith at 90°<br />
<b>Moon phase</b>:<br />
The percentage of the lit surface of the moon. 0% corresponds to a new moon, 100% to a full moon. The moon is either waxing (the lit surface is increasing) or waning (decreasing).<br />
<b>Time zone</b>:<br />
All times are displayed in your current time zone (as set by your device). So if you select a locationof another time zone (e.g. you're in Europe and want to know the sun rise somewhere in the USA), the displayed times correspond to your device's clock.<br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"></span><br />
The button "Show Camera view" and "Show map view" opens the Augmented Reality View and Map view, respectively.<br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif; font-size: large;">Camera View</span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif; font-size: large;"><img border="0" height="225" src="https://2.bp.blogspot.com/-zlQZj_j2EYs/WBOs8qvGjRI/AAAAAAAAADM/3--5at2GNlwRcsnoifbOSUp2bgzSA1XvwCK4B/s400/cameraview.png" width="400" /></span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="font-family: "times new roman";">[A] Date/Time: Use the bottom slider to quickly change the date and time.</span><br style="font-family: "Times New Roman";" /><span style="font-family: "times new roman";">[B] Switch Sun/Moon: Switch from displaying the Sun position and path to displaying the Moon.</span><br style="font-family: "Times New Roman";" /><span style="font-family: "times new roman";">[C] Slider range: Using the slider will either set the time of day or day in year.</span><br style="font-family: "Times New Roman";" /><span style="font-family: "times new roman";">[D] Slider: set the date and time by going back and forth.</span><br style="font-family: "Times New Roman";" /><span style="font-family: "times new roman";">[E] Sun/Moon path throughout the day. </span><br style="font-family: "Times New Roman";" /><span style="font-family: "times new roman";">[F] Current position of the Sun/Moon</span></span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif; font-size: large;">Map View</span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><img border="0" height="208" src="https://3.bp.blogspot.com/-OXrEeJi-Tbs/WBOtG1OCLMI/AAAAAAAAADY/2DtiHYN5bpgCFu7JvFg-eo7Ffn7bYMYwwCK4B/s400/mapview.png" width="400" /></span><br />
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="font-family: "times new roman";">[A] Switch Sun/Moon: Switch from displaying the Sun position and path to displaying the Moon.</span><br style="font-family: "Times New Roman";" /><span style="font-family: "times new roman";">[B] Map type: choose between different map types (normal, satellite, terrain) to be displayed</span><br style="font-family: "Times New Roman";" /><span style="font-family: "times new roman";">[C] Date/Time: Use the bottom slider to quickly change the date and time.</span><br style="font-family: "Times New Roman";" /><span style="font-family: "times new roman";">[D] Slider range: Using the slider will either set the time of day or day in year</span><br style="font-family: "Times New Roman";" /><span style="font-family: "times new roman";">[E] Slider: set the date and time by going back and forth.</span><br style="font-family: "Times New Roman";" /><span style="font-family: "times new roman";">[F] Current sun/moon position</span><br style="font-family: "Times New Roman";" /><span style="font-family: "times new roman";">[G] Sun/moon path throughout the day</span><br style="font-family: "Times New Roman";" /><span style="font-family: "times new roman";">[H] Shadow cast by the 3D sundial</span></span><br />
<br />
<span style="font-family: "arial";"></span><br />
<span style="font-family: "arial"; font-size: large;">Reviews</span><br />
<ul>
<li><span style="font-family: "arial";">TuttoAndroid [italian]: <a href="http://www.tuttoandroid.net/android/sun-locator-pro-permette-di-tracciare-il-percorso-di-sole-e-luna-in-qualsiasi-luogo-e-momento-421227/">http://www.tuttoandroid.net/android/sun-locator-pro-permette-di-tracciare-il-percorso-di-sole-e-luna-in-qualsiasi-luogo-e-momento-421227/</a></span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Filmmaking Apps: <a href="http://cineblur.com/filmmaking-apps-for-android/">http://cineblur.com/filmmaking-apps-for-android/</a></span></li>
</ul>
<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><br />
</span>GeneWarriorhttp://www.blogger.com/profile/06519322497972371416noreply@blogger.com0tag:blogger.com,1999:blog-8786910768410012211.post-49842001068509779092015-12-01T02:30:00.001-08:002015-12-01T02:30:58.633-08:00Install a VNC Server on Ubuntu (x11vnc as alternative to tightVNC)<p>The goal of a VNC server is to remotely access the screen of another machine. In my case remotely is a room further down the hall on the same intranet, so at this stage I'm not worried about using encryption.</p>
<p>After having some trouble using the very popular tightvnc as a the tool of choice (I was getting errors running software which are based on the Qt framework; a similar bug has been reported <a href="https://bugreports.qt.io/browse/QTBUG-24690">here</a>).<br />
Because I'm quite dependent on this particular piece of software, I had to find a workaround. I chose to use x11vnc.</p>
<p>Because x11vnc relies on an actual X display, we need to make a virtual X display first. For this I use Xvfb. Both x11vnc and Xvfb are available in the Ubuntu repositories.<br>
Additionally, I wanted to use the old Gnome-Fallback (a.k.a Gnome Classic) display, because I'm not a big fan of the current display and the 3D-effects make things go slower on a VNC connection. This can be installed using <code>sudo apt-get install gnome-session-fallback</code>. This is of course not a requirement to use x11vnc and Xvfb.</p>
<p>First generate a password for x11vnc:<br/>
<code>x11vnc -storepasswd</code> and store it to /home/yourusername/.vnc/passwd. The password is only a minimal security measure, the connection still won't be encrypted.</p>
<p>You need to first start the Xvfb display this way:<br/>
<code>/usr/bin/xinit /usr/bin/gnome-session --session=gnome-fallback --disable-acceleration-check -- /usr/bin/Xvfb :20 -screen 0 1680x1050x24</code><br>
This will open an Xvfb display on X display number 20 with the given resolution (1680x1050) and color depth (24bit). If you don't want to use the classic gnome desktop remove the <code>--session=gnome-fallback</code> argument.</p>
<p>Next start x11vnc:<br>
<code>/usr/bin/x11vnc -display :20 -loop -rfbport 5901 -rfbauth /home/yourusername/.vnc/passwd -o /var/log/x11vnc.log</code><br/>
This will forward X display number 20 (where the Xvfb display is) to port 5901. Make sure that argument -rfbauth points to your password you created in the first step.</p>
<p>You can now connect to your machine on port 5901 using a VNC client such as RealVNC. Make sure that your firewall allows access to port 5901. You can of course also change the port using the -rfbport argument in x11vnc.</p>
<p>If everything works we can use a service to start these two programs automatically at every upstart.<br>
As sudo create a text file at <code>/etc/init/x11vnc.conf</code>. Include following commands (make sure to replace <code>yourusername</code> with your actual username):<br>
<code>start on login-session-start<br>
script<br>
echo Start x11vnc at `date` >> /var/log/x11vnc.log<br>
su - yourusername -c "/usr/bin/xinit /usr/bin/gnome-session --session=gnome-fallback --disable-acceleration-check -- /usr/bin/Xvfb :20 -screen 0 1680x1050x24" &<br>
su - yourusername -c "/usr/bin/x11vnc -display :20 -forever -loop -rfbport 5901 -rfbauth /home/yourusername/.vnc/passwd -o /var/log/x11vnc.log" >> /var/log/x11vnc.log<br>
end script<br>
</code>
<br>
This script will be run on every startup or by using <code>sudo service x11vnc start</code>.</p>GeneWarriorhttp://www.blogger.com/profile/06519322497972371416noreply@blogger.com1tag:blogger.com,1999:blog-8786910768410012211.post-44560875502812658392015-12-01T01:45:00.000-08:002015-12-01T01:45:14.019-08:00Run I-Tasser in parallel mode using SGE<p>I-TASSER (<a href="http://zhanglab.ccmb.med.umich.edu/I-TASSER/">http://zhanglab.ccmb.med.umich.edu/I-TASSER/</a>) is a popular protein structure prediction software that can also be installed locally as a stand alone program.</p>
<p>In order to make use of the parallelization capabilities of I-TASSER you first must install a batch-queuing system, for which I chose SGE (Sun Grid Engine). I followed these instructions to set it up on my Ubuntu multi core server: <a href="https://scidom.wordpress.com/2012/01/18/sge-on-single-pc/">https://scidom.wordpress.com/2012/01/18/sge-on-single-pc/</a><br />
The setup is comparatively straight-forward (or at least similar confusing as other systems such as Torque or SLURM) and the necessary binaries are available through Ubuntu's repositories.<br /></p>
<p>After successful setup of SGE and some tests, I was ready to setup I-TASSER to use SGE.
It's advisable to run I-TASSER in the serial mode first, to check that everything is in order, e.g. the database is in the right place, all the right software is installed etc. If the serial mode works, we're ready to change the starting script such that it works using SGE.<br />
The starting script is called <code>runI-TASSER.pl</code> and located in the <code>I-TASSERmod</code> folder. I made a copy of this script and called it <code>runI-TASSER_SGE.pl</code>.</p>
<br />
<br />
<br />
<br />
Change following lines:<br />
Line 840: change<br />
<code>$bsub=`qsub -e $errfile -o $outfile -l $walltime -N $tag $jobname`;</code><br />
to<br />
<code>$bsub=`qsub -cwd -S /usr/bin/perl -e $errfile -o $outfile -N $tag $jobname`;</code><br />
<br />
<br />
Line 1661: change<br />
<code>$bsub=`qsub $datadir/$tagnames{$i}`;</code><br />
to<br />
<code>$bsub=`qsub -cwd -S /usr/bin/perl $datadir/$tagnames{$i}`;</code><br />
<br />
<br />
<p>This seems to do the trick. You can now use <code>runI-TASSER_SGE.pl</code> using the <code>-runstyle parallel</code> option and I-TASSER will submit the tasks to the SGE queue.</p>GeneWarriorhttp://www.blogger.com/profile/06519322497972371416noreply@blogger.com1tag:blogger.com,1999:blog-8786910768410012211.post-77457776561363183232014-10-22T07:29:00.000-07:002014-10-23T00:55:24.458-07:00Use Java Servlet to connect to a PostgreSQL databaseIn this tutorial we will be creating a database server which hosts the data and a second server which hosts your application.<br />
<br />
<a href="http://www.postgresql.org/">PostgreSQL</a> is used as database server and <a href="http://tomcat.apache.org/">Tomcat 7</a> is used as application server.<br />
<br />
<h2>
Getting started</h2>
If you'd like to try the tutorial without screwing up your own computer, I'd suggest to start two virtual private servers on <a href="https://www.digitalocean.com/?refcode=dda3143d5a37">DigitalOcean</a>. The smallest instance currently costs $5 a month (or less than 20c for a day) and has more than enough power for our purposes. If you use <a href="https://www.digitalocean.com/?refcode=dda3143d5a37">this link</a>, you get a $10 credit.
<br />
We will be using Ubuntu 14.04 64bit.<br />
<h2>
Setting up the database server</h2>
Install the PostgreSQL server from Ubuntu's repositories:<br />
<code>sudo apt-get install postgresql postgresql-contrib</code><br />
<br />
Add new user for database:<br />
<code>sudo adduser postgres_user</code><br />
<br />
Login as postgres administrator (this user is added by the previous installation procedure):<br />
<code>sudo su - postgres</code><br />
<br />
Login to Postgres Terminal:<br />
<code>psql</code><br />
<br />
After login we create a user, assign a password and create a database belonging to this user :<br />
<code>CREATE USER postgres_user WITH PASSWORD 'myPassword';<br />
CREATE DATABASE exampledb OWNER postgres_user;</code><br />
<br />
Quit from Postgres Terminal:<br />
<code>\q<br />
exit</code><br />
<br />
Login as postgres_user:<br />
<code>sudo su - postgres_user</code><br />
<br />
Open Postgres Terminal and open our database:<br />
<code>psql exampledb</code><br />
<br />
Create a new table:<br />
<code>CREATE TABLE exampleTable (<br />
id integer NOT NULL,<br />
storyText text,<br />
createdDate date<br />
);</code><br />
<br />
Set id as primary key:<br />
<code>ALTER TABLE ONLY exampleTable<br />
ADD CONSTRAINT exampleTable_pkey PRIMARY KEY (id);</code><br />
<br />
Insert some data into the table:<br />
<code>INSERT INTO exampleTable VALUES (1, 'Cheese is healthy', '2014-10-23');<br />
INSERT INTO exampleTable VALUES (2, 'Drink your Ovaltine', '2014-10-23');</code><br />
<br />
Quit from Postgres Terminal:<br />
<code>\q</code><br />
<br />
Now we have to enable remote access to the PostgreSQL Server.<br />
We open the pg_hba.conf file:<br />
<code>sudo su - postgres<br />
vi /etc/postgresql/9.3/main/pg_hba.conf</code><br />
<br />
Now add following line to this file (this allows access for all users with a valid password for all created databases):<br />
<code>host all all all md5</code><br />
<br />
Save and exit. The PostgreSQL server is configured to only accept connections from the localhost, we have to change this in the postgresql.conf file:<br />
<code>vi /etc/postgresql/9.3/main/postgresql.conf</code><br />
<br />
Change this line as follows:<br />
<code>listen_addresses='*'</code><br />
<br />
Save and exit. Restart PostgreSQL:<br />
<code>sudo service postgresql restart</code><br />
<br />
You're done. You can try to connect to your database server as follows (xxx is your IP adress):<br />
<code>psql -h xxx -U postgres_user exampledb</code><br />
The server will then ask you for your password to connect. If this doesn't work be sure that your firewall has port 5432 open.<br />
<br />
<br />
<h2>
Write your Servlet</h2>
We will use a small servlet to check the functionality and show how to use connection pooling.
A connection pool is a group of several connections, which the Server (in our case Tomcat) manages. The advantage is that not every process from our servlet will be creating a new connection, but the connections are kept open, thus increasing performance.
<br />
The setup is quite straightforward, and we will be focusing only on the differences to a normal servlet.
<br />
<b>context.xml</b>
If it doesn't exist yet, create a context.xml in the META-INF folder. The context stores all details about the connection, including username and password:
<br />
<code><pre><Context>
<Resource name="jdbc/postgres" auth="Container"
type="javax.sql.DataSource" driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://xxx:5432/exampledb"
username="postgres_user" password="myPassword" maxActive="20" maxIdle="10" maxWait="-1"/>
</Context></pre></code>
<br />
<b>web.xml</b>
The web.xml refers to the resource in the context.xml and allows us to directly gather the connection information from our servlet code. Add following tag into the outer <web-app>-tag:
<br />
<code><pre><resource-ref>
<description>postgreSQL Datasource</description>
<res-ref-name>jdbc/postgres</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<br /></pre></code>
<b>postgresServlet.java</b>
We will be writing a Servlet which outputs all error messages directly into the website, so that we immediately see if something's wrong.
<br />
<code><pre>
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
<br />
@WebServlet(name = "postgresServlet", urlPatterns = {"/postgresServlet"})
public class postgresServlet extends HttpServlet {
<br />
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
<br />
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet postgresServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Java version: </h1>" + System.getProperty("java.version"));
<br />
try {
InitialContext cxt = null;
try {
<br />
cxt = new InitialContext();
<br />
} catch (NamingException ex) {
out.println("<h1>NamingException for InitialContext</h1>");
out.println(ex.getExplanation() + "<br>Remaining: ");
out.println(ex.getRemainingName() + "<br>Resolved: ");
out.println(ex.getResolvedName());
}
if (cxt == null) {
out.println("<h1>No context found</h1>");
return;
}
DataSource ds = null;
try {
ds = (DataSource) cxt.lookup("java:/comp/env/jdbc/postgres");
} catch (NamingException ex) {
out.println("<h1>NamingException for context lookup</h1>");
out.println(ex.getExplanation() + "<br>Remaining: ");
out.println(ex.getRemainingName() + "<br>Resolved: ");
out.println(ex.getResolvedName());
}
<br />
if (ds == null) {
out.println("<h1>No datasource</h1>");
return;
}
Connection connection = ds.getConnection();
<br />
PreparedStatement st;
<br />
st = connection.prepareStatement("SELECT * FROM exampleTable");
ResultSet rs = st.executeQuery();
while (rs.next()) {
out.println("<h2>Column 2 returned " + rs.getString(2) + "</h2>");
}
rs.close();
st.close();
connection.close();
<br />
out.println("<h1>Servlet postgresServlet at " + request.getContextPath() + "</h1>");
out.println("</body>");
out.println("</html>");
} catch (SQLException ex) {
out.println("<h1>SQLexception</h1>");
} finally {
out.close();
}
}
<br />
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
<br />
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
}
</code></pre>
<br />
The DataSource is created in the line
<code>ds = (DataSource) cxt.lookup("java:/comp/env/jdbc/postgres");</code>
which looks it up from our web.xml (which in turn reads context.xml).
The connection is then created from the DataSource:
<code>Connection connection = ds.getConnection();</code>
The connection can then be used as always.
<br />
Compile your servlet into a War-file.
<h2>
Setting up the application server</h2>
Install Tomcat:<br />
<code>sudo apt-get install tomcat7</code><br />
<br />
Make sure it's not running yet:<br />
<code>sudo service tomcat7 stop</code><br />
<br />
Copy your War-File to the webapps directory in:<br />
<code>/var/lib/tomcat7/webapps/</code><br />
<br />
Before you start the webserver, the current PostgreSQL JDBC driver has to be added to Tomcat's lib folder.<br />
The driver can be found here: <a href="http://jdbc.postgresql.org/">http://jdbc.postgresql.org/</a><br />
Download it into following folder: <code>/usr/share/tomcat7/lib</code><br />
<br />
Tomcat can now be started as follows:<br />
<code>sudo service tomcat7 start</code><br />
<br />
After starting Tomcat you can see your servlet under http://localhost:8080/projectName/postgresServlet. If everything works okay, you should see the database entries (the second column) listed in the output.<br />
<br />
<br />
<br />GeneWarriorhttp://www.blogger.com/profile/06519322497972371416noreply@blogger.com