large letter outline stroke with sass - css

I have been using the text shadow trick of using a large text shadow to create the illusion of a larger stroke width for a letter outline. It works as is for my needs but I recently started using sass and was wondering if it was possible to convert my current css rules:
#title {
top:10px;
left:-30px;
color:white;
transform: scale(.8,1);
position: absolute;
font-size: 100px;
font-weight: bold;
text-transform: uppercase;
-webkit-font-smoothing: antialiased;
text-shadow: 0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%),
0 0 10px hsl(216,100%,50%); }
into something much shorter using the for loop controls in sass.
so far I've seen instructions on how to use the for loop to create multiple rules, but not yet to create multiple properties of a single rule. If it is possible, could someone give me an example? Or point me to documentation that I have been having a hard time finding? Or if it is not possible please let me know, so that I can move on in peace.

You can use the for loop to create your rule as a string, then use interpolation to apply it to the text-shadow property.
codepen
$text-shadow: '';
#for $i from 1 through 20 {
$text-shadow: $text-shadow + if($i == 1, '', ', ') + '0 0 10px hsl(216,100%,50%)';
}
text-shadow: #{$text-shadow};

Related

How to prevent background image from jumping on transition?

Is it possible to prevent background image from jumping effect when animation looping?
What i already tried:
Changing animation type from transition, to position change (left: 0 -> left: -100%)
Replacing background image to background gradient but result is the same
DEMO HERE
<button class="loader">
<span>Loader</span>
</button>
#keyframes sliding {
from {
transform: translateX(0%);
}
to {
transform: translateX(-50%);
}
}
body {
padding: 32px;
}
.loader {
width: 224px;
box-sizing: border-box;
padding: 14px;
border: none;
border-radius: 2px;
background-color: tomato;
position: relative;
overflow: hidden;
pointer-events: none;
}
.loader:after { content: '';
display: block;
position: absolute;
top: 0;
left: 0;
width: 200%;
height: 100%;
background-color: tomato;
background-image: url("data:image/svg+xml,%3Csvg width='210' height='59' viewBox='0 0 210 59' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0' mask-type='alpha' maskUnits='userSpaceOnUse' x='0' y='0' width='210' height='59'%3E%3Crect width='210' height='59' fill='%23C4C4C4'/%3E%3C/mask%3E%3Cg mask='url(%23mask0)'%3E%3Cg opacity='0.3' filter='url(%23filter0_d)'%3E%3Cpath d='M-42 0H-18L32 59H8L-42 0Z' fill='white'/%3E%3C/g%3E%3Cg opacity='0.3' filter='url(%23filter1_d)'%3E%3Cpath d='M0 0H24L74 59H50L0 0Z' fill='white'/%3E%3C/g%3E%3Cg opacity='0.3' filter='url(%23filter2_d)'%3E%3Cpath d='M42 0H66L116 59H92L42 0Z' fill='white'/%3E%3C/g%3E%3Cg opacity='0.3' filter='url(%23filter3_d)'%3E%3Cpath d='M84 0H108L158 59H134L84 0Z' fill='white'/%3E%3C/g%3E%3Cg opacity='0.3' filter='url(%23filter4_d)'%3E%3Cpath d='M126 0H150L200 59H176L126 0Z' fill='white'/%3E%3C/g%3E%3Cg opacity='0.3' filter='url(%23filter5_d)'%3E%3Cpath d='M168 0H192L242 59H218L168 0Z' fill='white'/%3E%3C/g%3E%3C/g%3E%3Cdefs%3E%3Cfilter id='filter0_d' x='-46' y='-2' width='82' height='67' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3E%3CfeFlood flood-opacity='0' result='BackgroundImageFix'/%3E%3CfeColorMatrix in='SourceAlpha' type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0'/%3E%3CfeOffset dy='2'/%3E%3CfeGaussianBlur stdDeviation='2'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.07 0'/%3E%3CfeBlend mode='normal' in2='BackgroundImageFix' result='effect1_dropShadow'/%3E%3CfeBlend mode='normal' in='SourceGraphic' in2='effect1_dropShadow' result='shape'/%3E%3C/filter%3E%3Cfilter id='filter1_d' x='-4' y='-2' width='82' height='67' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3E%3CfeFlood flood-opacity='0' result='BackgroundImageFix'/%3E%3CfeColorMatrix in='SourceAlpha' type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0'/%3E%3CfeOffset dy='2'/%3E%3CfeGaussianBlur stdDeviation='2'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.07 0'/%3E%3CfeBlend mode='normal' in2='BackgroundImageFix' result='effect1_dropShadow'/%3E%3CfeBlend mode='normal' in='SourceGraphic' in2='effect1_dropShadow' result='shape'/%3E%3C/filter%3E%3Cfilter id='filter2_d' x='38' y='-2' width='82' height='67' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3E%3CfeFlood flood-opacity='0' result='BackgroundImageFix'/%3E%3CfeColorMatrix in='SourceAlpha' type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0'/%3E%3CfeOffset dy='2'/%3E%3CfeGaussianBlur stdDeviation='2'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.07 0'/%3E%3CfeBlend mode='normal' in2='BackgroundImageFix' result='effect1_dropShadow'/%3E%3CfeBlend mode='normal' in='SourceGraphic' in2='effect1_dropShadow' result='shape'/%3E%3C/filter%3E%3Cfilter id='filter3_d' x='80' y='-2' width='82' height='67' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3E%3CfeFlood flood-opacity='0' result='BackgroundImageFix'/%3E%3CfeColorMatrix in='SourceAlpha' type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0'/%3E%3CfeOffset dy='2'/%3E%3CfeGaussianBlur stdDeviation='2'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.07 0'/%3E%3CfeBlend mode='normal' in2='BackgroundImageFix' result='effect1_dropShadow'/%3E%3CfeBlend mode='normal' in='SourceGraphic' in2='effect1_dropShadow' result='shape'/%3E%3C/filter%3E%3Cfilter id='filter4_d' x='122' y='-2' width='82' height='67' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3E%3CfeFlood flood-opacity='0' result='BackgroundImageFix'/%3E%3CfeColorMatrix in='SourceAlpha' type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0'/%3E%3CfeOffset dy='2'/%3E%3CfeGaussianBlur stdDeviation='2'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.07 0'/%3E%3CfeBlend mode='normal' in2='BackgroundImageFix' result='effect1_dropShadow'/%3E%3CfeBlend mode='normal' in='SourceGraphic' in2='effect1_dropShadow' result='shape'/%3E%3C/filter%3E%3Cfilter id='filter5_d' x='164' y='-2' width='82' height='67' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3E%3CfeFlood flood-opacity='0' result='BackgroundImageFix'/%3E%3CfeColorMatrix in='SourceAlpha' type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0'/%3E%3CfeOffset dy='2'/%3E%3CfeGaussianBlur stdDeviation='2'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.07 0'/%3E%3CfeBlend mode='normal' in2='BackgroundImageFix' result='effect1_dropShadow'/%3E%3CfeBlend mode='normal' in='SourceGraphic' in2='effect1_dropShadow' result='shape'/%3E%3C/filter%3E%3C/defs%3E%3C/svg%3E%0A");
color: white;
background-repeat: repeat-x;
animation: sliding 1.75s linear infinite;
will-change: transform;
}
.loader span {
line-height: 20px;
font-size: 16px;
color: white;
}
As the background is repeated we can have this animation definition and can control the speed of the animation by setting 60-120s as per your requirement for the animation property.
#keyframes sliding {
from {
background-position: 0 0;
}
/*use negative width if you want it to flow right to left else and positive for left to right*/
to {
background-position: -10000px 0;
}
}

Glowing animation on SVG using CSS

I am trying to apply glowing shadow effect on SVG icon but it does not work.
I have similar thing applied on text and that works fine using text-shadow:
.glow {
font-weight: 450;
-webkit-animation: glow 1.5s ease-in-out infinite alternate;
-moz-animation: glow 1.5s ease-in-out infinite alternate;
animation: glow 1.5s ease-in-out infinite alternate;
}
#-webkit-keyframes glow {
from {
text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #e60073, 0 0 20px #e60073,
0 0 25px #e60073, 0 0 30px #e60073, 0 0 35px #e60073;
}
to {
text-shadow: 0 0 10px #fff,
0 0 15px #ff9800 0 0 20px #ff9800 0 0 25px #ff9800 0 0 30px #ff9800 0 0
40px #ff9800 0 0 45px #ff4da6;
}
}
<a href="#sec1" class="nav-link glow">
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="home" style="max-width:50px" class="svg-inline--fa fa-home fa-w-18 svg-shadow" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M280.37 148.26L96 300.11V464a16 16 0 0 0 16 16l112.06-.29a16 16 0 0 0 15.92-16V368a16 16 0 0 1 16-16h64a16 16 0 0 1 16 16v95.64a16 16 0 0 0 16 16.05L464 480a16 16 0 0 0 16-16V300L295.67 148.26a12.19 12.19 0 0 0-15.3 0zM571.6 251.47L488 182.56V44.05a12 12 0 0 0-12-12h-56a12 12 0 0 0-12 12v72.61L318.47 43a48 48 0 0 0-61 0L4.34 251.47a12 12 0 0 0-1.6 16.9l25.5 31A12 12 0 0 0 45.15 301l235.22-193.74a12.19 12.19 0 0 1 15.3 0L530.9 301a12 12 0 0 0 16.9-1.6l25.5-31a12 12 0 0 0-1.7-16.93z"></path></svg>
<span class="link-text">NASLOVNA</span>
</a>
So I tried same thing with SVG using webkit-filter: drop-shadow witch if you un-comment the line successfully drops shadow on SVG but I can not make it work to animate. I cant seem to find anywhere example of animation of SVG using shadow, i find some using fill but that does not interest me.
Any guidance is appreciated.
.svg-shadow {
/*-webkit-filter: drop-shadow( 3px 3px 2px #ff5722); */
-webkit-animation: svg-shadow 1.5s ease-in-out infinite alternate;
-moz-animation: svg-shadow 1.5s ease-in-out infinite alternate;
animation: svg-shadow 1.5s ease-in-out infinite alternate;
}
#-webkit-keyframes svg-shadow {
from {
-webkit-filter: drop-shadow( 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #e60073, 0 0 20px #e60073,
0 0 25px #e60073, 0 0 30px #e60073, 0 0 35px #e60073);
}
to {
-webkit-filter: drop-shadow( 0 0 10px #fff,
0 0 15px #ff9800 0 0 20px #ff9800 0 0 25px #ff9800 0 0 30px #ff9800 0 0
40px #ff9800 0 0 45px #ff4da6);
}
}
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="home" class="svg-inline--fa fa-home fa-w-18 svg-shadow" role="img" style="max-width:50px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M280.37 148.26L96 300.11V464a16 16 0 0 0 16 16l112.06-.29a16 16 0 0 0 15.92-16V368a16 16 0 0 1 16-16h64a16 16 0 0 1 16 16v95.64a16 16 0 0 0 16 16.05L464 480a16 16 0 0 0 16-16V300L295.67 148.26a12.19 12.19 0 0 0-15.3 0zM571.6 251.47L488 182.56V44.05a12 12 0 0 0-12-12h-56a12 12 0 0 0-12 12v72.61L318.47 43a48 48 0 0 0-61 0L4.34 251.47a12 12 0 0 0-1.6 16.9l25.5 31A12 12 0 0 0 45.15 301l235.22-193.74a12.19 12.19 0 0 1 15.3 0L530.9 301a12 12 0 0 0 16.9-1.6l25.5-31a12 12 0 0 0-1.7-16.93z"></path></svg>
Your syntax of multiple shadow is wrong, it need to be like below:
.svg-shadow {
animation: svg-shadow 1.5s ease-in-out infinite alternate;
}
#keyframes svg-shadow {
from {
filter: drop-shadow( 0 0 5px #fff) drop-shadow( 0 0 15px #e60073) drop-shadow( 0 0 20px #e60073);
}
to {
filter: drop-shadow( 0 0 20px #fff) drop-shadow( 0 0 25px #e60073) drop-shadow( 0 0 40px #e60073);
}
}
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="home" class="svg-inline--fa fa-home fa-w-18 svg-shadow" role="img" style="max-width:50px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M280.37 148.26L96 300.11V464a16 16 0 0 0 16 16l112.06-.29a16 16 0 0 0 15.92-16V368a16 16 0 0 1 16-16h64a16 16 0 0 1 16 16v95.64a16 16 0 0 0 16 16.05L464 480a16 16 0 0 0 16-16V300L295.67 148.26a12.19 12.19 0 0 0-15.3 0zM571.6 251.47L488 182.56V44.05a12 12 0 0 0-12-12h-56a12 12 0 0 0-12 12v72.61L318.47 43a48 48 0 0 0-61 0L4.34 251.47a12 12 0 0 0-1.6 16.9l25.5 31A12 12 0 0 0 45.15 301l235.22-193.74a12.19 12.19 0 0 1 15.3 0L530.9 301a12 12 0 0 0 16.9-1.6l25.5-31a12 12 0 0 0-1.7-16.93z"></path></svg>

Converting a single cell count matrix that is currently a text file into a data frame

I have downloaded some files off the internet that are single cell count matrices, and I want to convert them into dataframes in R. I have used readLines to read the text files in, but now each line of the file looks like this:
3110082J24Rik\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0
For some context, the columns in a single cell matrix file are the cells, and the rows are the genes. The numbers in the file indicate the number of times that the gene (for this line, 3110082J24Rik) appears in each cell. Anyone have any idea how I could do this? Here is some sample data:
ID W308561 W308562 W308563 W308564 W308565 W308566 W308567 W308568 W308569 W308570 W308571 W308572 W308573 W308574 W308575 W308576 W308577 W308578 W308579 W308580 W308581 W308582 W308583 W308584 W308585 W308586 W308587 W308588 W308589 W308590 W308591 W308592 W308593 W308594 W308595 W308596 W308597 W308598 W308599 W308600 W308601 W308602 W308603 W308604 W308605 W308606 W308607 W308608 W308609 W308610 W308611 W308612 W308613 W308614 W308615 W308616 W308617 W308618 W308619 W308620 W308621 W308622 W308623 W308624 W308625 W308626 W308627 W308628 W308629 W308630 W308631 W308632 W308633 W308634 W308635 W308636 W308637 W308638 W308639 W308640 W308641 W308642 W308643 W308644 W308645 W308646 W308647 W308648 W308649 W308650 W308651 W308652 W308653 W308654 W308655 W308656 W308657 W308658 W308659 W308660 W308661 W308662 W308663 W308664 W308665 W308666 W308667 W308668 W308669 W308670 W308671 W308672 W308673 W308674 W308675 W308676 W308677 W308678 W308679 W308680 W308681 W308682 W308683 W308684 W308685 W308686 W308687 W308688 W308689 W308690 W308691 W308692 W308693 W308694 W308695 W308696 W308697 W308698 W308699 W308700 W308701 W308702 W308703 W308704 W308705 W308706 W308707 W308708 W308709 W308710 W308711 W308712 W308713 W308714 W308715 W308716 W308717 W308718 W308719 W308720 W308721 W308722 W308723 W308724 W308725 W308726 W308727 W308728 W308729 W308730 W308731 W308732 W308733 W308734 W308735 W308736 W308737 W308738 W308739 W308740 W308741 W308742 W308743 W308744 W308745 W308746 W308747 W308748 W308749 W308750 W308751 W308752 W308753 W308754 W308755 W308756 W308757 W308758 W308759 W308760 W308761 W308762 W308763 W308764 W308765 W308766 W308767 W308768 W308769 W308770 W308771 W308772 W308773 W308774 W308775 W308776 W308777 W308778 W308779 W308780 W308781 W308782 W308783 W308784 W308785 W308786 W308787 W308788 W308789 W308790 W308791 W308792 W308793 W308794 W308795 W308796 W308797 W308798 W308799 W308800 W308801 W308802 W308803 W308804 W308805 W308806 W308807 W308808 W308809 W308810 W308811 W308812 W308813 W308814 W308815 W308816 W308817 W308818 W308819 W308820 W308821 W308822 W308823 W308824 W308825 W308826 W308827 W308828 W308829 W308830 W308831 W308832 W308833 W308834 W308835 W308836 W308837 W308838 W308839 W308840 W308841 W308842 W308843 W308844 W308845 W308846 W308847 W308848 W308849 W308850 W308851 W308852 W308853 W308854 W308855 W308856 W308857 W308858 W308859 W308860 W308861 W308862 W308863 W308864 W308865 W308866 W308867 W308868 W308869 W308870 W308871 W308872 W308873 W308874 W308875 W308876 W308877 W308878 W308879 W308880 W308881 W308882 W308883 W308884 W308885 W308886 W308887 W308888 W308889 W308890 W308891 W308892 W308893 W308894 W308895 W308896 W308897 W308898 W308899 W308900 W308901 W308902 W308903 W308904 W308905 W308906 W308907 W308908 W308909 W308910 W308911 W308912 W308913 W308914 W308915 W308916 W308917 W308918 W308919 W308920 W308921 W308922 W308923 W308924 W308925 W308926 W308927 W308928 W308929 W308930 W308931 W308932 W308933 W308934 W308935 W308936 W308937 W308938 W308939 W308940 W308941 W308942 W308943 W308944
0610005C13Rik 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
In the ideal world, each of the labels at the top that starts with "W" would be a separate column with the corresponding numbers for each gene also in that column.

Handle error with try in R

I am trying to make function that returns geometric mean with data.
I want to make loop with try() to pass valid data, but what i tried actually didn't worked.
This is function
R=function(g)
{
k=1
n=length(g)
for(i in 1 : n)
{
ifelse(g[i]>0, k<-k*g[i], stop("Negative component"))
k
}
t=k^(1/n)
t
}
And i want to use this function in this loop
set.seed(123)
data <- matrix(rnorm(10000, mean=3), ncol=25, dimnames=list(NULL, paste("X",
1:25, sep=".")))
v=rep(0,400)
for(i in 1 : 400)
{
try("v[i]=R(data[,i])",TRUE)
}
v
I want to get means for valid data, but it makes all value to 0
[1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[37] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[73] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[109] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[145] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[181] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[217] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[253] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[289] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[325] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[361] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[397] 0 0 0 0
Can you let me know where was wrong??
Thanks
I guess the problem is with the missing declaration of t as a numeric vector and the syntax of try() function. The following code should work, it worked for me.
R=function(g)
{
t = numeric(length(g))
k=1
n=length(g)
for(i in 1 : n)
{
ifelse(g[i]>0, k<-k*g[i], stop("Negative component"))
}
t=k^(1/n)
t
}
set.seed(123)
data <- matrix(rnorm(10000, mean=3), ncol=25, dimnames=list(NULL,paste("X",
1:25, sep=".")))
v=numeric(400)
for(i in 1 : 400)
{
try(v[i]<-R(data[i,]),TRUE)
}
v

Error when decrypting with OpenSSL rsa key

I am trying to write a simple application to encrypt/decrypt a buffer of unsigned char using OpenSSL RSA encryption. I have my public key and encrypt an array with
unsigned char plain [13] = "Hello World!";
unsigned char encrypted[1024]={};
unsigned char decrypted[1024]={};
int padding = RSA_PKCS1_OAEP_PADDING;
int flen = 13;
int res = RSA_public_encrypt(flen, plain, encrypted, rsa_pbk, padding);
where rsa_pbk is an RSA structure that contains the key. If I print it, the result is the following hexadecimal array:
13 d0 44 a3 2b 12 67 d8 e2 aa cf 53 6c 81 ed e9 9e 2d 9c dd 1d 28 84 5b 60 93 58 1c 7f eb b 66 26 39 8c 27 48 11 31 6 53 90 16 2e da 5c 7e 48 3e 15 c2 19 d3 10 79 71 1a fa f7 c1 57 93 82 f2 95 1 e d8 70 ba 1b 7e 12 d5 a 34 75 8f 2f 3c a6 60 f1 4b 60 6c 94 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0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
I am a little bit suspicious of the zeros at the end, but it could be ok. But, when I try to decrypt it with
flen = keysize - 50;
RSA_private_decrypt(flen, encrypted, decrypted, this->rsa_pvk, padding);
I get the following error
error:0407A079:rsa routines:RSA_padding_check_PKCS1_OAEP:oaep decoding error
error:04065072:rsa routines:RSA_EAY_PRIVATE_DECRYPT:padding check failed
that I'm not able to understand. Does anybody know what it means and why it arises?
Manual page states that: RSA_public_encrypt() returns the size of the encrypted data. RSA_private_decrypt() returns the size of the recovered plaintext. On error, -1 is returned; the error codes can be obtained by ERR_get_error(3).
Your code should look like this:
unsigned char plain [13] = "Hello World!";
unsigned char encrypted[1024]={};
unsigned char decrypted[1024]={};
int padding = RSA_PKCS1_OAEP_PADDING;
int flen = 13;
int res = RSA_public_encrypt(flen, plain, encrypted, rsa_pbk, padding);
flen = res;
res = RSA_private_decrypt(flen, encrypted, decrypted, this->rsa_pvk, padding);

Resources