text:
ALONG THE WATER, DISASTERS WAITING FOR THEIR MOMENT
BILLIONS OF DOLLARS ARE SPENT TO SUSTAIN EXPENSIVE PROPERTIES IMPERILED BY STORMS.
by Gilbert M. Gaul and Anthony R. Wood, INQUIRER STAFF WRITERS, Posted: May 7, 2007
Thirty-eight years ago this week, the most devastating coastal storm in New Jersey history inundated Long Beach Island, drowning seven people, uprooting 600 houses, and tearing the slender barrier island into six pieces.
RELIABLE DATA LACKING TO ASSESS VALUE OF COASTAL ECONOMIES
Along the Eastern Seaboard, from North Carolina to New York, the great Ash Wednesday Storm of 1962 killed 22 people, pounded 50,000 houses, and left $1.3 billion in damage.
So shocking was the destruction that state and federal officials suggested the unthinkable: restoring the vulnerable shoreline to its natural state - a buffer zone off-limits to risky development.
But no one listened.
Aided by generous disaster dollars, federal loans, and a grab bag of other taxpayer subsidies, beach towns built back bigger and closer than ever before.
Instead of a natural buffer, a barricade of pricey real estate now lines the nation's endangered coasts.
Today, Long Beach Island is crowded from dune to bay with vacation homes and investment properties worth nearly $5 billion. It is one piece of a building boom that has transformed the nation's shoreline from seaside hamlets to exclusive resorts worth an estimated $2 trillion.
The unchecked development of America's fragile coasts in the last half-century, a frenzy of building with little national forethought, has come at a hefty price.
The American dream of a house at the beach has turned into a taxpayer nightmare: billions of federal dollars to repair resorts damaged again and again. Billions more to monitor and fix environmental problems - water pollution, unchecked runoff, leaky sewers, vanishing wetlands. And still billions more in decades to come in an endless struggle to guard beachfront real estate from rising seas and inevitable storms.
"These are not random acts of God," said Gregory E. van der Vink, who teaches a course on disasters at Princeton University. "It's only when people build in dangerous places that it becomes a natural disaster. "
To accommodate this risky development, the government has been forced into odd and costly roles: The nation's disaster agency sells flood insurance. The Army pumps sand on beaches. Through such policies, Washington lawmakers have painted themselves and the nation's taxpayers into an increasingly costly corner.
In New Jersey, where $34 billion of property lines the eroding coast from Sea Bright to Cape May Point, some state officials concede that efforts to control building have failed. "We had sprawl, sprawl, sprawl all over the place. There was no planning, really," said Judy Jengo, deputy commissioner for the Department of Environmental Protection.
To defend all this investment, state and local officials have erected a Maginot Line of seawalls, groins, jetties, sandbags and underwater reefs extending the entire 109 miles of developed coast. It is the state's counterattack against erosion and the natural migration of barrier islands. Before development took hold, these vulnerable sandbars were reshaped and re-formed by storms and rising seas, without economic consequence.
New Jersey also is home to the nation's most expensive beachfill, a $1.5 billion federally funded project - and officials in New Jersey and other states are lobbying for billions more for other shore projects.
Despite these costly and extraordinary efforts, taxpayer-funded disaster spending in coastal states is increasing dramatically. In the 1990s alone, more than $9 billion in federal disaster aid went to coastal areas, along with billions more in taxpayer-subsidized loans, flood payments and other assistance.
Often, the beneficiaries are seasonal vacation resorts where storms and flooding are as common as snow in Buffalo. Yet under the government's generous rules, man-made disasters are treated the same as natural disasters such as Hurricane Floyd that devastate inland towns where people live and work year-round.
Even modest storms can unleash a flood tide of taxpayer relief. The government has committed billions for roads, utilities, water systems, business loans, landscaping, ball fields, golf courses, marinas and Christmas decorations. It also picks up part of the bill when coastal resorts are forced to evacuate - whether a storm hits or not.
More than ever, the densely developed U.S. coastline stands at risk from rising sea levels, eroding beaches, and a growing number of destructive hurricanes and coastal storms.
For as busy as the 1999 hurricane season was, it did not produce the cataclysmic storm that weather experts say is all but inevitable. A major hurricane striking Miami or New Orleans would cost upward of $100 billion, with taxpayers shouldering much of the cost.
Over the next six days, The Inquirer will examine how government policies have encouraged and subsidized hazardous development at the coast, insulating resorts from the consequences of their risky building, and exposing the U.S. Treasury to huge losses for decades to come.
Item: An unparalleled building boom has placed billions in coastal property in harm's way.
Florida is especially vulnerable, with more than a half-trillion dollars of property and a population that has increased fivefold since 1950 - adding 4,000 people a week. All of this building occurred in one of the quietest hurricane periods in history. Florida has not suffered a catastrophic Category 5 hurricane in 64 years.
"We've got a policy in the state that says we won't encourage development in hazardous areas," says Ralph Cantral, director of Florida's coastal management program. "There's obviously a problem with the nomenclature, because most of the coast of Florida is a hazard. "
Item: The United States has spent $140 billion on all forms of disaster assistance since 1950. Disaster spending by the Federal Emergency Management Agency alone has jumped 72-fold since the 1950s, adjusted for inflation. One hurricane, Georges in 1998, has cost taxpayers $2 billion. In the previous four decades, only one hurricane cost $500 million. Often, aid goes for cosmetic repairs, from street signs to tennis courts.
Item: The government's grab bag of subsidies has fostered an entitlement mentality among many beachfront investors, who often want the government off their backs - except when disaster strikes. The National Flood Insurance Program subsidizes the riskiest beachfront properties. Yet Congress has stopped the program from charging the owners of those properties a fair premium or building adequate reserves, relying instead on the U.S. Treasury.
Item: Investors building along vulnerable coastlines benefit from generous tax breaks. Heading the list: property-tax and mortgage-interest deductions for vacation homes. Owners of rental properties may deduct up to $25,000 in business expenses, from painting to landscaping to utility bills. And if they drive to the beach to check on their property, that's deductible, too.
By comparison, families paying college tuition bills or raising chronically ill children are allowed only modest deductions, with strict income limits. And if you drive to visit a prospective college, sorry, no deduction.
Item: These subsidies help prop up towns dominated by vacation homes, not towns where people live and work year-round. Many beach towns in New Jersey are empty eight months of the year, ghost towns that turn off the traffic lights after Labor Day.
In some towns, the already-tiny year-round populations are being driven out by soaring land values and larger and more lavish resorts. This trend toward upscale building is transforming the character and landscape of the coast from Nantucket to Key West to Seattle, pricing out middle-class Americans.
Many coastal-management agencies, issuing thousands of building permits, are virtually powerless to stop risky building and overdevelopment. That's because land-use decisions are made locally, and that authority is jealously guarded.
"I can tell you without a doubt that several developments we approved make no sense whatsoever," said Courtney Hackney, a member of North Carolina's Coastal Resources Commission, a rule-making body.
North Carolina and New Jersey have issued tens of thousands of coastal building permits since the mid-1970s, yet still cannot say how many beachfront houses line their shores, let alone the effect of all that building. "It would be something that would be useful to know," said Jengo of the Environmental Protection Department.
Regulators struggling to manage coastal development are hamstrung by weak and contradictory rules, legal decisions favoring property owners, and a nearly total breakdown in oversight. The federal Coastal Zone Management program, for example, has spent $1.2 billion since 1972 to help states, yet officials who run it say they have no data to measure its effect.
Today, many coastal programs are stalled in a regulatory gridlock of competing interests among local politicians, developers, environmentalists and state bureaucrats.
South Carolina adopted strict controls on beachfront building in 1988. A developer sued, contending that the rules prevented him from selling two lots on Isle of Palms, a resort near Charleston. The U.S. Supreme Court agreed, and the state had to pay the developer $1.6 million for the lots. The regulators then sold the same lots to builders to recoup their costs - in effect becoming developers.
A loophole in New Jersey's coastal management act allowed thousands of beach houses to be built without permits. In 1993, legislators narrowed the loophole, which had allowed developments of 24 or fewer units to escape scrutiny. However, they added a loophole: exempting storm-damaged houses from review if owners rebuilt.
That year, legislators ordered the Department of Environmental Protection to adopt stricter controls over coastal development. Seven years later, the agency introduced its rules, which were immediately attacked both by builders and environmentalists.
Jengo said rules eventually should do a better job of checking growth along the back bays. As for the barrier islands? It's too late. "They're already built out," she said.
New Jersey has a policy that it will not force property owners to move back as its beaches erode. "It's too late to retreat," says James Mancini, mayor of Long Beach Township for 35 years, and a former developer. "It's a pipe dream of these pseudo-environmentalists. "
The coast has been built out, and is too valuable an investment to abandon. The government is stuck. Policies that helped spur development now serve to protect it.
To retreat, or rebuild?
The 1962 Ash Wednesday Storm was a defining moment in the history of coastal development. The nation had a unique opportunity to pull back from the dangerous shoreline. But instead of retreating, beach towns rebuilt. Ironically, storms offered a form of urban renewal, a pattern that was repeated with Hurricane Frederic in 1979; Hugo in 1989; Andrew in 1992; Opal in 1995; and Georges in 1998.
"The building and construction industry loves it," said Miles Lawrence, a 33-year veteran of the National Hurricane Center in Miami. "Let the hurricane tear it up. We'll rebuild it. "
On Long Beach Island, the Ash Wednesday Storm did kill the real estate market - for all of three months.
"We wondered how we would sell another house on the island," recalled Herbert Shapiro, one of the island's pioneer developers. But by June of that year, speculators and prospective homeowners returned, looking for bargains.
Today, Long Beach Island is one of the country's most densely developed barrier islands, with shoulder-to-shoulder beach crowds and weekend traffic jams. Most of the $5 billion worth of property is owned by out-of-towners, many of whom were not around for the Ash Wednesday nor'easter.
One who was there was Joe Veitch, a 27-year-old first aid volunteer in 1962. On the morning of March 7, he watched as surging waves severed the island, trapping and drowning two elderly couples. "If we ever got another one like that, I don't think this island could take it," he said.
In the tightly packed village of Harvey Cedars, where the ocean poured into the bay in four places, the front line of 112 beach houses alone is now worth $59 million. That's more than the value of the entire town in 1962, adjusted for inflation.
In 1962, 18-mile Long Beach Island had $136 million of resort property. Today, the 1,064 houses lining the beach alone are worth $566 million. Long Beach Township had property worth $335 million in 1962; today, it's worth $2.2 billion. That's a gain of $944,000 a week for the last 38 years.
"These are just getting to be numbers anymore," says Janet Ford, who works in the Long Beach Township tax office. "It's not real. "
Rising land values have made the Beach Haven bungalow owned by Joe Sprague, who has lived on Long Beach Island most of his 98 years, an endangered species - and also quite an investment.
Sprague bought his cottage a half-century ago for $350. Today, if a buyer were to erect a house on the land, the property would be worth at least $400,000 - a 1,143-fold increase.
Stunning recoveries
Like Long Beach Island, Sea Isle City was decimated by the Ash Wednesday Storm. It took out 30 blocks of beachfront homes and 10 percent of the tax base.
Like Long Beach Island, Sea Isle recovered. And then some.
In 1999, the town's assessed value was $1 billion - 42 times as much as in 1962.
The whine of circular saws and pounding hammers fills the air as the island reshapes itself from modest beach town to increasingly pricey resort.
"Sea Isle is hot," boasts Mayor Leonard Desiderio. "Sea Isle is on a roll. "
That's a refrain heard again and again traveling the nation's fragile shoreline, as the equivalent of an economic trifecta - a surging economy, a robust stock market, and a tide of disposable income - combine to fuel an extraordinary building boom.
It is a remarkable, if uncharted, shift that takes many forms:
Nags Head, N.C.: In a town hammered by Tropical Storm Dennis in August, Malcolm Fearing, a developer, talks about a new generation of cottage. "I had one cottage that I rented for $600 a week. We tore it down and are building a new house with 5,200 square [foot] space, nine bedrooms, and we will rent it for $5,500 to $6,000 a week. " He whistles for emphasis. "I don't know why they call it a cottage. It's a damn motel. It's just a pure, doggone investment. "
Wrightsville Beach, N.C.: Real estate in the once-quaint family retreat there is worth $1.4 billion, more than double its value only eight years ago. "Wrightsville used to be a working-class beach town; people actually lived there," said North Carolina's Hackney. "Now [houses in] developments cost $500,000 to $1 million and nobody can afford to live there. "
Folly Beach, S.C.: Property owners say Hurricane Hugo was the best thing that ever happened to the slender barrier island. The 1989 hurricane tore apart old homes and freed up disaster aid, sparking an economic rally. Says town building inspector Tom Hall: "Now it's almost impossible to find a vacant beachfront lot. "
Destin, Fla.: Property values are rising so quickly that city employees cannot afford to live there anymore. Only a decade ago, Destin was a fishing village best known for pompano, mackerel, and the cobia run in the spring. Now, millionaire investors jet into a local airport and stay in gated villas. "Here, there are no architectural guidelines," says Robert P. Franke, the city's planner. "You have Federalist, Mediterranean and Cracker. . . . The state's mandate to cut back on sprawl, it's not taking hold here. "
In Florida, coastal towns have to submit land-use plans to the state, but they are not models of restraint, said Cantral, the state coastal management director. Were all the planned development to occur, the coastal population would swell tenfold - to 90 million people, Cantral said.
Some resort towns now are as densely built as the nation's largest cities. Census data show that Wildwood is more densely developed than Baltimore; Margate than Newark; Surf City than Camden.
Houses are getting bigger, gobbling up more square feet than ever before and rising higher into the air. In many shore towns, it is nearly impossible to see the ocean, beach or bay because of the walls of buildings.
"Ocean City used to be a family resort," said Tom Cleary, who has lived on a modest rancher on Mariana Lane for 22 years. "People could come down here and buy a small home. "
Now, developers are tearing down those homes and putting up duplexes, he said. Now, it's noisier and more crowded. Cars jam the streets. There's no place to park.
"Basically, it ceases to be a family town," he said. "It becomes a greed town. It's strictly greed, greed, greed. "
Building bigger
One of the first things Dave Owens did when he went to work for North Carolina as a coastal regulator 20 years ago was take a ride on the beach. Owens, a lawyer and planner, was assigned to sort out development plans for the Currituck Outer Banks, then one of the country's most coveted stretches of virgin barrier island.
For more than a century, the unspoiled stretch of wild dunes, maritime forest and salt marshes had dodged development pressures that had overwhelmed such nearby towns as Kitty Hawk, Kill Devil Hills, and Nags Head. As recently as 1980, only a hundred or so people lived on the 23-mile barrier strip.
Owens faced a unique challenge: How to preserve the distinctive character of the Currituck Banks without closing the door on development for the cash-starved rural county that extends across the shallow sound.
On the makeshift beach road from Virginia to the Dare County border, Owens recalls, "I could drive at 30 m.p.h. and count every house. "
Today, there are more than 2,500 houses on the Currituck Banks, 83 times the number two decades ago. Almost all are rental properties and second homes, some worth millions. The barrier island accounts for 62 percent - or more than $1 billion - of Dare County's tax base, but less than 5 percent of its full-time population. At 65 cents per $100 of assessed value, the county has one of the country's lower tax rates.
In summer, the population swells to 30,000 from 500 - even though developers, under pressure from environmentalists and state regulators, agreed to scale back densities. And Route 12, a winding, two-lane blacktop, can barely contain all the Range Rovers, Volvos and minivans carrying vacationers from a half-dozen states.
The county projects that by 2020 the number of houses on the Currituck Banks will more than double, to 6,000. The summer population is projected to swell to 70,000.
Developments such as Pine Island, an old hunting club on an isolated strip of wild dunes, now offer massive oceanfront houses that sleep up to five families and rent for $12,000 a week. Catalogs tout them as perfect for wedding receptions and corporate meetings.
"It used to be people would put a cottage down on the beach, even a nice one," said Currituck County Tax Assessor Tracy Sample. "Now they put down a mansion costing $1 million. It's crazy. "
With land prices soaring, owners feel compelled to build bigger to justify their investments, especially if it's a rental property. And, says Bill Hollan, a Pine Island developer, "Part of it is just keeping up with the Joneses. "
For planners, the boom has created a new wave of pressures. Route 12 is choked with traffic, as are rural highways carrying vacationers from the Virginia line to the Outer Banks' Wright Memorial Bridge.
In August 1998, when the county ordered an evacuation for Hurricane Bonnie, it took vacationers five hours to drive 12 miles from the county line to the bridge. "People were getting frustrated and driving on the shoulder. People were throwing rocks at them," says Jack Simoneau, the county planning director.
Rapid development may also be outstripping the area's water supply, a thin lens of freshwater that sits atop a lake of saltwater. Some private wells in the older Whalehead Division already have run dry or have suffered saltwater intrusion. The county plans to spend millions to build a desalinization plant, similar to one in the nearby Nags Head area.
Norris Austin, a lifelong resident, watches the breakneck development with a sense of irony. "They come from New York, New Jersey, and they say they like the remoteness of the area," he says. "But then they want to put a 7-Eleven on every corner. "
Growing battle-weary
As development has exploded up and down North Carolina's barrier islands, from Currituck to Calabash, so has the toll of storm damage. In August, Tropical Storm Dennis tore up Hatteras Island, Nags Head, and other towns on the Outer Banks, undermining or destroying scores of houses and causing millions in losses.
Two weeks later, Hurricane Floyd damaged 600 homes on Emerald Isle, where property values had more than doubled in a decade. It took out 100 beach homes worth $27 million on Oak Island. And it exposed septic tanks and the stench of raw sewage at Holden Beach.
For battle-weary officials of North Topsail Beach, Floyd was yet another reminder of their vulnerability. The barrier island is a veritable punching bag for hurricanes, and is viewed by some as a national symbol of the futile fight against nature.
In 1996, it was slammed by Hurricanes Bertha and Fran, which washed away half the town's dunes, eroded 50 feet of shoreline, rendered 350 beachfront lots unbuildable, and erased $72 million of the resort's tax base.
More than $6 million in federal disaster aid poured in to rebuild dunes, roads, sewers, and damaged public buildings. The town spent $127,000 planting beach grass in an effort to reestablish its building line.
Two years later, Hurricane Bonnie washed away half of the rebuilt dune and beach grass. Last summer, Floyd finished the job. The storm surge overwhelmed the remaining dunes, cut channels across the island, sent waves crashing into condominiums, toppled mobile homes, and crumpled foundations of beachfront properties.
For town officials, the timing could not have been worse. That August they had informed owners of 30 oceanfront properties that they could rebuild on lots taken by the earlier storms. "Now they're probably unbuildable again," said Town Manager Charles A. Hammond.
In a Sisyphean effort, the town is rebuilding its dunes, and looking to the federal government for financial help. The locals vigorously defend the effort.
"This is a great place," said Scott Murray, a developer in North Topsail. "We just had a little setback. "
Inquirer researcher Frank Donahue contributed to this article.
Posted: May 7, 2007 - 2:49 AM
Gilbert M. Gaul and Anthony R. Wood, INQUIRER STAFF WRITERS
On the market: Victorian twin in Chestnut Hill for $445,000
Paul Jablow, For The Inquirer
Report: Build differently for climate change
Kellie Patrick Gates, PlanPhilly
Condo sales, disrupted by a 2009 sheriff's sale, to resume at 1352 Lofts
Alan J. Heavens, Inquirer Real Estate Writer
Historical Commission reviews plans for new 21st and Walnut townhouses
JoAnn Greco, PLANPHILLY.COM

redpajama_set_name: RedPajamaCommonCrawl


text:
<tool id="hisat2" name="HISAT2" version="2.1.0+galaxy4" profile="17.01">
    <description>A fast and sensitive alignment program</description>
    <macros>
        <import>hisat2_macros.xml</import>
    </macros>
    <requirements>
        <requirement type="package" version="2.1.0">hisat2</requirement>
        <requirement type="package" version="1.9">samtools</requirement>
        <requirement type="package" version="1.3">seqtk</requirement>
    </requirements>
    <stdio>
        <regex level="fatal" match="hisat2-align exited with value 1" source="both" />
        <regex level="fatal" match="hisat2: not found" source="both" />
        <exit_code range="1:" />
    </stdio>
    <version_command>hisat2 --version</version_command>
    <command><![CDATA[
## Prepare HISAT2 index

#if $reference_genome.source == "history":
    ln -s '$reference_genome.history_item' genome.fa &&
    hisat2-build -p \${GALAXY_SLOTS:-1} genome.fa genome &&
    #set index_path = 'genome'
#else:
    #set index_path = $reference_genome.index.fields.path
#end if

## If using known splice sites

#if str($adv.spliced_options.spliced_options_selector) == "advanced" and str($adv.spliced_options.known_splice_gtf) != 'None':
    ln -s '${adv.spliced_options.known_splice_gtf}' splice_sites.gtf &&
    hisat2_extract_splice_sites.py splice_sites.gtf > splice_sites.txt &&
#end if

## Link in the input files, so HISAT2 can tell their type

#set compressed="False"
#set reads_are_fastq = True

#if str($library.type) == 'paired':
    #if $library.input_1.is_of_type("fastq.gz", "fastqsanger.gz"):
        #set read1 = "input_f.fastq.gz"
        #set compressed = "GZ"
    #elif $library.input_1.is_of_type("fastq.bz2", "fastqsanger.bz2"):
        #set read1 = "input_f.fastq.bz2"
        #set compressed = "BZ2"
    #elif $library.input_1.is_of_type('fasta'):
        #set reads_are_fastq = False
        #set read1 = "input_f.fasta"
    #else:
        #set read1 = "input_f.fastq"
    #end if
    ln -f -s '${library.input_1}' ${read1} &&

    #if $library.input_2.is_of_type("fastq.gz", "fastqsanger.gz"):
        #set read2 = "input_r.fastq.gz"
        #set compressed = "GZ"
    #elif $library.input_2.is_of_type("fastq.bz2", "fastqsanger.bz2"):
        #set read2 = "input_r.fastq.bz2"
        #set compressed = "BZ2"
    #elif $library.input_2.is_of_type('fasta'):
        #set read2 = "input_r.fasta"
    #else:
        #set read2 = "input_r.fastq"
    #end if
    ln -f -s '${library.input_2}' ${read2} &&

#elif str($library.type) == 'paired_collection':
    #if $library.input_1.forward.is_of_type("fastq.gz", "fastqsanger.gz"):
        #set read1 = "input_f.fastq.gz"
        #set compressed = "GZ"
    #elif $library.input_1.forward.is_of_type("fastq.bz2", "fastqsanger.bz2"):
        #set read1 = "input_f.fastq.bz2"
        #set compressed = "BZ2"
    #elif $library.input_1.forward.is_of_type('fasta'):
        #set reads_are_fastq = False
        #set read1 = "input_f.fasta"
    #else:
        #set read1 = "input_f.fastq"
    #end if
    ln -s '${library.input_1.forward}' ${read1} &&

    #if $library.input_1.reverse.is_of_type("fastq.gz", "fastqsanger.gz"):
        #set read2 = "input_r.fastq.gz"
        #set compressed = "GZ"
    #elif $library.input_1.reverse.is_of_type("fastq.bz2", "fastqsanger.bz2"):
        #set read2 = "input_r.fastq.bz2"
        #set compressed = "BZ2"
    #elif $library.input_1.reverse.is_of_type("fasta"):
        #set read2 = "input_r.fasta"
    #else:
        #set read2 = "input_r.fastq"
    #end if
    ln -s '${library.input_1.reverse}' ${read2} &&
#elif str( $library.type ) == "paired_interleaved":
    #if $library.input_1.is_of_type("fastq.gz", "fastqsanger.gz"):
        #set interleaved_reads = "input_f.fastq.gz"
        #set compressed = "GZ"
    #elif $library.input_1.is_of_type("fastq.bz2", "fastqsanger.bz2"):
        #set interleaved_reads = "input_f.fastq.bz2"
        #set compressed = "BZ2"
    #elif $library.input_1.is_of_type('fasta'):
        #set reads_are_fastq = False
        #set interleaved_reads = "input_f.fasta"
    #else:
        #set interleaved_reads = "input_f.fastq"
    #end if
    ln -f -s '${library.input_1}' ${interleaved_reads} &&
    #if $library.input_1.is_of_type("fastq.bz2", "fastqsanger.bz2"):
        #set read1 = "<(bzcat input_f.fastq.bz2 | seqtk seq -1 /dev/stdin)"
        #set read2 = "<(bzcat input_f.fastq.bz2 | seqtk seq -2 /dev/stdin)"
    #else:
        #set read1 = "<(seqtk seq -1 %s)" % $interleaved_reads
        #set read2 = "<(seqtk seq -2 %s)" % $interleaved_reads
    #end if
#else:
    #if $library.input_1.is_of_type("fastq.gz", "fastqsanger.gz"):
        #set read1 = "input_f.fastq.gz"
        #set compressed = "GZ"
    #elif $library.input_1.is_of_type("fastq.bz2", "fastqsanger.bz2"):
        #set read1 = "input_f.fastq.bz2"
        #set compressed = "BZ2"
    #elif $library.input_1.is_of_type('fasta'):
        #set reads_are_fastq = False
        #set read1 = "input_f.fasta"
    #else:
        #set read1 = "input_f.fastq"
    #end if
    ln -f -s '${library.input_1}' ${read1} &&
#end if

## Run HISAT2

hisat2

## number threads
-p \${GALAXY_SLOTS:-1}

## ref genome index path
-x '${index_path}'

## input reads are fasta?
#if not $reads_are_fastq:
    -f
#end if

## Input reads

#if str( $library.type ) == "single":

    -U '${read1}'

    #if str($adv.output_options.output_options_selector) == "advanced":
        #if str( $adv.output_options.unaligned_file ) == "true":
            #if $compressed == "GZ":
                --un-gz '$output_unaligned_reads_l'
            #elif $compressed == "BZ2":
                --un-bz2 '$output_unaligned_reads_l'
            #else:
                --un '$output_unaligned_reads_l'
            #end if
        #end if

        #if str( $adv.output_options.aligned_file ) == "true":
            #if $compressed == "GZ":
                --al-gz '$output_aligned_reads_l'
            #elif $compressed == "BZ2":
                --al-bz2 '$output_aligned_reads_l'
            #else:
                --al '$output_aligned_reads_l'
            #end if
        #end if
    #end if

#else:
    ##quotes are embedded in r1 and r2 variables, needed to allow use of <()
    #if str( $library.type ) == "paired_interleaved":
      -1 ${read1}
      -2 ${read2}
    #else:
      -1 '${read1}'
      -2 '${read2}'
    #end if
    #if str($adv.output_options.output_options_selector) == "advanced":
        #if str( $adv.output_options.unaligned_file ) == "true":
            #if $compressed == "GZ":
                --un-conc-gz '${output_unaligned_reads_l}'
            #elif $compressed == "BZ2":
                --un-conc-bz2 '${output_unaligned_reads_l}'
            #else:
                --un-conc '${output_unaligned_reads_l}'
            #end if
        #end if

        #if str( $adv.output_options.aligned_file ) == "true":
            #if $compressed == "GZ":
                --al-conc-gz '${output_aligned_reads_l}'
            #elif $compressed == "BZ2":
                --al-conc-bz2 '${output_aligned_reads_l}'
            #else:
                --al-conc '${output_aligned_reads_l}'
            #end if
        #end if
    #end if

    #if str($library.paired_options.paired_options_selector) == "advanced":
        ${library.paired_options.fr_rf_ff}
        ${library.paired_options.no_mixed}
        ${library.paired_options.no_discordant}
    #end if

#end if

## Specify strandedness of reads

#if str($library.rna_strandness):
    --rna-strandness ${library.rna_strandness}
#end if

## Input options

#if str($adv.input_options.input_options_selector) == "advanced":
    #if int( $adv.input_options.skip ) > 0:
        --skip ${adv.input_options.skip}
    #end if
    #if int( $adv.input_options.qupto ) > 0:
        --qupto ${adv.input_options.qupto}
    #end if
    --trim5 '${adv.input_options.trim5}'
    --trim3 '${adv.input_options.trim3}'
    ${adv.input_options.qv_encoding}
    ${adv.input_options.solexa_quals}
    ${adv.input_options.int_quals}
#end if

## Alignment options

#if str($adv.alignment_options.alignment_options_selector) == "advanced":
    --n-ceil ${adv.alignment_options.function_type},${adv.alignment_options.constant_term},${adv.alignment_options.coefficient}
    ${adv.alignment_options.ignore_quals}
    ${adv.alignment_options.skip_forward}
    ${adv.alignment_options.skip_reverse}
#end if

 ## Scoring options

#if str($adv.scoring_options.scoring_options_selector) == "advanced":
    --mp ${adv.scoring_options.max_mismatch},${adv.scoring_options.min_mismatch}
    ${adv.scoring_options.no_softclip}
    --np ${adv.scoring_options.ambiguous_penalty}
    --rdg ${adv.scoring_options.read_open_penalty},${adv.scoring_options.read_extend_penalty}
    --rfg ${adv.scoring_options.ref_open_penalty},${adv.scoring_options.ref_extend_penalty}
    --sp ${adv.scoring_options.soft_clip_penalty_max},${adv.scoring_options.soft_clip_penalty_min}
    --score-min ${adv.scoring_options.function_type},${adv.scoring_options.constant_term},${adv.scoring_options.coefficient}
#end if

## Spliced alignment options

#if str($adv.spliced_options.spliced_options_selector) == "advanced":
    --pen-cansplice ${adv.spliced_options.canonical_penalty}
    --pen-noncansplice ${adv.spliced_options.noncanonical_penalty}
    --pen-canintronlen ${adv.spliced_options.function_type},${adv.spliced_options.constant_term},${adv.spliced_options.coefficient}
    --pen-noncanintronlen ${adv.spliced_options.nc_function_type},${adv.spliced_options.nc_constant_term},${adv.spliced_options.nc_coefficient}
    #if str($adv.spliced_options.known_splice_gtf) != 'None':
        --known-splicesite-infile splice_sites.txt
    #end if
    ${adv.spliced_options.no_spliced_alignment_options.no_spliced_alignment}
    #if $adv.spliced_options.no_spliced_alignment_options.no_spliced_alignment == '--no-spliced-alignment'
        -I ${adv.spliced_options.no_spliced_alignment_options.minins}
        -X ${adv.spliced_options.no_spliced_alignment_options.maxins}
    #end if
    --min-intronlen ${adv.spliced_options.min_intron}
    --max-intronlen ${adv.spliced_options.max_intron}
    ${adv.spliced_options.tma}

    #if str($adv.spliced_options.novel_splicesite_outfile) == "true":
       --novel-splicesite-outfile '$novel_splicesite_output'
    #end if

    #if str($adv.spliced_options.notmplen):
        ${adv.spliced_options.notmplen}
    #end if
#end if

## Reporting options

#if str($adv.reporting_options.reporting_options_selector) == "advanced":
    #if str($adv.reporting_options.max_primary) != '':
        -k ${adv.reporting_options.max_primary}
    #end if
#end if

## Other options

#if str( $adv.other_options.other_options_selector ) == "advanced":
    ${adv.other_options.non_deterministic}
    --seed '${adv.other_options.seed}'
#end if

## Output Summary

#if str($sum.new_summary) == "true":
    --new-summary
#end if

#if str($sum.summary_file) == "true":
    --summary-file summary.txt
#end if

## Convert SAM output to sorted BAM
## using the two pipe stages has the following effect
## - hisat2 and sort run in parallel, during this time sort produces
##   presorted temporary files but does not produce output (hence
##   view does not run)
## - once hisat is finished sort will start to merge the temporary
##   files (which should be fast also on a single thread) gives the
##   sorted output to view which only compresses the files (now
##   using full parallelism again)

| samtools sort -l 0 -O bam | samtools view -O bam -@ \${GALAXY_SLOTS:-1} -o '${output_alignments}'

## Rename any output fastq files

#if $output_unaligned_reads_l and $output_unaligned_reads_r:
    #from os.path import splitext
    #set _unaligned_root, _unaligned_ext = splitext( str( $output_unaligned_reads_l ) )
    && mv '${ _unaligned_root }.1${_unaligned_ext}' '$output_unaligned_reads_l'
    && mv '${ _unaligned_root }.2${_unaligned_ext}' '$output_unaligned_reads_r'
#end if
#if $output_aligned_reads_l and $output_aligned_reads_r:
    #from os.path import splitext
    #set _aligned_root, _aligned_ext = splitext( str( $output_aligned_reads_l ) )
    && mv '${ _aligned_root }.1${_aligned_ext}' '$output_aligned_reads_l'
    && mv '${ _aligned_root }.2${_aligned_ext}' '$output_aligned_reads_r'
#end if
    ]]></command>

    <inputs>

            <conditional name="reference_genome">
                <param name="source" type="select" label="Source for the reference genome" help="Built-in references were created using default options">
                    <option value="indexed" selected="true">Use a built-in genome</option>
                    <option value="history">Use a genome from history</option>
                </param>
                <when value="indexed">
                    <param name="index" type="select" label="Select a reference genome" help="If your genome of interest is not listed, contact the Galaxy team">
                        <options from_data_table="hisat2_indexes">
                            <filter type="sort_by" column="2" />
                            <validator type="no_options" message="No genomes are available for the selected input dataset" />
                        </options>
                    </param>
                </when>
                <when value="history">
                    <param name="history_item" type="data" format="fasta" label="Select the reference genome" />
                </when>
            </conditional>

            <conditional name="library">
                <param name="type" type="select" label="Is this a single or paired library">
                    <option value="single">Single-end</option>
                    <option value="paired">Paired-end</option>
                    <option value="paired_collection">Paired-end Dataset Collection</option>
                    <option value="paired_interleaved">Paired-end data from single interleaved dataset</option>
                </param>

                <when value="single">
                    <param name="input_1" format="fastqsanger,fastqsanger.gz,fastqsanger.bz2,fasta" type="data" label="FASTA/Q file" help="Must be of datatype "fastqsanger" or "fasta"" />
                     <param name="rna_strandness" argument="--rna-strandness" type="select" label="Specify strand information"
                            help="'F' means a read corresponds to a transcript. 'R' means a read corresponds to the reverse complemented counterpart of a transcript. With this option being used, every read alignment will have an XS attribute tag: '+' means a read belongs to a transcript on '+' strand of genome. '-' means a read belongs to a transcript on '-' strand of genome.">
                        <option value="">Unstranded</option>
                        <option value="F">Forward (F)</option>
                        <option value="R">Reverse (R)</option>
                    </param>
                </when>

                <when value="paired">
                    <param name="input_1" format="fastqsanger,fastqsanger.gz,fastqsanger.bz2,fasta" type="data" label="FASTA/Q file #1" help="Must be of datatype "fastqsanger"or "fasta"" />
                    <param name="input_2" format="fastqsanger,fastqsanger.gz,fastqsanger.bz2,fasta" type="data" label="FASTA/Q file #2" help="Must be of datatype "fastqsanger"or "fasta"" />
                    <expand macro="paired_end_options" />
                </when>

                <when value="paired_collection">
                    <param name="input_1" format="fastqsanger,fastqsanger.gz,fastqsanger.bz2,fasta" type="data_collection" collection_type="paired" label="Paired Collection" help="Must be of datatype "fastqsanger" or "fasta"" />
                    <expand macro="paired_end_options" />
                </when>
                <when value="paired_interleaved">
                    <param name="input_1" format="fastqsanger,fastqsanger.gz,fastqsanger.bz2,fasta" type="data" label="Interleaved FASTA/Q file" help="Must be of datatype "fastqsanger" or "fasta". --interleaved"/>
                    <expand macro="paired_end_options" />
                </when>
            </conditional>

            <param name="new_summary" argument="--new-summary" type="boolean" checked="False" label="Output alignment summary in a more machine-friendly style." help="Select this option for compatibility with MultiQC" />
            <param name="summary_file" argument="--summary-file" type="boolean" checked="False" label="Print alignment summary to a file." help="Output alignment summary to a file in addition to stderr." />

            <conditional name="input_options">
                <param name="input_options_selector" type="select" label="Input options">
                    <option value="defaults">Use default values</option>
                    <option value="advanced">Specify input options</option>
                </param>
                <when value="defaults" />
                <when value="advanced">
                    <param name="skip" argument="-s" type="integer" min="0" value="0" label="Skip the first N reads or pairs in the input" help="default: 0" />
                    <param name="qupto" argument="-u" type="integer" min="0" value="0" label="Align the first N reads or read pairs from the input (after the first N reads or pairs have been skipped), then stop" help="default: no limit" />
                    <param name="trim5" argument="-5" type="integer" min="0" value="0" label="Trim 5' end" help="Trim N bases from 5' (left) end of each read before alignment, default: 0" />
                    <param name="trim3" argument="-3" type="integer" min="0" value="0" label="Trim 3' end" help="Trim N bases from 3' (right) end of each read before alignment, default: 0"/>
                    <param name="qv_encoding" type="select" display="radio" label="Select quality score encoding" help="See help below for more details">
                         <option value="--phred33" selected="True">Input qualities are ASCII chars equal to the Phred quality plus 33. This is also called the "Phred+33" encoding, which is used by the very latest Illumina pipelines (--phred33)</option>
                         <option value="--phred64">Input qualities are ASCII chars equal to the Phred quality plus 64. This is also called the "Phred+64" encoding (--phred64)</option>
                    </param>
                    <param name="solexa_quals" argument="--solexa-quals" type="boolean" truevalue="--solexa-quals" falsevalue="" checked="False" label="Convert input qualities from Solexa (which can be negative) to Phred (which can't). This scheme was used in older Illumina GA Pipeline versions (prior to 1.3)" help="--solexa-quals; default: False"/>
                    <param name="int_quals" argument="--int-quals" type="boolean" truevalue="--int-quals" falsevalue="" checked="False" label="Are quality values provided as space separated integers?" help="Quality values are represented in the read input file as space-separated ASCII integers, e.g., 40 40 30 40..., rather than ASCII characters, e.g., II?I.... Integers are treated as being on the Phred quality scale unless --solexa-quals is also specified [default: False]"/>
                </when>
            </conditional>

            <conditional name="alignment_options">
                <param name="alignment_options_selector" type="select" label="Alignment options">
                    <option value="defaults">Use default values</option>
                    <option value="advanced">Specify alignment options</option>
                </param>
                <when value="defaults" />
                <when value="advanced">
                    <param name="function_type" argument="--n-ceil" type="select" display="radio" label="Function governing the maximum number of ambiguous characters (usually Ns and/or .s) allowed in a read as a function of read length" help="Reads exceeding this ceiling are filtered out">
                        <option value="C">Constant [f(x) = B]</option>
                        <option value="L" selected="true">Linear [f(x) = B + A * x]</option>
                        <option value="S">Square root [f(x) = B + A * x²]</option>
                        <option value="G">Natural logarithm [f(x) = B + A * log(x)]</option>
                    </param>
                    <param name="constant_term" type="float" value="0" label="Constant term (B)" help="Constant term for the above function" />
                    <param name="coefficient" type="float" value="0.15" label="Coefficient (A)" help="Coefficient for the above function" />
                    <param argument="--ignore-quals" name="ignore_quals" type="boolean" truevalue="--ignore-quals" falsevalue="" label="Ignore quality values" help="When calculating a mismatch penalty, always consider the quality value at the mismatched position to be the highest possible, regardless of the actual value. I.e. input is treated as though all quality values are high. This is also the default behavior when the input doesn't specify quality values" />
                    <param argument="--nofw" name="skip_forward" type="boolean" truevalue="--nofw" falsevalue="" label="Skip forward strand of reference" help="If --nofw is specified, HISAT2 will not attempt to align unpaired reads to the forward (Watson) reference strand. In paired-end mode, --nofw and --norc pertain to the fragments; i.e. specifying --nofw causes HISAT2 to explore only those paired-end configurations corresponding to fragments from the reverse-complement (Crick) strand" />
                    <param argument="--norc" name="skip_reverse" type="boolean" truevalue="--norc" falsevalue="" label="Skip reverse strand of reference" help="If --norc is specified, HISAT2 will not attempt to align unpaired reads against the reverse-complement (Crick) reference strand. In paired-end mode, --nofw and --norc pertain to the fragments; i.e. specifying --norc causes HISAT2 to explore only those paired-end configurations corresponding to fragments from the forward-complement (Watson) strand" />
                </when>
            </conditional>

            <conditional name="scoring_options">
                <param name="scoring_options_selector" type="select" label="Scoring options">
                    <option value="defaults">Use default values</option>
                    <option value="advanced">Specify scoring options</option>
                </param>
                <when value="defaults" />
                <when value="advanced">
                    <param name="constant_term" type="float" value="0" label="Constant term (B)" help="Constant term for the above function" />
                    <param name="coefficient" type="float" value="-0.2" label="Coefficient (A)" help="Coefficient for the above function" />
                    <param argument="--mp" name="max_mismatch" type="integer" value="6" min="0" label="Maximum mismatch penalty" help="Sets the maximum mismatch penalty. A number less than or equal to MX and greater than or equal to MN is subtracted from the alignment score for each position where a read character aligns to a reference character, the characters do not match, and neither is an N. If --ignore-quals is specified, the number subtracted quals MX. Otherwise, the number subtracted is MN + floor( (MX-MN)(MIN(Q, 40.0)/40.0) ) where Q is the Phred quality value" />
                    <param argument="--mp" name="min_mismatch" type="integer" value="2" min="0" label="Minimum mismatch penalty" help="Sets the minimum mismatch penalty. A number less than or equal to MX and greater than or equal to MN is subtracted from the alignment score for each position where a read character aligns to a reference character, the characters do not match, and neither is an N. If --ignore-quals is specified, the number subtracted quals MX. Otherwise, the number subtracted is MN + floor( (MX-MN)(MIN(Q, 40.0)/40.0) ) where Q is the Phred quality value" />
                    <param argument="--sp" name="soft_clip_penalty_max" type="integer" value="2" min="0" label="Maximum soft-clipping penalty" help="Sets the maximum (MX) penalty for soft-clipping per base. A number less than or equal to MX and greater than or equal to MN is subtracted from the alignment score for each position. The number subtracted is MN + floor( (MX-MN)(MIN(Q, 40.0)/40.0) ) where Q is the Phred quality value" />
                    <param argument="--sp" name="soft_clip_penalty_min" type="integer" value="1" min="0" label="Minimum soft-clipping penalty" help="Sets the minimum (MN) penalty for soft-clipping per base. A number less than or equal to MX and greater than or equal to MN is subtracted from the alignment score for each position. The number subtracted is MN + floor( (MX-MN)(MIN(Q, 40.0)/40.0) ) where Q is the Phred quality value" />
                    <param argument="--no-softclip" name="no_softclip" type="boolean" truevalue="" falsevalue="--no-softclip" label="Allow soft-clipping" />
                    <param argument="--np" name="ambiguous_penalty" type="integer" value="1" min="0" label="Ambiguous read penalty" help="Sets penalty for positions where the read, reference, or both, contain an ambiguous character such as N" />
                    <param argument="--rdg" name="read_open_penalty" type="integer" value="5" min="0" label="Read gap open penalty" help="A read gap of length N gets a penalty of [open_penalty] + N * [extend_penalty]" />
                    <param argument="--rdg" name="read_extend_penalty" type="integer" value="3" min="0" label="Read gap extend penalty" help="A read gap of length N gets a penalty of [open_penalty] + N * [extend_penalty]" />
                    <param argument="--rfg" name="ref_open_penalty" type="integer" value="5" min="0" label="Reference gap open penalty" help="A reference gap of length N gets a penalty of [open_penalty] + N * [extend_penalty]" />
                    <param argument="--rfg" name="ref_extend_penalty" type="integer" value="3" min="0" label="Reference gap extend penalty" help="A reference gap of length N gets a penalty of [open_penalty] + N * [extend_penalty]" />
                    <param name="function_type" argument="--score-min" type="select" display="radio" label="Function governing the minimum alignment score needed for an alignment to be considered "valid" (i.e. good enough to report)" help="This is a function of read length">
                        <option value="C">Constant [f(x) = B]</option>
                        <option value="L" selected="true">Linear [f(x) = B + A * x]</option>
                        <option value="S">Square root [f(x) = B + A * x²]</option>
                        <option value="G">Natural logarithm [f(x) = B + A * log(x)]</option>
                    </param>
                </when>
            </conditional>

            <conditional name="spliced_options">
                <param name="spliced_options_selector" type="select" label="Spliced alignment options">
                    <option value="defaults">Use default values</option>
                    <option value="advanced">Specify spliced alignment options</option>
                </param>
                <when value="defaults" />
                <when value="advanced">
                    <param name="canonical_penalty" argument="--pen-cansplice" type="integer" value="0" min="0" label="Penalty for canonical splice sites" />
                    <param name="noncanonical_penalty" argument="--pen-noncansplice" type="integer" value="12" min="0" label="Penalty for non-canonical splice sites" />
                    <param name="function_type" argument="--pen-canintronlen" type="select" display="radio" label="Penalty function for long introns with canonical splice sites" help="Alignments with shorter introns are preferred to those with longer ones">
                        <option value="C">Constant [f(x) = B]</option>
                        <option value="L">Linear [f(x) = B + A * x]</option>
                        <option value="S">Square root [f(x) = B + A * x²]</option>
                        <option value="G" selected="true">Natural logarithm [f(x) = B + A * log(x)]</option>
                    </param>
                    <param name="constant_term" type="float" value="-8" label="Constant term (B)" help="Constant term for the above function" />
                    <param name="coefficient" type="float" value="1" label="Coefficient (A)" help="Coefficient for the above function" />
                    <param name="nc_function_type" argument="--pen-noncanintronlen" type="select" display="radio" label="Penalty function for long introns with non-canonical splice sites" help="Alignments with shorter introns are preferred to those with longer ones">
                        <option value="C">Constant [f(x) = B]</option>
                        <option value="L">Linear [f(x) = B + A * x]</option>
                        <option value="S">Square root [f(x) = B + A * x²]</option>
                        <option value="G" selected="true">Natural logarithm [f(x) = B + A * log(x)]</option>
                    </param>
                    <param name="nc_constant_term" type="float" value="-8" label="Constant term (B)" help="Constant term for the above function" />
                    <param name="nc_coefficient" type="float" value="1" label="Coefficient (A)" help="Coefficient for the above function" />
                    <param name="min_intron" type="integer" value="20" min="0" label="Minimum intron length" />
                    <param name="max_intron" type="integer" value="500000" min="0" label="Maximum intron length" />
                    <conditional name="no_spliced_alignment_options">
                        <param name="no_spliced_alignment" argument="--no-spliced-alignment" type="select" label="Disable spliced alignment">
                            <option value="">False</option>
                            <option value="--no-spliced-alignment">True</option>
                        </param>
                        <when value="--no-spliced-alignment">
                            <param name="minins" argument="-I" type="integer" value="0" min="0" label="Minimum fragment length for valid paired-end alignments" help="E.g. if -I 60 is specified and a paired-end alignment consists of two 20-bp alignments in the appropriate orientation with a 20-bp gap between them, that alignment is considered valid (as long as -X is also satisfied). A 19-bp gap would not be valid in that case. If trimming options -3 or -5 are also used, the -I constraint is applied with respect to the untrimmed mates. The larger the difference between -I and -X, the slower HISAT2 will run. This is because larger differences between -I and -X require that HISAT2 scan a larger window to determine if a concordant alignment exists. For typical fragment length ranges (200 to 400 nucleotides), HISAT2 is very efficient" />
                            <param name="maxins" argument="-X" type="integer" value="500" min="0" label="Maximum fragment length for valid paired-end alignments" help="E.g. if -X 100 is specified and a paired-end alignment consists of two 20-bp alignments in the proper orientation with a 60-bp gap between them, that alignment is considered valid (as long as -I is also satisfied). A 61-bp gap would not be valid in that case. If trimming options -3 or -5 are also used, the -X constraint is applied with respect to the untrimmed mates, not the trimmed mates. The larger the difference between -I and -X, the slower HISAT2 will run. This is because larger differences between -I and -X require that HISAT2 scan a larger window to determine if a concordant alignment exists. For typical fragment length ranges (200 to 400 nucleotides), HISAT2 is very efficient" />
                        </when>
                        <when value="" />
                    </conditional>
                    <param name="known_splice_gtf" type="data" format="gtf" optional="true" label="GTF file with known splice sites" />
                    <param name="tma" type="select" display="radio" label="Transcriptome assembly reporting">
                        <option value="">Use default reporting</option>
                        <option value="--tmo">Report only those alignments within known transcripts</option>
                        <option value="--dta">Report alignments tailored for transcript assemblers including StringTie</option>
                        <option value="--dta-cufflinks">Report alignments tailored specifically for Cufflinks</option>
                    </param>
                    <param name="notmplen" argument="--no-templatelen-adjustment" type="boolean" truevalue="--no-templatelen-adjustment" falsevalue="" label="Disable automatic template length adjustment for RNA-seq reads" help="Default: false" />
                    <param name="novel_splicesite_outfile" type="boolean" checked="false" label="reports a list of novel splice sites" help="Default: false" />
                </when>
            </conditional>

            <conditional name="reporting_options">
                <param name="reporting_options_selector" type="select" label="Reporting options">
                    <option value="defaults">Use default values</option>
                    <option value="advanced">Specify reporting options</option>
                </param>
                <when value="defaults" />
                <when value="advanced">
                    <param name="max_primary" argument="-k" type="integer" min="0" optional="true" label="Primary alignments" help="Search for at most K distinct, primary alignments for each read. Primary alignments mean alignments whose alignment score is equal or higher than any other alignments. The search terminates when it can't find more distinct valid alignments, or when it finds K, whichever happens first. The alignment score for a paired-end alignment equals the sum of the alignment scores of the individual mates. Each reported read or pair alignment beyond the first has the SAM 'secondary' bit (which equals 256) set in its FLAGS field. For reads that have more than K distinct, valid alignments, HISAT2 does not guarantee that the K alignments reported are the best possible in terms of alignment score. HISAT2 is not designed with large values for -k in mind, so when aligning reads to long repetitive genomes, a large K can be very, very slow. Default: 5 (HFM) or 10 (HGFM)" />
                </when>
            </conditional>

             <conditional name="output_options">
                <param name="output_options_selector" type="select" label="Output options">
                    <option value="defaults">Use default values</option>
                    <option value="advanced">Specify output options</option>
                </param>
                <when value="defaults" />
                <when value="advanced">
                    <param name="unaligned_file" argument="--un/--un-conc" type="boolean" truevalue="true" falsevalue="false" checked="False" label="Write unaligned reads (in fastq format) to separate file(s)" help="This triggers --un parameter for single reads and --un-conc for paired reads" />
                    <param name="aligned_file" argument="--al/--al-conc" type="boolean" truevalue="true" falsevalue="false" checked="False" label="Write aligned reads (in fastq format) to separate file(s)" help="This triggers --al parameter for single reads and --al-conc for paired reads" />
                </when>
            </conditional>

            <conditional name="other_options">
                <param name="other_options_selector" type="select" label="Other options">
                    <option value="defaults">Use default values</option>
                    <option value="advanced">Specify other options</option>
                </param>
                <when value="defaults" />
                <when value="advanced">
                    <param name="seed" argument="--seed" type="integer" value="0" min="0" label="Use this number as the seed for pseudo-random number generator" help="Default=0" />
                    <param name="non_deterministic" argument="--non-deterministic" type="boolean" truevalue="--non-deterministic" falsevalue="" label="Re-initialize the pseudo-random generator for each read using the current time" help="see Help below for explanation of this option; default: False"/>
                </when>
            </conditional>

    </inputs>

    <outputs>

        <data name="output_alignments" format="bam" label="${tool.name} on ${on_string}: aligned reads (BAM)">
            <expand macro="dbKeyActions" />
        </data>

        <data name="output_unaligned_reads_l" format="fastqsanger" label="${tool.name} on ${on_string}: unaligned reads (L)">
            <filter>adv['output_options']['output_options_selector'] == "advanced" and adv['output_options']['unaligned_file'] is True</filter>
            <expand macro="dbKeyActions" />
        </data>

        <data name="output_aligned_reads_l" format="fastqsanger" label="${tool.name} on ${on_string}: aligned reads (L)">
            <filter>adv['output_options']['output_options_selector'] == "advanced" and adv['output_options']['aligned_file'] is True</filter>
            <expand macro="dbKeyActions" />
        </data>

        <data name="output_unaligned_reads_r" format="fastqsanger" label="${tool.name} on ${on_string}: unaligned reads (R)">
            <filter>(library['type'] == 'paired' or library['type'] == 'paired_collection') and (adv['output_options']['output_options_selector'] == "advanced" and adv['output_options']['unaligned_file'] is True) </filter>
            <expand macro="dbKeyActions" />
        </data>

        <data name="output_aligned_reads_r" format="fastqsanger" label="${tool.name} on ${on_string}: aligned reads (R)">
            <filter>(library['type'] == 'paired' or library['type'] == 'paired_collection') and (adv['output_options']['output_options_selector'] == "advanced" and adv['output_options']['aligned_file'] is True) </filter>
            <expand macro="dbKeyActions" />
        </data>

        <data name="summary_file"  format="txt" from_work_dir="summary.txt" label="${tool.name} on ${on_string}: Mapping summary" >
          <filter>sum['summary_file'] is True</filter>
          <expand macro="dbKeyActions" />
        </data>

        <data name="novel_splicesite_output"  format="tabular" label="${tool.name} on ${on_string}: Novel Splice Sites" >
          <filter>adv['spliced_options']['spliced_options_selector'] == 'advanced' and adv['spliced_options']['novel_splicesite_outfile'] is True</filter>
          <expand macro="dbKeyActions" />
        </data>

    </outputs>

    <tests>

        <test expect_num_outputs="1" >
            <param name="type" value="paired" />
            <param name="source" value="history" />
            <param name="history_item" ftype="fasta" value="phiX.fa" />
            <param name="input_1" ftype="fastqsanger" value="hisat_input_1_forward.fastq" />
            <param name="input_2" ftype="fastqsanger" value="hisat_input_1_reverse.fastq" />
            <param name="adv|reporting_options|reporting_options_selector" value="advanced"/>
            <param name="novel_splicesite_outfile" value="false" />
            <output name="output_alignments" file="hisat_output_1.bam" ftype="bam" lines_diff="2" />
        </test>

        <test expect_num_outputs="1" >
            <param name="type" value="paired" />
            <param name="source" value="history" />
            <param name="history_item" ftype="fasta" value="phiX.fa" />
            <param name="input_1" ftype="fastqsanger" value="hisat_input_1_forward.fastq" />
            <param name="input_2" ftype="fastqsanger" value="hisat_input_1_reverse.fastq" />
            <param name="adv|scoring_options|coefficient" value="-0.3"/>
            <output name="output_alignments" file="hisat_output_1.bam" ftype="bam" lines_diff="2" />
        </test>

        <test expect_num_outputs="1">
            <param name="type" value="paired" />
            <param name="source" value="indexed" />
            <param name="input_1" ftype="fastqsanger" dbkey="phiX" value="hisat_input_1_forward.fastq" />
            <param name="input_2" ftype="fastqsanger" dbkey="phiX" value="hisat_input_1_reverse.fastq" />
            <output name="output_alignments" file="hisat_output_1.bam" ftype="bam" lines_diff="2" />
        </test>

        <test expect_num_outputs="1">
            <param name="type" value="paired" />
            <param name="source" value="history" />
            <param name="history_item" ftype="fasta" value="phiX.fa" />
            <param name="input_options_selector" value="advanced" />
            <param name="trim3" value="15" />
            <param name="trim5" value="15" />
            <param name="input_1" ftype="fastqsanger" value="hisat_input_2_forward.fastq" />
            <param name="input_2" ftype="fastqsanger" value="hisat_input_2_reverse.fastq" />
            <output name="output_alignments" file="hisat_output_2.bam" ftype="bam" lines_diff="2" />
        </test>

        <test expect_num_outputs="1">
            <param name="type" value="paired" />
            <param name="source" value="history" />
            <param name="history_item" ftype="fasta" value="phiX.fa" />
            <param name="input_options_selector" value="advanced" />
            <param name="trim3" value="15" />
            <param name="trim5" value="15" />
            <param name="input_1" ftype="fastqsanger" value="hisat_input_2_forward.fastq" />
            <param name="input_2" ftype="fastqsanger" value="hisat_input_2_reverse.fastq" />
            <param name="paired_options_selector" value="advanced" />
            <param name="no_mixed" value="True" />
            <param name="no_discordant" value="True" />
            <output name="output_alignments" file="hisat_output_3.bam" ftype="bam" lines_diff="2" />
        </test>

        <test expect_num_outputs="2">
            <param name="type" value="single" />
            <param name="source" value="history" />
            <param name="history_item" ftype="fasta" value="phiX.fa" />
            <param name="output_options_selector" value="advanced" />
            <param name="unaligned_file" value="true" />
            <param name="history_item" ftype="fasta" value="phiX.fa" />
            <param name="input_1" ftype="fasta" value="test_unaligned_reads.fasta" />
            <output name="output_unaligned_reads_l" file="test_unaligned_reads.fasta" />
        </test>

        <test expect_num_outputs="5">
            <param name="type" value="paired" />
            <param name="source" value="history" />
            <param name="output_options_selector" value="advanced" />
            <param name="unaligned_file" value="true" />
            <param name="aligned_file" value="true" />
            <param name="history_item" ftype="fasta" value="phiX.fa" />
            <param name="input_1" ftype="fasta" value="test_unaligned_reads.fasta" />
            <param name="input_2" ftype="fasta" value="test_unaligned_reads.fasta" />
            <output name="output_unaligned_reads_l" file="test_unaligned_reads.fasta" />
            <output name="output_unaligned_reads_r" file="test_unaligned_reads.fasta" />
        </test>

        <test expect_num_outputs="1">
            <param name="type" value="paired" />
            <param name="source" value="history" />
            <param name="history_item" ftype="fasta" value="phiX.fa" />
            <param name="input_options_selector" value="advanced" />
            <param name="trim3" value="15" />
            <param name="trim5" value="15" />
            <param name="input_1" ftype="fastqsanger.gz" value="hisat_input_2_forward.fastq.gz" />
            <param name="input_2" ftype="fastqsanger.gz" value="hisat_input_2_reverse.fastq.gz" />
            <param name="paired_options_selector" value="advanced" />
            <param name="no_mixed" value="True" />
            <param name="no_discordant" value="True" />
            <output name="output_alignments" file="hisat_output_3.bam" ftype="bam" lines_diff="2" />
        </test>

        <test expect_num_outputs="1">
            <param name="type" value="paired" />
            <param name="source" value="history" />
            <param name="history_item" ftype="fasta" value="phiX.fa" />
            <param name="input_options_selector" value="advanced" />
            <param name="trim3" value="15" />
            <param name="trim5" value="15" />
            <param name="input_1" ftype="fastqsanger.bz2" value="hisat_input_2_forward.fastq.bz2" />
            <param name="input_2" ftype="fastqsanger.bz2" value="hisat_input_2_reverse.fastq.bz2" />
            <param name="paired_options_selector" value="advanced" />
            <param name="no_mixed" value="True" />
            <param name="no_discordant" value="True" />
            <output name="output_alignments" file="hisat_output_3.bam" ftype="bam" lines_diff="2" />
        </test>

        <test expect_num_outputs="1">
            <param name="type" value="paired" />
            <param name="source" value="history" />
            <param name="history_item" ftype="fasta" value="phiX.fa" />
            <param name="input_1" ftype="fastqsanger" value="hisat_input_1_forward.fastq" />
            <param name="input_2" ftype="fastqsanger" value="hisat_input_1_reverse.fastq" />
            <param name="rna_strandness" value="FR" />
            <output name="output_alignments" file="hisat_output_4.bam" ftype="bam" lines_diff="2" />
        </test>

        <test expect_num_outputs="2">
            <param name="type" value="single" />
            <param name="source" value="history" />
            <param name="history_item" ftype="fasta" value="phiX.fa" />
            <param name="input_1" ftype="fastqsanger" value="hisat_input_1_forward.fastq" />
            <param name="rna_strandness" value="R" />
            <param name="new_summary" value="true" />
            <param name="summary_file" value="true" />
            <output name="summary_file" file="hisat_output.summary" ftype="txt" />
        </test>

        <test expect_num_outputs="1" >
            <param name="type" value="paired_interleaved" />
            <param name="source" value="history" />
            <param name="history_item" ftype="fasta" value="phiX.fa" />
            <param name="input_1" ftype="fastqsanger" value="hisat_input_1_interleaved.fastq" />
            <output name="output_alignments" file="hisat_output_1.bam" ftype="bam" lines_diff="2" />
        </test>

        <test expect_num_outputs="1" >
            <param name="type" value="paired_interleaved" />
            <param name="source" value="history" />
            <param name="history_item" ftype="fasta" value="phiX.fa" />
            <param name="input_1" ftype="fastqsanger.bz2" value="hisat_input_1_interleaved.fastq.bz2" />
            <output name="output_alignments" file="hisat_output_1.bam" ftype="bam" lines_diff="2" />
        </test>

        <test expect_num_outputs="1" >
            <param name="type" value="paired_interleaved" />
            <param name="source" value="history" />
            <param name="history_item" ftype="fasta" value="phiX.fa" />
            <param name="input_1" ftype="fastqsanger.gz" value="hisat_input_1_interleaved.fastq.gz" />
            <output name="output_alignments" file="hisat_output_1.bam" ftype="bam" lines_diff="2" />
        </test>

        <test expect_num_outputs="1" >
            <param name="type" value="paired_interleaved" />
            <param name="source" value="history" />
            <param name="history_item" ftype="fasta" value="phiX.fa" />
            <param name="input_1" ftype="fasta" value="hisat_input_1_interleaved.fasta" />
            <output name="output_alignments" file="hisat_output_1_noqual.bam" ftype="bam" lines_diff="2" />
        </test>

        <test>
            <param name="type" value="single" />
            <param name="source" value="history" />
            <param name="history_item" ftype="fasta" value="phiX.fa" />
            <param name="input_1" ftype="fastqsanger" value="hisat_input_1_split_forward.fastq" />
            <param name="rna_strandness" value="R" />
            <param name="adv|spliced_options|spliced_options_selector" value="advanced"/>
            <param name="adv|spliced_options|novel_splicesite_outfile" value="true" />
            <output name="output_alignments" file="hisat_output_spliced_1.bam" ftype="bam" lines_diff="2" />
            <output name="novel_splicesite_output" file="novel_splicesite_out.tab" ftype="tabular" />
        </test>
    </tests>

    <help><![CDATA[
Introduction
============

What is HISAT?
--------------

`HISAT <http://ccb.jhu.edu/software/hisat>`__ is a fast and sensitive
spliced alignment program. As part of HISAT, we have developed a new
indexing scheme based on the Burrows-Wheeler transform
(`BWT <http://en.wikipedia.org/wiki/Burrows-Wheeler_transform>`__) and
the `FM index <http://en.wikipedia.org/wiki/FM-index>`__, called
hierarchical indexing, that employs two types of indexes: (1) one global
FM index representing the whole genome, and (2) many separate local FM
indexes for small regions collectively covering the genome. Our
hierarchical index for the human genome (about 3 billion bp) includes
~48,000 local FM indexes, each representing a genomic region of
~64,000bp. As the basis for non-gapped alignment, the FM index is
extremely fast with a low memory footprint, as demonstrated by
`Bowtie <http://bowtie-bio.sf.net>`__. In addition, HISAT provides
several alignment strategies specifically designed for mapping different
types of RNA-seq reads. All these together, HISAT enables extremely fast
and sensitive alignment of reads, in particular those spanning two exons
or more. As a result, HISAT is much faster >50 times than
`TopHat2 <http://ccb.jhu.edu/software/tophat>`__ with better alignment
quality. Although it uses a large number of indexes, the memory
requirement of HISAT is still modest, approximately 4.3 GB for human.
HISAT uses the `Bowtie2 <http://bowtie-bio.sf.net/bowtie2>`__
implementation to handle most of the operations on the FM index. In
addition to spliced alignment, HISAT handles reads involving indels and
supports a paired-end alignment mode. Multiple processors can be used
simultaneously to achieve greater alignment speed. HISAT outputs
alignments in `SAM <http://samtools.sourceforge.net/SAM1.pdf>`__ format,
enabling interoperation with a large number of other tools (e.g.
`SAMtools <http://samtools.sourceforge.net>`__,
`GATK <http://www.broadinstitute.org/gsa/wiki/index.php/The_Genome_Analysis_Toolkit>`__)
that use SAM. HISAT is distributed under the `GPLv3
license <http://www.gnu.org/licenses/gpl-3.0.html>`__, and it runs on
the command line under Linux, Mac OS X and Windows.

Running HISAT
=============

Reporting
---------

The reporting mode governs how many alignments HISAT looks for, and how
to report them.

In general, when we say that a read has an alignment, we mean that it
has a `valid
alignment <#valid-alignments-meet-or-exceed-the-minimum-score-threshold>`__.
When we say that a read has multiple alignments, we mean that it has
multiple alignments that are valid and distinct from one another.

Distinct alignments map a read to different places
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Two alignments for the same individual read are "distinct" if they map
the same read to different places. Specifically, we say that two
alignments are distinct if there are no alignment positions where a
particular read offset is aligned opposite a particular reference offset
in both alignments with the same orientation. E.g. if the first
alignment is in the forward orientation and aligns the read character at
read offset 10 to the reference character at chromosome 3, offset
3,445,245, and the second alignment is also in the forward orientation
and also aligns the read character at read offset 10 to the reference
character at chromosome 3, offset 3,445,245, they are not distinct
alignments.

Two alignments for the same pair are distinct if either the mate 1s in
the two paired-end alignments are distinct or the mate 2s in the two
alignments are distinct or both.

Default mode: search for one or more alignments, report each
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

HISAT searches for up to N distinct, primary alignments for each read,
where N equals the integer specified with the ``-k`` parameter. Primary
alignments mean alignments whose alignment score is equal or higher than
any other alignments. It is possible that multiple distinct alignments
whave the same score. That is, if ``-k 2`` is specified, HISAT will
search for at most 2 distinct alignments. The alignment score for a
paired-end alignment equals the sum of the alignment scores of the
individual mates. Each reported read or pair alignment beyond the first
has the SAM 'secondary' bit (which equals 256) set in its FLAGS field.
See the `SAM specification <http://samtools.sourceforge.net/SAM1.pdf>`__
for details.

HISAT does not "find" alignments in any specific order, so for reads
that have more than N distinct, valid alignments, HISAT does not
gaurantee that the N alignments reported are the best possible in terms
of alignment score. Still, this mode can be effective and fast in
situations where the user cares more about whether a read aligns (or
aligns a certain number of times) than where exactly it originated.

Alignment summmary
------------------

When HISAT finishes running, it prints messages summarizing what happened. These messages are printed to the "standard error" ("stderr") filehandle and can be optionally printed to a file. Choose `--new-summary` under **Summary Options** for compatibility with `MultiQC <http://multiqc.info/docs/#hisat2>`_.
For datasets consisting of unpaired reads, the summary might look like this:

::

    20000 reads; of these:
      20000 (100.00%) were unpaired; of these:
        1247 (6.24%) aligned 0 times
        18739 (93.69%) aligned exactly 1 time
        14 (0.07%) aligned >1 times
    93.77% overall alignment rate

For datasets consisting of pairs, the summary might look like this:

::

    10000 reads; of these:
      10000 (100.00%) were paired; of these:
        650 (6.50%) aligned concordantly 0 times
        8823 (88.23%) aligned concordantly exactly 1 time
        527 (5.27%) aligned concordantly >1 times
        ----
        650 pairs aligned concordantly 0 times; of these:
          34 (5.23%) aligned discordantly 1 time
        ----
        616 pairs aligned 0 times concordantly or discordantly; of these:
          1232 mates make up the pairs; of these:
            660 (53.57%) aligned 0 times
            571 (46.35%) aligned exactly 1 time
            1 (0.08%) aligned >1 times
    96.70% overall alignment rate

The indentation indicates how subtotals relate to totals.

.. class:: infomark

**HISAT2 options**

Galaxy wrapper for HISAT2 implements most, but not all, options available through the command line. Supported options are described below.

-----

**Inputs**

HISAT2 accepts files in FASTQ or FASTA format (single-end or paired-end).

Note that if your reads are from a stranded library, you need to choose the appropriate setting under **Specify strand information** above. For single-end reads, use F or R. 'F' means a read corresponds to a transcript. 'R' means a read corresponds to the reverse complemented counterpart of a transcript. For paired-end reads, use either FR or RF. With this option being used, every read alignment will have an XS attribute tag: '+' means a read belongs to a transcript on '+' strand of genome. '-' means a read belongs to a transcript on '-' strand of genome. (TopHat has a similar option, --library-type option, where fr-firststrand corresponds to R and RF; fr-secondstrand corresponds to F and FR.)

------

**Input options**::

    -s/--skip <int>
            Skip (i.e. do not align) the first `<int>` reads or pairs in the input.

    -u/--qupto <int>
            Align the first `<int>` reads or read pairs from the input (after the
            `-s`/`--skip` reads or pairs have been skipped), then stop.  Default: no limit.

    -5/--trim5 <int>
            Trim `<int>` bases from 5' (left) end of each read before alignment (default: 0).

    -3/--trim3 <int>
            Trim `<int>` bases from 3' (right) end of each read before alignment (default: 0).

    --phred33
            Input qualities are ASCII chars equal to the Phred quality plus 33.  This is
            also called the "Phred+33" encoding, which is used by the very latest Illumina
            pipelines.

    --phred64
            Input qualities are ASCII chars equal to the Phred quality plus 64.  This is
            also called the "Phred+64" encoding.

    --solexa-quals
            Convert input qualities from Solexa Phred quality (which can be negative) to
            Phred Phred quality (which can't).  This scheme was used in older Illumina GA
            Pipeline versions (prior to 1.3).  Default: off.

    --int-quals
            Quality values are represented in the read input file as space-separated ASCII integers, e.g., `40 40 30 40`..., rather than ASCII characters, e.g., `II?I`....
            Integers are treated as being on the Phred quality scale unless
            `--solexa-quals` is also specified. Default: off.

------

**Alignment options**::

    --n-ceil <func>
            Sets a function governing the maximum number of ambiguous characters (usually
            `N`s and/or `.`s) allowed in a read as a function of read length.  For instance,
            specifying `-L,0,0.15` sets the N-ceiling function `f` to `f(x) = 0 + 0.15 * x`,
            where x is the read length.  Reads exceeding this ceiling are filtered out.
            Default: `L,0,0.15`.

    --ignore-quals
            When calculating a mismatch penalty, always consider the quality value at the
            mismatched position to be the highest possible, regardless of the actual value.
            I.e. input is treated as though all quality values are high.  This is also the
            default behavior when the input doesn't specify quality values (e.g. in `-f`,
            `-r`, or `-c` modes).

    --nofw/--norc
            If `--nofw` is specified, `hisat2` will not attempt to align unpaired reads to
            the forward (Watson) reference strand.  If `--norc` is specified, `hisat2` will not attempt to align unpaired reads against the reverse-complement (Crick)
            reference strand. In paired-end mode, `--nofw` and `--norc` pertain to the
            fragments; i.e. specifying `--nofw` causes `hisat2` to explore only those
            paired-end configurations corresponding to fragments from the reverse-complement
            (Crick) strand.  Default: both strands enabled.

-----

**Scoring options**::

    --mp MX,MN
            Sets the maximum (`MX`) and minimum (`MN`) mismatch penalties, both integers. A number less than or equal to `MX` and greater than or equal to `MN` is
            subtracted from the alignment score for each position where a read character
            aligns to a reference character, the characters do not match, and neither is an
            `N`.  If `--ignore-quals` is specified, the number subtracted quals `MX`.
            Otherwise, the number subtracted is `MN + floor( (MX-MN)(MIN(Q, 40.0)/40.0) )`
            where Q is the Phred quality value.  Default: `MX` = 6, `MN` = 2.

    --sp MX,MN
            Sets the maximum (`MX`) and minimum (`MN`) penalties for soft-clipping per base, both integers. A number less than or equal to `MX` and greater than or equal to `MN` is subtracted from the alignment score for each position. The number subtracted is `MN + floor( (MX-MN)(MIN(Q, 40.0)/40.0) )` where Q is the Phred quality value. Default: `MX` = 2, `MN` = 1.

    --no-softclip
            Disallow soft-clipping.

    --np <int>
            Sets penalty for positions where the read, reference, or both, contain an
            ambiguous character such as `N`.  Default: 1.

    --rdg <int1>,<int2>
            Sets the read gap open (`<int1>`) and extend (`<int2>`) penalties.  A read gap of
            length N gets a penalty of `<int1>` + N * `<int2>`.  Default: 5, 3.

    --rfg <int1>,<int2>
            Sets the reference gap open (`<int1>`) and extend (`<int2>`) penalties.  A
            reference gap of length N gets a penalty of `<int1>` + N * `<int2>`.  Default:
            5, 3.

    --score-min <func>
            Sets a function governing the minimum alignment score needed for an alignment to
            be considered "valid" (i.e. good enough to report).  This is a function of read
            length. For instance, specifying `L,0,-0.6` sets the minimum-score function `f`
            to `f(x) = 0 + -0.6 * x`, where `x` is the read length. The default is `L,0,-0.2`.

-----

**Spliced alignment options**::

    --pen-cansplice <int>
            Sets the penalty for each pair of canonical splice sites (e.g. GT/AG). Default: 0.

    --pen-noncansplice <int>
            Sets the penalty for each pair of non-canonical splice sites (e.g. non-GT/AG). Default: 12.

    --pen-canintronlen <func>
            Sets the penalty for long introns with canonical splice sites so that alignments with shorter introns are preferred to those with longer ones. Default: G,-8,1

    --pen-noncanintronlen <func>
            Sets the penalty for long introns with noncanonical splice sites so that alignments with shorter introns are preferred to those with longer ones. Default: G,-8,1

    --min-intronlen <int>
            Sets minimum intron length. Default: 20

    --max-intronlen <int>
            Sets maximum intron length. Default: 500000

    --no-spliced-alignment
            Disable spliced alignment.

    -I/--minins <int>
            The minimum fragment length for valid paired-end alignments.This option is valid only with `--no-spliced-alignment`. E.g. if `-I 60` is specified and a paired-end alignment consists of two 20-bp alignments in the appropriate orientation with a 20-bp gap between them, that alignment is considered valid (as long as `-X` is also satisfied). A 19-bp gap would not be valid in that case. If trimming options `-3` or `-5` are also used, the `-I` constraint is applied with respect to the untrimmed mates.

            The larger the difference between `-I` and `-X`, the slower HISAT2 will run. This is because larger differences between `-I` and `-X` require that HISAT2 scan a larger window to determine if a concordant alignment exists. For typical fragment length ranges (200 to 400 nucleotides), HISAT2 is very efficient.

            Default: 0 (essentially imposing no minimum)

    -X/--maxins <int>
            The maximum fragment length for valid paired-end alignments. This option is valid only with `--no-spliced-alignment`. E.g. if `-X 100` is specified and a paired-end alignment consists of two 20-bp alignments in the proper orientation with a 60-bp gap between them, that alignment is considered valid (as long as `-I` is also satisfied). A 61-bp gap would not be valid in that case. If trimming options `-3` or `-5` are also used, the -X constraint is applied with respect to the untrimmed mates, not the trimmed mates.

            The larger the difference between `-I` and `-X`, the slower HISAT2 will run. This is because larger differences between `-I` and `-X` require that HISAT2 scan a larger window to determine if a concordant alignment exists. For typical fragment length ranges (200 to 400 nucleotides), HISAT2 is very efficient.

            Default: 500.

    --known-splicesite-infile <path>
            With this mode, you can provide a list of known splice sites, which HISAT2 makes use of to align reads with small anchors. You can create such a list using python hisat2_extract_splice_sites.py genes.gtf > splicesites.txt, where hisat2_extract_splice_sites.py is included in the HISAT2 package, genes.gtf is a gene annotation file, and splicesites.txt is a list of splice sites with which you provide HISAT2 in this mode. Note that it is better to use indexes built using annotated transcripts (such as genome_tran or genome_snp_tran), which works better than using this option. It has no effect to provide splice sites that are already included in the indexes.

    --tmo/--transcriptome-mapping-only
            Report only those alignments within known transcripts.

    --dta/--downstream-transcriptome-assembly
            Report alignments tailored for transcript assemblers including StringTie. With this option, HISAT2 requires longer anchor lengths for de novo discovery of splice sites. This leads to fewer alignments with short-anchors, which helps transcript assemblers improve significantly in computation and memory usage.

    --dta-cufflinks
            Report alignments tailored specifically for Cufflinks. In addition to what HISAT2 does with the above option (--dta), With this option, HISAT2 looks for novel splice sites with three signals (GT/AG, GC/AG, AT/AC), but all user-provided splice sites are used irrespective of their signals. HISAT2 produces an optional field, XS:A:[+-], for every spliced alignment.

    --no-templatelen-adjustment
            Disables template length adjustment for RNA-seq reads.

    --novel-splicesite-outfile
			In this mode, HISAT2 reports a list of splice sites in the file :
				chromosome name <tab> genomic position of the flanking base on the left side of an intron <tab> genomic position of the flanking base on the right <tab> strand (+, -, and .) '.' indicates an unknown strand for non-canonical splice sites.

-----

**Reporting options**::

    -k <int>
            It searches for at most `<int>` distinct, primary alignments for each read. Primary alignments mean alignments whose alignment score is equal or higher than any other alignments. The search terminates when it can't find more distinct valid alignments, or when it finds `<int>`, whichever happens first. The alignment score for a paired-end alignment equals the sum of the alignment scores of the individual mates. Each reported read or pair alignment beyond the first has the SAM 'secondary' bit (which equals 256) set in its FLAGS field. For reads that have more than `<int>` distinct, valid alignments, hisat2 does not guarantee that the `<int>` alignments reported are the best possible in terms of alignment score. Default: 5 (HFM) or 10 (HGFM)

            Note: HISAT2 is not designed with large values for `-k` in mind, and when aligning reads to long, repetitive genomes large `-k` can be very, very slow.

-----

**Paired-end options**::

    --fr/--rf/--ff
            The upstream/downstream mate orientations for a valid paired-end alignment
            against the forward reference strand.  E.g., if `--fr` is specified and there is
            a candidate paired-end alignment where mate 1 appears upstream of the reverse
            complement of mate 2 and the fragment length constraints (`-I` and `-X`) are
            met, that alignment is valid.  Also, if mate 2 appears upstream of the reverse
            complement of mate 1 and all other constraints are met, that too is valid.
            `--rf` likewise requires that an upstream mate1 be reverse-complemented and a
            downstream mate2 be forward-oriented. ` --ff` requires both an upstream mate 1
            and a downstream mate 2 to be forward-oriented.  Default: `--fr` (appropriate
            for Illumina's Paired-end Sequencing Assay).

    --no-mixed
            By default, when `hisat2` cannot find a concordant or discordant alignment for
            a pair, it then tries to find alignments for the individual mates.  This option
            disables that behavior.

    --no-discordant
            By default, `hisat2` looks for discordant alignments if it cannot find any
            concordant alignments.  A discordant alignment is an alignment where both mates
            align uniquely, but that does not satisfy the paired-end constraints
            (`--fr`/`--rf`/`--ff`, `-I`, `-X`).  This option disables that behavior.

**Output options**::

    --un/--un-gz/--un-bz2
            Write unpaired reads that fail to align to file at `<path>`. These reads correspond to the SAM records with the FLAGS `0x4` bit set and neither the `0x40` nor `0x80` bits set. If `--un-gz` is specified, output will be gzip compressed. If `--un-bz2` is specified, output will be bzip2 compressed. Reads written in this way will appear exactly as they did in the input file, without any modification (same sequence, same name, same quality string, same quality encoding). Reads will not necessarily appear in the same order as they did in the input.

    --al/--al-gz/--al-bz2
            Write unpaired reads that align at least once to file at `<path>`. These reads correspond to the SAM records with the FLAGS `0x4`, `0x40`, and `0x80` bits unset. If `--al-gz` is specified, output will be gzip compressed. If `--al-bz2` is specified, output will be bzip2 compressed. Reads written in this way will appear exactly as they did in the input file, without any modification (same sequence, same name, same quality string, same quality encoding). Reads will not necessarily appear in the same order as they did in the input.

    --un-conc/--un-conc-gz/--un-conc-bz2
            Write paired-end reads that fail to align concordantly to file(s) at `<path>`. These reads correspond to the SAM records with the FLAGS `0x4` bit set and either the `0x40` or `0x80` bit set (depending on whether it's mate #1 or #2). .1 and .2 strings are added to the filename to distinguish which file contains mate #1 and mate #2. If a percent symbol, %, is used in <path>, the percent symbol is replaced with 1 or 2 to make the per-mate filenames. Otherwise, .1 or .2 are added before the final dot in <path> to make the per-mate filenames. Reads written in this way will appear exactly as they did in the input files, without any modification (same sequence, same name, same quality string, same quality encoding). Reads will not necessarily appear in the same order as they did in the inputs.

    --al-conc/--al-conc-gz/--al-conc-bz2
            Write paired-end reads that align concordantly at least once to file(s) at `<path>`. These reads correspond to the SAM records with the FLAGS `0x4` bit unset and either the `0x40` or `0x80` bit set (depending on whether it's mate #1 or #2). .1 and .2 strings are added to the filename to distinguish which file contains mate #1 and mate #2. If a percent symbol, %, is used in <path>, the percent symbol is replaced with 1 or 2 to make the per-mate filenames. Otherwise, .1 or .2 are added before the final dot in `<path>` to make the per-mate filenames. Reads written in this way will appear exactly as they did in the input files, without any modification (same sequence, same name, same quality string, same quality encoding). Reads will not necessarily appear in the same order as they did in the inputs.

**Other options**::

    --seed <int>
            Use `<int>` as the seed for pseudo-random number generator.  Default: 0.

    --non-deterministic
            Normally, HISAT2 re-initializes its pseudo-random generator for each read. It seeds the generator with a number derived from (a) the read name, (b) the nucleotide sequence, (c) the quality sequence, (d) the value of the `--seed` option. This means that if two reads are identical (same name, same nucleotides, same qualities) HISAT2 will find and report the same alignment(s) for both, even if there was ambiguity. When `--non-deterministic` is specified, HISAT2 re-initializes its pseudo-random generator for each read using the current time. This means that HISAT2 will not necessarily report the same alignment for two identical reads. This is counter-intuitive for some users, but might be more appropriate in situations where the input consists of many identical reads.
    ]]></help>
    <citations>
        <citation type="doi">10.1038/nmeth.3317</citation>
    </citations>
</tool>

redpajama_set_name: RedPajamaGithub


text:
Q: React Native: How to hide an element other than conditional render? How do I hide/show a View element other than conditional rendering (which would render the view every time) ?
I tried setting the Height of the View to 0/1 but it doesn't work on IOS and defaults to the height of inner children.
I need this to show the menu which would slide from top to bottom. This menu is also an overlay with absolute coordinates.
<View style={styles.container}>
    <Animated.View style={[styles.toggleMenu]} >
        <MenuScreen onPress={()=>{this.toggleMenu()}}/>
    </Animated.View>
</View>

Styles

container: {
flex: 1,
backgroundColor: '#FFFFFF',
borderRadius: 8,
borderColor: '#000000'
},

toggleMenu:{
position: 'absolute',
left: 0,
top: 0,
width:WindowSize.width,
height: 0,
backgroundColor: '#2b3643',
opacity:0.95,
padding:0,
overflow: 'hidden'
}

Thanks

A: Set overflow: "hidden" on your element, which should allow the height property to properly "hide" children.
Note that there may be some conflicts using height with other flexbox properties, which I'd need your code to diagnose.
Fun fact: the reason you may be having trouble on iOS and not Android is because on Android all Views inherently hide children that are outside of their boundaries. This functionality does not exist by default on iOS.

redpajama_set_name: RedPajamaStackExchange


A rural Northern Ireland primary school has just been named the NSPCC's school of the year at a glittering London awards ceremony.
St Columb's Cullion is nestled among the foothills of Slieve Gallion in the Sperrin Mountains, and has just 90 pupils.
But the work they have been doing as UK Childhood Champions has clearly turned heads.
And last week a number of representatives flew to London to receive their award from NSPCC patron HRH The Countess Of Wessex at a special reception in Banking Hall.
The Desertmartin school was nominated for the title by NSPCC Schools Service Advisor Lisa Norris for their work with the charity.
She said they made her feel welcome from her very first meeting at the school.
"The school kindly supported NSPCC with fundraising and it was with pleasure to attend their presentation assembly last month, where a number of children shared their thoughts and reflections on their experience of NSPCC in their school," she added.
"It was an experience that was heart-warming and motivating for me."
Principal Patricia Carr said the school and community are both "overjoyed" with the "marvellous accolade".
She added: "For a small rural school like ours to have been recognized not only regionally, but nationally is nothing short of incredible.
"We feel like we could squeal from the top of Slieve Gallion at how proud we are of our incredible community of staff and pupils."
Pupils and staff at the school are expected to mark their award with Mid Ulster District Council and the Council for Catholic Maintained Schools at a special assembly on Tuesday, June 12.
A spokesperson for NSPCC Northern Ireland said: "We are absolutely delighted that St Columb's Primary School was named Outstanding School of the year at our Childhood Champions Awards. This award was richly deserved and we congratulate all the staff and pupils on their great achievement."


text:
Q: Start a new text message from a link in a web browser I know I can open an external program like Spotify with a link, but I'm wondering if it's possible to open the native text message app with a pre-populated the message the same way that the native share sheet does.
For example, this will open spotify:
Test link

A: invoke intent for SMS app
Intent smsIntent = new Intent(android.content.Intent.ACTION_VIEW);
smsIntent.setType("vnd.android-dir/mms-sms");
smsIntent.putExtra("address", phoneNumber);
smsIntent.putExtra("sms_body", text);
context.startActivity(Intent.createChooser(smsIntent, "SMS:"));

also you can check this answer for more options.